Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-29 Thread Michael Sperber

Neil Jerram <[EMAIL PROTECTED]> writes:

> But why?  Won't this gratuitously break loads of existing code?  Or
> are you saying that you will still retain the existing syntax, and add
> a new, more recommended one?

Thas was one suggestion.

> To me, named let feels natural, an intuitive combination of the ideas
> of local bindings (the let) and recursion (the name).  Argument based
> on the detailed differences between let and letrec feels over-precise
> to me, and ends up missing the wood for the trees.

After many years of Scheme, it feels natural to me, too.  However, I
always realize what a wart it is when I try to explain it to a Scheme
newbie.  I haven't found a way yet that avoids saying "see, it's
really a `letrec' form ...", and things always go downhill from there.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-29 Thread Carl Eastlund

On 1/29/07, Neil Jerram <[EMAIL PROTECTED]> wrote:


But why?  Won't this gratuitously break loads of existing code?  Or
are you saying that you will still retain the existing syntax, and add
a new, more recommended one?

To me, named let feels natural, an intuitive combination of the ideas
of local bindings (the let) and recursion (the name).  Argument based
on the detailed differences between let and letrec feels over-precise
to me, and ends up missing the wood for the trees.


To me, it's all about code readability.  The name "let" is suggestive
of "let x be 5" and similar mathematical bindings, so it is natural to
start variable bindings that way.  It has no mnemonic for recursive
computation, and most "let" forms in code are not for recursive
computation, so named-let forms can be confusing to programmers
unfamiliar with them.

I support giving the inline recursive computation form of "let" a more
descriptive name, that's all.  Precisely because it combines "let"
with another idea, and I think the form "let" should not be more than
its name suggests.

--
Carl Eastlund

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-29 Thread Neil Jerram
Michael Sperber <[EMAIL PROTECTED]> writes:

> "Carl Eastlund" <[EMAIL PROTECTED]> writes:
>
>> For reference, PLT Scheme has a "recur" form (in the "etc.ss" library)
>> for those who do not like named let.  Other than the name, it has
>> precisely the same syntax and behavior as named let.  There is no need
>> to lose anything in the transition.  I don't think anyone is trying to
>> take anything away, just to change names.
>
> Exactly.

But why?  Won't this gratuitously break loads of existing code?  Or
are you saying that you will still retain the existing syntax, and add
a new, more recommended one?

To me, named let feels natural, an intuitive combination of the ideas
of local bindings (the let) and recursion (the name).  Argument based
on the detailed differences between let and letrec feels over-precise
to me, and ends up missing the wood for the trees.

Regards,
 Neil


___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Michael Sperber

Eli Barzilay <[EMAIL PROTECTED]> writes:

> What I meant was that adding a name to a `let' (moving from [3] to
> [1]) does not change the meaning of the expression.  But adding a name
> to a `letrec' (moving from [4] to [1]) does -- at least as far as I
> can tell from [0].

Ah, thanks for explaining, I get your point.  I guess that's an
argument for not moving named `let' to `letrec'.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Eli Barzilay
On Jan 26, Michael Sperber wrote:
> 
> ... which is not making any positive suggestions.  Since still don't
> have any idea what you think I suggested, it's hard for me to offer
> a precise comment.  All I suggested was that

Retry: I read this:

> the expansion for "named letrec" be identical to what's currently
> the expansion for "named let."[0]

as literally saying that the expansion of

  (letrec loop ([x x]) x)   [1]

is the same as the expansion of

  (let loop ([x x]) x)  [2]

and if that's the same named let I know, then it's the same as

  (let ([x x]) x)   [3]

and we get to the conclusion that:

  (letrec loop ([x x]) x)   [1]

is not the same as

  (letrec ([x x]) x)[4]

which, IMO, is a Really Bad Thing.


> Sure the jump you describe is "harmless", but it's only harmless in
> circumstances I've never seen in the wild.  Why would you write a
> named let if the name doesn't occur in the body?

What I meant was that adding a name to a `let' (moving from [3] to
[1]) does not change the meaning of the expression.  But adding a name
to a `letrec' (moving from [4] to [1]) does -- at least as far as I
can tell from [0].

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
  http://www.barzilay.org/ Maze is Life!

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Michael Sperber

Eli Barzilay <[EMAIL PROTECTED]> writes:

> On Jan 26, Michael Sperber wrote:
>> 
>> I'm probably being dense.  Why would it break?  
>
> Then what does `letrec' has to do with any of this?  You said you
> prefer `letrec' for a name, which I don't understand -- the jump from
> a plain `let' to a named one is harmless if you don't use the name in
> the body, but IIUC, you suggest that:
>
>   (letrec loop ([x x]) x) == (let ([x x]) x)
>
> ??  (I must be missing something, because I don't see how *that* can
> be considered as an improvement.)

No, I didn't.  I said:

>> If you think I'm suggesting a "named letrec" should expand into
>> something that letrec-binds `tree' (rather than just `loop'), then
>> you're wrong.

