Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Combine let* let letrec into super-let (or simply let)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
narutocanada@gmail.com  
View profile  
 More options Aug 26 2008, 1:19 pm
Newsgroups: comp.lang.scheme
From: "narutocan...@gmail.com" <narutocan...@gmail.com>
Date: Tue, 26 Aug 2008 10:19:18 -0700 (PDT)
Local: Tues, Aug 26 2008 1:19 pm
Subject: Combine let* let letrec into super-let (or simply let)
hi

Please combine let* let letrec into super-let, (or simply let) for
future consideration.
I can not for my life see a reason for keeping "the other" "lets",
other than the super-let (or simply let). Is there occassions why one
would want "the other" "lets" other than super-let? If one word can
mean three features, why not use the super version for brevity. Just a
suggestion.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Aug 26 2008, 2:02 pm
Newsgroups: comp.lang.scheme
From: p...@informatimago.com (Pascal J. Bourguignon)
Date: Tue, 26 Aug 2008 20:02:13 +0200
Local: Tues, Aug 26 2008 2:02 pm
Subject: Re: Combine let* let letrec into super-let (or simply let)

"narutocan...@gmail.com" <narutocan...@gmail.com> writes:
> hi

> Please combine let* let letrec into super-let, (or simply let) for
> future consideration.
> I can not for my life see a reason for keeping "the other" "lets",
> other than the super-let (or simply let). Is there occassions why one
> would want "the other" "lets" other than super-let? If one word can
> mean three features, why not use the super version for brevity. Just a
> suggestion.

The semantics are not the same.

First for simple values:

> (let ((a 1) (b 2))  (let    ((a 3) (b a)) (display (list a b)) (newline)))
(3 1)
> (let ((a 1) (b 2))  (let*   ((a 3) (b a)) (display (list a b)) (newline)))
(3 3)
> (let ((a 1) (b 2))  (letrec ((a 3) (b a)) (display (list a b)) (newline)))

(3 3)

Next for functions:

