3 ms·
if you haven't seen it yet, the concept of OOPAL[1] as seen in fscript[2] is rather interesting. Basically it boils down to integration of array programming an
by riffraff 14y ago
if you haven't seen it yet, the concept of OOPAL[1] as seen in fscript[2] is rather interesting.
Basically it boils down to integration of array programming and objects through the concept of "messaging patterns", which change the behaviour of a message/method call so that it multiplexes over self/arguments via syntactic magic
So you have stuff like
# at aggregate level
[[0,1],["a"]] count #=> 2
# content level, looping left
[[0,1],["a"]] @count #=> [2, 1]
# content level, looping right
2 greatherThan@ [1,3] #=> [true, false]
you can combine these things for multiple levels of nesting, and there are other messaging pattern for indexing, reduction etc.
This feels more declarative than performing explicit loops or using map/fold&co for some things, but also a fair bit mor obscure
(Perl6 also has something similar via hyperoperators and metaoperators, I think)
[1] http://www.fscript.org/documentation/OOPAL.pdf http://www.fscript.org/documentation/OOPAL.pdf
[2] http://www.fscript.org http://www.fscript.org