Hacker News new | ask | show | jobs
by agumonkey 364 days ago
there's a hybrid form (sweet-expressions ? i forgot), top-level terms are parens-free

    eq (mul a a)
       (pow a 2)

    defun min (a b)
      (if (a < b) a b)

IIRC the hack to support this at read time was minimal, and it made a big impact in terms of "mainstream appeal"
2 comments

IMO, make some syntax element that means "each line indented from this one has one single element, unless indented further".

    eq :
        mul a a
        pow a 2

    defun min (a b) :
        if (< a b) a b
That means you can also have haskell-like continuations:

    seq :
        eq (mul a a)
            (pow a 2)
        eq 4 3
the elvish shell uses the syntax in the first example:

    > eq (* 3 3) (math:pow 3 2)
    ▶ $true
(function definitions on the other hand uses smalltalk/ruby style blocks)