Optional Outer Parentheses (An acronym of ill omen?)
For example: = a 5
def foo (x) (+ x 1)
I removed all the outer parens from the News code. The paste is available here: http://codepad.org/Yv8VjZuD for lack of a place to upload things.It looks pretty nice in my opinion. The main implementation issue I see is that to support multiline forms, a single newline would need to keep the expression in the same form, while multiple newlines would seperate forms: = a 1 -> (= a 1
b 2 b 2)
= a 1
-> (= a 1)
b 2 (b 2)
I think it looks nice in source code, but it would be very convenient in the REPL where 1-liners are common. I already feel urges to leave out outer parens while in the REPL. Exterior Symbols
Examples of the sorts of things I mean by "exterior symbols": 4 * (pr "hi") -> (repeat 4 (pr "hi"))
(fn () (pr "hi")) : -> ((fn () (pr "hi")))
(fn (a) (pr a)) : 'hi -> ((fn (a) (pr a)) 'hi)
pr : 'h 'i -> (pr 'h 'i)
'h 'i : pr -> (pr 'h 'i)
'h 'i : (fn (a b) -> ((fn (a b)
(pr a b)) (pr a b)) 'h 'i)
Excluding the last couple examples, the ":" could have the same nature as the current composition operator except that non-functional arguments would be considered functions which return those arguments."Piping": (fn (x d e) (pr (+ x d e))) <= (fn (foo) (* foo 2)) 2 bar => (fn (x d e) (pr (- x d e)))
Which would become: (fn (z1 z2)
(with (a ((fn (foo) (* foo 2)) z1)
b 2
c z2)
((fn (x d e) (pr (+ x d e))) a b c)
((fn (x d e) (pr (- x d e))) a b c)))
Usage of "|" as "with": (pr a b) | a 'h b 'i -> (with (a 'h b 'i)
(pr a b))
a 'h b 'i | (pr a b) -> (with (a 'h b 'i)
(pr a b))
All these exterior symbolisms are intended to be nestable (just put parentheses around them.) An example I found nice which uses both optional outer parens and exterior symbols: pr a b | a 'h b 'i -> (with (a 'h b 'i)
(pr a b))
Other possibilities are scope/environment switches and stuff like that. Or something. I'm just giving rough, haphazard, and questionable examples of possibilities. I'm probably glazing over some fundamental issue somewhere in the basis, but as heuristics these topics aren't bad. Sometimes interesting things can happen when considering formalisms in their own light, a la the coincidentally-named exterior forms of math. |