[Haskell-beginners] Re: Non-recursive binding expression
Will Ness
will_n48 at yahoo.com
Sun Mar 1 04:17:46 EST 2009
<j.romildo <at> gmail.com> writes:
>
> On Sat, Feb 28, 2009 at 01:01:56PM -0500, Brent Yorgey wrote:
> > On Sat, Feb 28, 2009 at 05:19:03PM +0000, Will Ness wrote:
> > > <j.romildo <at> gmail.com> writes:
> > >
> > > > Is there any non-recursive binding expression in Haskell?
> > >
> > Assignment in Haskell is not destructive update.
>
> I am not asking for assignment. What I want is indeed what I already
> said: a new lexical scope which introduces a new variable, but the
> variable name is being reused. That shadows the previous definition.
>
> Romildo
The code I posted has exactly these semantics:
When we write
test = head $
do xs <- [ [] ]
xs <- [ 3:xs ]
xs <- [ 8:xs ]
xs <- [ 7:xs ]
return xs
each xs in a singleton generator refers to its previous binding.
More information about the Beginners
mailing list