Thanks. How does the $: verb work? I don't really get it from the dictionary page. For example how does it work in:
sqrt=: DP&$: : (4 : 0) " 0 assert. 0<:y %/ <.@%: (2 x: (2*x) round y)*10x^2*x+0>.>.10^.y ) I can see that it makes x =. DP, but I don't know why. My best guess is that $: literally means 'sqrt' and so it is equivalent to DP&sqrt y Then again the extra colon after DP&$: is not clear to me either. On 20 Oct 2011, at 15:47, Raul Miller wrote: > On Thu, Oct 20, 2011 at 10:36 AM, David Vaughan > <[email protected]> wrote: >> It would seem that in the case statements, whenever anything is assigned, it >> is also displayed - can this be avoided? Also I would appreciate it if >> anyone could clarify how the $: works here (I copied the idea from a verb >> somewhere in the wiki). > > The last value that was generated outside of a test clause is the > result of the verb. > > But it's not being displayed in the verb -- it's being generated as a > result. The display happens later. > > In other words: > > shuffle=: 3 :'cube [] move"0 ] 3|?~y' > > The [] pair will delay resolution of the value of cube until after the > results from executing move have been completed. > > FYI, > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
