want to draw attention to a bug in the jplayground using a variation of your 
script

https://jsoftware.github.io/j-playground/bin/html/emj.html#code=%20foo0%3D%3A%203%20%3A%20'0'%0D%0A%20%20foo1%3D%3A%203%20%3A%20'1'%0D%0A%20%20foo2%3D%3A%203%20%3A%20'2'%0D%0A%20%20foo3%3D%3A%203%20%3A%20'3'%0D%0A%20%20allfoo%3D%3A%20foo0%2Cfoo1%2Cfoo2%2Cfoo3%0D%0A%20%20allfoo%20''%0D%0A%20%20allfoo%3D%3A%20foo0%2Cfoo1%0D%0A%20%20allfoo%3D%3A%20allfoo%20f.%60%2C%60foo2%60%2C%60foo3%60%3A6%20%0D%0A%20%20allfoo


allfoo does not return a value (verb)

and resetting/refreshing playground is needed to get assignments to work.

I don't think it is a bug though.

scoped recursion is achieved through names.  The use of f. to do what you 
intended (no parentheses needed, btw) is a good use of f. to easily "solve 
everything".

another playground link, that provides an alternate solution

  allfoofinal=: allfoo,foo2,foo3

https://jsoftware.github.io/j-playground/bin/html/emj.html#code=c%20foo0%3D%3A%203%20%3A%20'0'%0D%0A%20%20foo1%3D%3A%203%20%3A%20'1'%0D%0A%20%20foo2%3D%3A%203%20%3A%20'2'%0D%0A%20%20foo3%3D%3A%203%20%3A%20'3'%0D%0A%20%20allfoo%3D%3A%20foo0%2Cfoo1%2Cfoo2%2Cfoo3%0D%0A%20%20allfoo%20''%0D%0A%20%20allfoo%3D%3A%20foo0%2Cfoo1%0D%0A%20%20allfoofinal%3D%3A%20allfoo%2Cfoo2%2Cfoo3%0D%0A%20%20allfoofinal



On Saturday, April 2, 2022, 01:42:43 p.m. EDT, Devon McCormick 
<devon...@gmail.com> wrote: 





Hi,
I have a group of monadic verbs for which I want the concatenated result,
e.g.
  foo0=: 3 : '0'
  foo1=: 3 : '1'
  foo2=: 3 : '2'
  foo3=: 3 : '3'
  allfoo=: foo0,foo1,foo2,foo3
  allfoo ''
0 1 2 3

So *allfoo* does what I want.  However, my actual set of verbs is longer
than this so I broke the assignment of *allfoo* into two pieces for
readability:
  allfoo=: foo0,foo1
  allfoo=: allfoo,foo2,foo3
  allfoo
allfoo , foo2 , foo3
  allfoo ''
|stack error: foo3
|allfoo[0]

I have inadvertently introduced infinite recursion.  Clearly I'm missing
something thinking I can concatenate verbs like I can concatenate nouns.

This gives me a result that performs as expected but looks bad:
  allfoo=: foo0,foo1
  allfoo=: (allfoo f.),foo2,foo3
  allfoo''
0 1 2 3
  allfoo
(3 : (,'0') , 3 : (,'1')) , foo2 , foo3

Any suggestions on how to break the assignment into multiple lines?

Thanks,

Devon



-- 

Devon McCormick, CFA

Quantitative Consultant
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to