Hacker News new | ask | show | jobs
by capableweb 1595 days ago
On a quick scan, it seems to be some more things than just `let`. One example would be `(Main n) = (Sum (Gen n))` should be closer to `(define Main (n) (Sum (Gen n)))` or similar. Not sure the change would be as easy as you think, but happy to be proven otherwise ;)

A `let` could assume un-even amount of forms in it and only evaluate the last one, using the other ones as bindings.

Example from your README:

    (Main n) =
      let size = (\* n 1000000)
      let list = (Range size Nil)
      (Fold list λaλb(+ a b) 0)
    
    (define Main (n)
      (let size (\* n 1000000)
           list (Range size Nil)
        (Fold list λaλb(+ a b) 0)))

Could even get rid of the parenthesis for arguments (`(n)` => `n`) and treating forms inside `define` the same as `let`.
2 comments

> On a quick scan, it seems to be some more things than just `let`. One example would be `(Main n) = (Sum (Gen n))` should be closer to `(define Main (n) (Sum (Gen n)))` or similar.

Good point.

> Could even get rid of the parenthesis for arguments (`(n)` => `n`) and treating forms inside `define` the same as `let`.

No, because non-curried functions are a feature. If we did that, every function would be curried. Which is nice, but non-curried functions are faster (lots of lambdas and wasteful copies are avoided using the equational rewrite notation), so they should be definitely accessible.

Just wanted to clarify that I definitely don't think this looks like a bad language as-is, I don't want to give the impression because of this small preference, it's less valuable (but I'm sure you knew that already). It's really impressive design, congratulations on getting it out for the world to play with :)
Curious, this suggests (lambda a b form) to go along with (let a 42 form). I've seen let without the extra parens but not define or lambda. Thanks for the aside.
Yeah, can't remember if I've seen that in the wild either before. Just as a disclaimer, the idea is off-the-cuff and I'm not 100% it would work in practice or be beneficial beyond containing less parenthesizes. You wouldn't be able to have multiple forms that gets evaluated for example, without having to wrap it in something like `do`, is the first argument against it. But maybe multiple forms in the body is less common than one in the first place.

Many questions arise, for a small amount of benefit (imo), so not sure it's worth it.