[Haskell-beginners] Re: mayBe stuck

prad prad at towardsfreedom.com
Fri Aug 6 14:04:25 EDT 2010

On Fri, 6 Aug 2010 03:43:30 -0400
Dean Herington <heringtonlacey at mindspring.com> wrote:

> I would write something like:
> br [] = []
> br ss = let (h, t) = break eqD ss
>          in h : case t of
>                   []    -> []
>                   _ : t -> br t
thx dean. that certainly looks cleaner than mine, but i'm not sure i
have seen this construct before.

i thought let/in was used like this:

aaa = let y = 1+2
          z = 4+6
          in  y+z

which is like 

aaa = y + z
    where y = 1+2
          z = 4+6

in other words, you just define the parts first and use the "in" to
define the main expression.

but here it seems you are defining what appears to be the main item 
let (h,t) = break eqD ss
to get the tuple parts and then forming your array (which really is
the main item) using these parts as
h : t
with t being given 2 options.

this is very interesting to me as i had not seen such a construct

In friendship,

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's

More information about the Beginners mailing list