Re: [Haskell-cafe] "--" comments

2009-12-12 Thread Raynor Vliegendhart
On Sat, Dec 12, 2009 at 5:34 AM, Brandon S. Allbery KF8NH wrote: > > > On Dec 11, 2009, at 23:30 , michael rice wrote: > > > > I'm just noticing that "--" comments don't seem to work properly when the > > first character following them is a '*'. > > I believe the spec only treats "-- " as a comme

Re: [Haskell-cafe] accessible layout proposal?

2009-09-22 Thread Raynor Vliegendhart
On Tue, Sep 22, 2009 at 10:01 AM, Jimmy Hartzell wrote: > I am in love with this proposal: > http://www.haskell.org/haskellwiki/Accessible_layout_proposal I'm not sure whether I like the idea in general or not. It looks a bit odd. The suggestion on the talk page ( http://www.haskell.org/haskellw

Re: [Haskell-cafe] Mapping over multiple values of a list at once?

2009-08-27 Thread Raynor Vliegendhart
Just wondering, what should be the expected output be of something like mavg 4 [1..3]? [3%2] or []? Patai's and Eugene's solutions assume the former. On Thu, Aug 27, 2009 at 10:19 AM, wrote: > Hi, > > Imagine you have a list with n-values. You are asked to iterate over the list > and calculate t

Re: [Haskell-cafe] A mistake in haskellwiki

2009-08-06 Thread Raynor Vliegendhart
On 8/6/09, Don Stewart wrote: > leaveye.guo: > > Hi haskellers: > > > > There is a mistake in http://www.haskell.org/haskellwiki/State_Monad > > > > It post two functions like this : > > > > evalState :: State s a -> s -> a > > evalState act = fst $ runState act > > > > execState :: State s

Hylomorphisms (was: [Haskell-cafe] excercise - a completely lazy sorting algorithm)

2009-07-12 Thread Raynor Vliegendhart
On 7/12/09, Heinrich Apfelmus wrote: > Raynor Vliegendhart wrote: > > On 7/9/09, Heinrich Apfelmus wrote: > >> Of course, some part of algorithm has to be recursive, but this can be > >> outsourced to a general recursion scheme, like the hylomorphism > >> &g

Re: [Haskell-cafe] Re: excercise - a completely lazy sorting algorithm

2009-07-12 Thread Raynor Vliegendhart
On 7/9/09, Heinrich Apfelmus wrote: > > Of course, some part of algorithm has to be recursive, but this can be > outsourced to a general recursion scheme, like the hylomorphism > >hylo :: Functor f => (a -> f a) -> (f b -> b) -> (a -> b) >hylo f g = g . fmap (hylo f g) . f > Is that defin

Re: [Haskell-cafe] Monoid wants a (++) equivalent

2009-07-01 Thread Raynor Vliegendhart
On Tue, Jun 30, 2009 at 6:45 PM, Bryan O'Sullivan wrote: > I've thought for a while that it would be very nice indeed if the Monoid > class had a more concise operator for infix appending than "a `mappend` b". > I wonder if other people are of a similar opinion, and if so, whether this > is worth s

Re: [Haskell-cafe] Obscure weirdness

2009-06-20 Thread Raynor Vliegendhart
On 6/20/09, Andrew Coppin wrote: > > Is this a known bug in GHC 6.10.1? Will upgrading fix it? (Obviously, it's > quite a lot of work to change GHC.) Suffice it to say that my program is > quite big and complicated; it worked fine when it was still small and > simple. ;-) There is a bug in ghci 6

Re: [Haskell-cafe] Maintaining laziness: another example

2009-06-08 Thread Raynor Vliegendhart
This might be slightly related. When I was assisting a Haskell lab course, I encountered solutions like the following: > removeRoot :: BSTree a -> BSTree a > removeRoot (Node x Empty Empty) = Empty > removeRoot (Node x left Empty) = left > removeRoot (Node x Empty right) = right > removeRoot (Nod

Re: [Haskell-cafe] beginners question about fromMaybe

2009-06-02 Thread Raynor Vliegendhart
I just noticed that my suggestion doesn't work. You're testing whether val is Nothing and in my code snipped val has a different type. On 6/3/09, Raynor Vliegendhart wrote: > If you're absolutely certain that the lookup always succeeds, then you > can use patter

Re: [Haskell-cafe] beginners question about fromMaybe

2009-06-02 Thread Raynor Vliegendhart
If you're absolutely certain that the lookup always succeeds, then you can use pattern matching as follows: where jr = joinTuples sc x val key = getPartialTuple is x Just val = Map.lookup key m On 6/3/09, Nico Rolle wrote: > hi there > > heres a code s

Re: [Haskell-cafe] iota

2009-06-01 Thread Raynor Vliegendhart
this, you can reduce your iota function to a powerful one-liner: iota = sequence . map (enumFromTo 0 . pred) Kind regards, Raynor Vliegendhart On 6/1/09, Paul Keir wrote: > > > > Hi all, > > > > I was looking for an APL-style “iota” function for array indices. I noticed