Arc Forumnew | comments | leaders | submitlogin
3 points by rocketnia 5158 days ago | link | parent

I like it just the way it is in this regard. If (let x (+ 1 x) ...) can get the 'x from the outer scope, then (let x (fn () x) ...) should be able to get that 'x too. Besides, I like minimizing the number of times I type a local variable name; the name 'self is often much shorter than the name of my function, and I have less editing to do if I decide to rename it. (I can find-and-replace, but that leaves me with indentation to fix.)

At one point I wanted to unify all lets to be Haskell-style, so that you could do crazy things like building arbitrary cyclic data structures:

  (let x (cons 1 y)
       y (cons 0 x)
    (iso (firstn 4 x) '(1 0 1 0)))
After all, recursive functions are cyclic data structures in a sense.

But now I think that's a job for a more pure language; as far as I can tell, it requires partial evaluation and lazy (or at least non-strict) semantics. I'm sure I'm wrong, 'cause strict Haskells exist, but I'm not sure what they do here.

Here's my comment from a similar thread that came up a while ago, which might help if you're looking for a 'letrec implementation: http://arclanguage.org/item?id=12418