... which is not making any positive suggestions.  Since still don't
have any idea what you think I suggested, it's hard for me to offer a
precise comment.  All I suggested was that the expansion for "named
letrec" be identical to what's currently the expansion for "named
let."

Sure the jump you describe is "harmless", but it's only harmless in
circumstances I've never seen in the wild.  Why would you write a
named let if the name doesn't occur in the body?

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Eli Barzilay
On Jan 26, Michael Sperber wrote:
> 
> Eli Barzilay <[EMAIL PROTECTED]> writes:
> 
> > If you're suggesting:
> >
> >   (letrec loop ([x ...]) body ...)
> 
> That isn't really my preference, but it would be an improvement.
> 
> > then I don't understand how it can work in any intuitive way.  Worse,
> > I find it very common to write
> >
> >   (define (tree-foo foo tree)
> > (let loop ([tree tree])
> >   ...))
> >
> > which breaks if it was using a letrec.
> 
> I'm probably being dense.  Why would it break?  If you think I'm
> suggesting a "named letrec" should expand into something that
> letrec-binds `tree' (rather than just `loop'), then you're wrong.

Then what does `letrec' has to do with any of this?  You said you
prefer `letrec' for a name, which I don't understand -- the jump from
a plain `let' to a named one is harmless if you don't use the name in
the body, but IIUC, you suggest that:

  (letrec loop ([x x]) x) == (let ([x x]) x)

??  (I must be missing something, because I don't see how *that* can
be considered as an improvement.)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
  http://www.barzilay.org/ Maze is Life!

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Michael Sperber

Eli Barzilay <[EMAIL PROTECTED]> writes:

> If you're suggesting:
>
>   (letrec loop ([x ...]) body ...)

That isn't really my preference, but it would be an improvement.

> then I don't understand how it can work in any intuitive way.  Worse,
> I find it very common to write
>
>   (define (tree-foo foo tree)
> (let loop ([tree tree])
>   ...))
>
> which breaks if it was using a letrec.

I'm probably being dense.  Why would it break?  If you think I'm
suggesting a "named letrec" should expand into something that
letrec-binds `tree' (rather than just `loop'), then you're wrong.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-26 Thread Michael Sperber

"Carl Eastlund" <[EMAIL PROTECTED]> writes:

> For reference, PLT Scheme has a "recur" form (in the "etc.ss" library)
> for those who do not like named let.  Other than the name, it has
> precisely the same syntax and behavior as named let.  There is no need
> to lose anything in the transition.  I don't think anyone is trying to
> take anything away, just to change names.

Exactly.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Arthur A. Gleckler
Quoting Lynn Winebarger <[EMAIL PROTECTED]>:

> Yes.  Whoever came up with the idea of allowing labeling of a
> let form
> did a great service to the language.  I also took a while to get
> used to
> it, but I wouldn't want to go back.  I strenuously object to it
> being
> considered a wart.

I, too, hope we'll let named let alone.  It's a wonderful feature and
renaming it would be nothing but a waste of time.


