[Jprogramming] Re: Tacit adverb definitions?
Samuel Tardieu
sam at rfc1149.net
Sat Jul 8 23:14:00 HKT 2006
Thanks Dan, Mark and others for your very useful replies.
The question arose the other morning when, while taking my breakfast,
I wrote a few Forth stack-manipulating words waiting for my coffee to
get colder.
A lot of Forth words manipulate the two top elements of the stack
(represented as a rank 1 data structure), so instead of writing the
monadic 'plus' word as:
plus =: _2&}. , _2&{ + {:
I made an oper adverb to factorize everything but the '+'
oper =: 1 : '_2&}. , _2&{ u {:'
plus =: + oper
minus =: - oper
swap =: (],[) oper
and so on.
Being a big fan of tacit programming (more precisely of variable-less
programming), I wondered whether adverbs such as 'oper' could be written
tacitely or not.
Sam
--
Samuel Tardieu -- sam at rfc1149.net -- http://www.rfc1149.net/
More information about the Programming
mailing list