[Jprogramming] an improvement to apply and perhaps anon evoke

Pascal Jasmin godspiral2000 at yahoo.ca
Sat Apr 5 17:26:42 UTC 2014


apply does not work with dyadic verbs, and cannot produce modifiers.  Consider the following simple looking eval function.

eval =: 1 : ' a: 1 :  m'


  2 '+' eval 1 2 3 
3 4 5 


  + '/' eval 1 2 3 
6 



  '+/' eval(+:@) 1 2 3 
12 


  +:@+'/' eval 1 2 3 
22 


  +: +'/' eval 1 2 3 
12 


 (+: '@' eval +)'/' eval 1 2 3 

22 

  +: '@' eval +'/' eval 1 2 3 
12 


The last statement is interesting because it seems to alter the normal conjunction train processing (sometimes in desirable ways)

instead of just grabbing a single token as v.

< '@' eval +'/' eval 1 2 3    NB. would be domain error without '@'eval
┌─┐ 
│6│ 
└─┘ 


eval is the key to how my multiline tacit code works:  http://www.jsoftware.com/jwiki/PascalJasmin/Multiline%20tacit%20expressions%20with%20macros


More information about the Programming mailing list