> (let ((a (lambda (x) 1)) (b (lambda (x) 2)))

    (let ((a (lambda (x) (if (< 0 x) (cons 3 (a (- x 1))) '(3))))
          (b (lambda (x) (cons 4 (a x)))))
       (display (list (a 1) (b 1))) (newline)))
((3 . 1) (4 . 1))
> (let ((a (lambda (x) 1)) (b (lambda (x) 2)))

    (let* ((a (lambda (x) (if (< 0 x) (cons 3 (a (- x 1))) '(3))))
           (b (lambda (x) (cons 4 (a x)))))
       (display (list (a 1) (b 1))) (newline)))
((3 . 1) (4 3 . 1))
> (let ((a (lambda (x) 1)) (b (lambda (x) 2)))

    (letrec ((a (lambda (x) (if (< 0 x) (cons 3 (a (- x 1))) '(3))))
             (b (lambda (x) (cons 4 (a x)))))
       (display (list (a 1) (b 1))) (newline)))
((3 3) (4 3 3))

So, depending on the kind of results you want, you will choose one or
the other.

--
__Pascal Bourguignon__                     http://www.informatimago.com/

Pour moi, la grande question n'a jamais été: «Qui suis-je? Où vais-je?»
comme l'a formulé si adroitement notre ami Pascal, mais plutôt:
«Comment vais-je m'en tirer?» -- Jean Yanne


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Kraft  
View profile  
 More options Aug 26 2008, 2:10 pm
Newsgroups: comp.lang.scheme
From: Daniel Kraft <d...@domob.eu>
Date: Tue, 26 Aug 2008 20:10:52 +0200
Local: Tues, Aug 26 2008 2:10 pm
Subject: Re: Combine let* let letrec into super-let (or simply let)

True, but I can imagine the OP thought about using the letrec semantics
for everything (at least that's what I'd suggest).

What's a real-world (not examples as above) benefit of having a simple
(let) that can not be achieved easily with (letrec)?  Or is the main
benefit of (let) to allow better optimization as its semantics is simpler?

Yours,
Daniel

--
Done:     Arc-Bar-Cav-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
To go:    Hea-Kni-Mon-Pri-Ran-Rog-Tou


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lauri Alanko  
View profile  
 More options Aug 26 2008, 2:42 pm
Newsgroups: comp.lang.scheme
From: Lauri Alanko <l...@iki.fi>
Date: 26 Aug 2008 18:42:41 GMT
Local: Tues, Aug 26 2008 2:42 pm
Subject: Re: Combine let* let letrec into super-let (or simply let)
In article <f22087d8-22b2-4dc6-bddd-a83b69bd6...@p31g2000prf.googlegroups.com>,

narutocan...@gmail.com <narutocan...@gmail.com> wrote:
> Please combine let* let letrec into super-let, (or simply let) for
> future consideration.

Would letrec* fill your needs? It's supported by a number of
implementations, and it's also in R6RS:

http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html#node_idx_406

Lauri


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jos koot  
View profile  
 More options Aug 27 2008, 6:41 am
Newsgroups: comp.lang.scheme
From: jos koot <jos.k...@telefonica.net>
Date: Wed, 27 Aug 2008 03:41:45 -0700 (PDT)
Local: Wed, Aug 27 2008 6:41 am
Subject: Re: Combine let* let letrec into super-let (or simply let)
On Aug 26, 6:19 pm, "narutocan...@gmail.com" <narutocan...@gmail.com>
wrote:

> hi

> Please combine let* let letrec into super-let, (or simply let) for
> future consideration.
> I can not for my life see a reason for keeping "the other" "lets",
> other than the super-let (or simply let). Is there occassions why one
> would want "the other" "lets" other than super-let? If one word can
> mean three features, why not use the super version for brevity. Just a
> suggestion.

PLT Scheme has let+, which combines let, let*, letrec, letrec*, let-
values, let*-values letrec-values and letrec*-values.
See http://docs.plt-scheme.org/mzlib/mzlib_etc.html#(form._((lib._mzlib/e...))
Jos

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil Bewig  
View profile  
 More options Aug 27 2008, 8:54 am
Newsgroups: comp.lang.scheme
From: Phil Bewig <pbe...@gmail.com>
Date: Wed, 27 Aug 2008 05:54:34 -0700 (PDT)
Local: Wed, Aug 27 2008 8:54 am
Subject: Re: Combine let* let letrec into super-let (or simply let)
On Aug 26, 12:19 pm, "narutocan...@gmail.com" <narutocan...@gmail.com>
wrote:

> hi

> Please combine let* let letrec into super-let, (or simply let) for
> future consideration.
> I can not for my life see a reason for keeping "the other" "lets",
> other than the super-let (or simply let). Is there occassions why one
> would want "the other" "lets" other than super-let? If one word can
> mean three features, why not use the super version for brevity. Just a
> suggestion.

The use of the various kinds of let, as opposed to a single super-let,
can give the reader valuable clues about the nature of your program.
Letrec has different scoping rules than let.  Using super-let would
confuse the reader about the intentions of the author.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
namekuseijin  
View profile  
 More options Aug 27 2008, 12:51 pm
Newsgroups: comp.lang.scheme
From: namekuseijin <namekusei...@gmail.com>
Date: Wed, 27 Aug 2008 09:51:24 -0700 (PDT)
Local: Wed, Aug 27 2008 12:51 pm
Subject: Re: Combine let* let letrec into super-let (or simply let)
On Aug 27, 9:54 am, Phil Bewig <pbe...@gmail.com> wrote:

> The use of the various kinds of let, as opposed to a single super-let,
> can give the reader valuable clues about the nature of your program.
> Letrec has different scoping rules than let.  Using super-let would
> confuse the reader about the intentions of the author.

I agree.  It's good specialization and I believe that also leads to
more efficient implementations.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »