pierce@lanai.cs.ucla.edu (12/04/88)
A while back someone in this newsgroup asked if there were plans to add a named-let* to official Scheme. I don't recall an answer to this. I often find a named-let* useful, but really don't care if it becomes official. I just wondered what the status of this issue was. By named-let* I mean something like the following*: (described in Eugene Kohlbecker's extend-syntax): (extend-syntax (named-let*) ((named-let* loop ((x1 v1) ...) e1 e2 ...) (andmap symbol? '(loop x1 ...)) (let* ((x1 v1) ...) (let loop ((x1 x1) ...) e1 e2 ...)))) ----- *Of course, there's no reason to have a separate syntax, they should be combined as: (extend-syntax (let*) [(let* () e1 e2 ...) (begin e1 e2 ...)] [(let* ([x1 v1] [x2 v2] ...) e1 e2 ...) (andmap symbol? '(x1 x2 ...)) (let ([x1 v1]) (let* ([x2 v2] ...) e1 e2 ...))] [(let* loop ([x1 v1] ...) e1 e2 ...) (andmap symbol? '(loop x1 ...)) (let* ([x1 v1] ...) (let loop ([x1 x1] ...) e1 e2 ...))]) ----- Now this definition assumes that the identifiers bound by a named-let* are distinct, but I don't see a reasonable interpretation for the meaning of such a construction anyway. Thus the fender for named-let* might be better written as: (let ((ids '(loop x1 ...)) (distinct-symbols? (lambda (lst) {some appropriate defn}))) (and (andmap symbol? ids) (distinct-symbols? ids))) where distinct-symbols? would have the obvious definition. Either that, or multiple instances of the same identifier should be allowed. Any opinions on that? (It is required that the name of a named-let be distinct from the identifiers bound by that let, or not?) ------ I guess in addition to hearing about whether let* will be extended to include a named form, I'd also like to find out which binding forms must bind only distinct identifiers, and which need not, and the motivation for these decisions. -- Brad Pierce pierce@CS.UCLA.EDU