Re: [Readable-discuss] Proposal: make $ serve as GROUP, leave \ to always be SPLIT
Arne Babenhauserheide 04 May 2013 20:44 UTC
Am Freitag, 3. Mai 2013, 23:13:31 schrieb David A. Wheeler:
> Another issue I see with the current leading $ behavior is this
> > inconsistency:
> >
> > foo (a b) ==> (foo (a b))
> > foo $ a b ==> (foo (a b))
> > (a b) ==> (a b)
> > $ a b ==> ((a b)) ; huh?!
The inconsistency is not in $, but in treating single-item lists specially:
a → a
a b → (a b)
Since (a b) is a single item, it gets treated as single item.
It makes the code more readable, but it also leads to some side-effects.
That’s one of the things I changed in wisp: To get the single-item behaviour, you have to prefix the item with a dot (.). The advantage is added consistency, but at the same time it is a trap: It’s easy to forget the . for a return value (real coding verified that assumption from Alan (I think it was Alan)).
Not adding brackets for a single item also has the advantage, that you can copy-paste lisp-code into readable. If you do the same in wisp, you have to prepend every top-level bracket with a dot.
Readable:
(a b (c)) → (a b (c))
Wisp:
. (a b (c)) → (a b (c))
On the other hand:
Readable:
$ a b → ((a b))
Wisp:
: a b → ((a b))
-or-
(a b) → ((a b))
Best wishes,
Arne
--
Ein Würfel System - einfach saubere Regeln:
- http://1w6.org