I’m Brent Yorgey. I live with my beautiful wife Joyia and cute son Noah in Philadelphia, where I am a PhD student in the programming languages group at the University of Pennsylvania. My academic/professional interests include functional programming languages (especially Haskell), type systems, category theory, combinatorics, discrete mathematics in general, and mathematics education. Other interests include music (I am a classical and jazz pianist), Go, and ancient Greek. Those who wish to know more can try following the “Personal” links listed below, and performing type inference.
Pages
Categories
Tags
announcement applicative BlogLiterately category theory collaborative editing combinatorial species combinatorics darcs diagrams drawing EDSL FringeDC functional programming functor GHC ghci grad school graphics hackathon Hac φ haskell ICFP knowledge library list monad monads monoid partitions patch theory pedagogy Philadelphia pictures preorder programming reading release species talk tutorial type-level Typeclassopedia types UPenn xmonadArchives
- May 2013 (1)
- April 2013 (3)
- March 2013 (2)
- January 2013 (2)
- December 2012 (2)
- November 2012 (4)
- October 2012 (3)
- August 2012 (4)
- July 2012 (5)
- June 2012 (1)
- March 2012 (1)
- January 2012 (1)
- November 2011 (4)
- October 2011 (3)
- September 2011 (2)
- August 2011 (2)
- July 2011 (2)
- June 2011 (1)
- May 2011 (6)
- April 2011 (2)
- March 2011 (1)
- February 2011 (3)
- January 2011 (1)
- December 2010 (2)
- November 2010 (3)
- October 2010 (1)
- September 2010 (1)
- August 2010 (3)
- July 2010 (2)
- June 2010 (3)
- May 2010 (3)
- April 2010 (3)
- March 2010 (2)
- February 2010 (1)
- January 2010 (1)
- December 2009 (2)
- October 2009 (3)
- September 2009 (2)
- August 2009 (4)
- July 2009 (7)
- June 2009 (1)
- May 2009 (2)
- April 2009 (1)
- March 2009 (2)
- February 2009 (3)
- January 2009 (3)
- December 2008 (2)
- September 2008 (2)
- August 2008 (1)
- July 2008 (3)
- June 2008 (1)
- April 2008 (4)
- March 2008 (4)
- February 2008 (4)
- January 2008 (2)
- December 2007 (4)
- October 2007 (2)
- September 2007 (2)
- August 2007 (3)
- June 2007 (2)
Top Posts
Blogroll
Fun
Personal
Meta
Hi
I’ve been reading your site for a while now, and it’s very interesting. Great job! you may know the answer to a question that I have been wondering about recently, but cant find the answer. Is it possible (I know Haskell doesnt seem to provide a list subtraction operator) to express a statement of infinite lists like:
[1..] – [2..]
Whichshould yield “1″ as the answer?
Hi Rory,
Haskell does actually provide a list difference operator, it’s called (\\), and can be found in Data.List. For example, [1,2,3,4] \\ [2,3,5] evaluates to [1,4], and [2,2,3] \\ [2,1] evaluates to [2,3]. However, if you try typing [1..] \\ [2..] at the ghci prompt it will sit there forever trying to compute the first value of the result. (\\) can’t deal with infinite lists, since list difference cannot work for infinite lists in general. There’s no way for \\ to know that the lists you gave it happen to have this special structure.
With that said, it should be quite easy to define a new data type which can store this special structure, and a list difference operator (and other operators) which can take advantage of it. For example, something like
data NewList a = Normal [a] | Infinite a | Range a a
Then you could define
listDiff :: (Eq a, Succ a) => NewList a -> NewList a -> NewList a
such that listDiff (Infinite 1) (Infinite 2) evaluated to (Range 1 1) or something like that.
Let me also take this opportunity to point out that the #haskell IRC channel on freenode.net is a fun place full of helpful people (strange, I know!) and you might enjoy hanging out there and asking any more questions you might have.
Pingback: Differences and Intersections on Infinite Lists. « tech guy in midtown
Brent,
I was surprised to stumble on this post because I’ve been thinking this problem recently. I wrote up my thoughts last night and posted them here:
http://techguyinmidtown.com/2008/04/30/differences-and-intersections-on-infinite-lists/
harfga: Cool, thanks for letting me know! I posted a comment over there with another idea that you might find interesting.
Great blog title. I’ve been studying Haskell lately. It seems there are a fair number of J programmers that find this language interesting. So far so good. I rather like Haskell’s take on outer products and uniform treatment of currying.
Hmm, I’m not 100% sure I know what you mean by “Haskell’s take on outer products” — are you talking about list comprehensions? In any case, I’m glad you’re finding it interesting! Haskell certainly does make a lot of interesting decisions that are quite different from most mainstream languages.
Very nice blog. I’m looking forward to reading through some of the archives. I’ll be posting some category theoretical posts on my blog in the near future. I’m looking at implementing category theoretic constructions in ML as I go through the mathematical background. Perhaps you might enjoy it :)
Sounds cool, I’ve just subscribed to your RSS feed! Actually I think I remember seeing a link to some other post on your blog once before but I forget which one.