This message was sent using IMP, the Internet Messaging Program.

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Eli Barzilay
On Jan 25, Michael Sperber wrote:
> The fact that the convenient syntax for writing recursive procedures
> is part of `let' is a long-standing wart in the syntax of Scheme.

I disagree.


> It is unintuitive (it expands into `letrec', rather than a simpler
> form of `let), difficult to explain to newcomers to Scheme, and
> disconcerting to the casual reader.
> 
> How to fix:
> 
> If the syntax needs to be integrated with one of the standard
> binding forms, it should be `letrec', not `let'.  However, it would
> be much better to rename named `let' to something else such as
> `rec', `recur' or `recursive'.

If you view

  (let ([x v] ...) body ...)

as sugar for

  ((lambda (x ...) body ...) v ...)

then a named let makes a lot of sense -- it simply gives a name to
that function.  It just happens that this needs a letrec in the
expansion, but it's unrelated to the let bindings (now function
bindings) that are still bound in the same way.  An unnamed let can
expand to a similar letrec, except that the name is never used so it
can be skipped.

If you're suggesting:

  (letrec loop ([x ...]) body ...)

then I don't understand how it can work in any intuitive way.  Worse,
I find it very common to write

  (define (tree-foo foo tree)
(let loop ([tree tree])
  ...))

which breaks if it was using a letrec.

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
  http://www.barzilay.org/ Maze is Life!

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Lynn Winebarger


Robby Findler wrote:
> I think Mike would be happy merely renaming named let to something
> else, not taking it away. Do you really care if it begins with the
> letters l-e-t or some other letters (legacy code aside)?

   Yes.  Whoever came up with the idea of allowing labeling of a let form 
did a great service to the language.  I also took a while to get used to 
it, but I wouldn't want to go back.  I strenuously object to it being 
considered a wart.

   Another way to look at the issue is to see the base form of let as
the special/degenerate case where the let is not labeled. 
Correspondingly, it would be nice to have lambda be name-able, but that 
would not work with the variable argument syntax.  It also hits a sweet 
spot where you don't need mutual recursion.
   Names do matter, and I think being able to bind the entry point as 
well as the arguments is elegant.  How does removing this expressiveness 
improve the language?

   I think rec or recur is pretty awful for the name of a binding form.
In fact, I use (let recur (...) ...) and (let loop (...) ...) to indicate 
what kind of recursion the procedure engages in, mostly because those 
names make sense as _actions_, not as binders, if that makes sense.
   I don't see why newbies not understanding how this works lessens its 
value.  After all, the discovery that lambdas are just labels with 
arguments is fundamental to Scheme.


Lynn


___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Carl Eastlund

On 1/25/07, Lynn Winebarger <[EMAIL PROTECTED]> wrote:


Let me say, as a heavy user of Scheme and named let,
"NOOO!".
In this case, the non-uniformity of the syntax is not a wart.  It
is deliciously correct, short and sweet.  A "rec" form would not (in
its usual incarnation) let you put initial values in the parameters,
which is exactly what makes named let so great.  letrec is so ugly when
used for the same purposes.
Oh, and named let is not another name for "loop".  It's for
recursion every which way you want it.
Please, please, do not take named let away from me!


For reference, PLT Scheme has a "recur" form (in the "etc.ss" library)
for those who do not like named let.  Other than the name, it has
precisely the same syntax and behavior as named let.  There is no need
to lose anything in the transition.  I don't think anyone is trying to
take anything away, just to change names.

--
Carl Eastlund

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Robby Findler

I think Mike would be happy merely renaming named let to something
else, not taking it away. Do you really care if it begins with the
letters l-e-t or some other letters (legacy code aside)?

Robby

On 1/25/07, Lynn Winebarger <[EMAIL PROTECTED]> wrote:


Quoting Michael Sperber <[EMAIL PROTECTED]>:
>
> The fact that the convenient syntax for writing recursive procedures
> is part of `let' is a long-standing wart in the syntax of Scheme.  It
> is unintuitive (it expands into `letrec', rather than a simpler form
> of `let), difficult to explain to newcomers to Scheme, and
> disconcerting to the casual reader.
>

Let me say, as a heavy user of Scheme and named let,
"NOOO!".
In this case, the non-uniformity of the syntax is not a wart.  It
is deliciously correct, short and sweet.  A "rec" form would not (in
its usual incarnation) let you put initial values in the parameters,
which is exactly what makes named let so great.  letrec is so ugly when
used for the same purposes.
Oh, and named let is not another name for "loop".  It's for
recursion every which way you want it.
Please, please, do not take named let away from me!

Thanks for your consideration,
Lynn






___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss



___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Fwd: Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread Lynn Winebarger


Quoting Michael Sperber <[EMAIL PROTECTED]>:


The fact that the convenient syntax for writing recursive procedures
is part of `let' is a long-standing wart in the syntax of Scheme.  It
is unintuitive (it expands into `letrec', rather than a simpler form
of `let), difficult to explain to newcomers to Scheme, and
disconcerting to the casual reader.



   Let me say, as a heavy user of Scheme and named let,
"NOOO!".
   In this case, the non-uniformity of the syntax is not a wart.  It
is deliciously correct, short and sweet.  A "rec" form would not (in
its usual incarnation) let you put initial values in the parameters,
which is exactly what makes named let so great.  letrec is so ugly when
used for the same purposes.
   Oh, and named let is not another name for "loop".  It's for
recursion every which way you want it.
   Please, please, do not take named let away from me!

Thanks for your consideration,
Lynn






___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss


Re: [r6rs-discuss] [Formal] Rename named `let'

2007-01-25 Thread John Cowan
Michael Sperber scripsit:

> However, it would be much
> better to rename named `let' to something else such as `rec', `recur'
> or `recursive'.

Or even better, "loop".

> As this would break many existing Scheme programs, the report might
> introduce the separate form, and, to ease the transition, keep named
> `let' for now, either putting it into a separate library alongside
> (r6rs mutable-pairs) or at least marking it as deprecated and likely
> to disappear in a future revision of the report.

+1

-- 
Eric Raymond is the Margaret Mead   John Cowan
of the Open Source movement.[EMAIL PROTECTED]
--Bruce Perens, http://www.ccil.org/~cowan
  some years ago

___
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss