{ [ ] [ ] } is starting to become a common pattern, with the cleave,
spread, short-circuit, and other high-level combinators taking
sequences of quotations as arguments. I think it'd be nice to have a
shorthand notation for this common pattern. My idea is to use [[ ]] as
brackets around a quotation sequence, with ;; as a separator (inspired
by { } and ; in Haskell's do syntax). So this:
--8<--
[[ drop [ cols>> ] [ rows>> ] bi* =
;; nip [ rows>> ] bi@ =
;; nipd [ cols>> ] bi@ =
]] 3&&
--8<--
would be equivalent to:
--8<--
{
[ drop [ cols>> ] [ rows>> ] bi* = ]
[ nip [ rows>> ] bi@ = ]
[ nipd [ cols>> ] bi@ = ]
} 3&&
--8<--
One could even go out on a limb and extend this pattern to arrays of
arrays or hash tables:
--8<--
{{ 1 [ "One! a-ha-ha!" ]
;; 2 [ "Two! a-ha-ha!" ]
}} case
H{{ "US$" 1.0 ;; "EU€" 1.6 ;; "CA$" 1.1 }}
--8<--
I'll implement these words in a separate vocab, but I want to make
sure this idea isn't totally insane before I go using it in any code.
-Joe
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk