You need to double the quotes when you quote quotes. Also, once you get past that point, this trace reveals a bug. I think the bug is that the implementation is supposed to throw a domain error where trace throws it.
Thanks, -- Raul On Thu, Apr 18, 2013 at 11:02 PM, Linda Alvord <[email protected]> wrote: > all=:([:<([: (([ (,^:A) 6:) ) g) f."0 _)"0 _ > T all i.2 2 > ┌───┬───┐ > │2 4│0 2│ > │ │1 3│ > ├───┼───┤ > │2 3│_2 │ > │0 1│ │ > └───┴───┘ > trace '([:<([: (([ (,^:A) 6:) ) g) f."0 _)"0' _ > --------------- 4 Conj ------- > , > ^: > A > ,^:A > --------------- 8 Paren ------ > ( > ,^:A > ) > ,^:A > --------------- 5 Trident ---- > [ > ,^:A > 6: > [ ,^:A 6: > --------------- 8 Paren ------ > ( > [ ,^:A 6: > ) > [ ,^:A 6: > --------------- 8 Paren ------ > ( > [ ,^:A 6: > ) > [ ,^:A 6: > --------------- 5 Trident ---- > [: > [ ,^:A 6: > g > [: ([ ,^:A 6:) g > --------------- 8 Paren ------ > ( > [: ([ ,^:A 6:) g > ) > [: ([ ,^:A 6:) g > --------------- 3 Adverb ----- > [: ([ ,^:A 6:) g > f. > |value error: A > | t_z=. ([:([,^:A 6:)g)(f.) > > Also: > > all5=:([:<([: (([ (,^:(0:`(<'`:'))) 6:) ) [ , [: < [ ('0' ; ]) ]) f."0 _)"0 _ > T all5 i.2 2 > ┌───┬───┐ > │2 4│0 2│ > │ │1 3│ > ├───┼───┤ > │2 3│_2 │ > │0 1│ │ > └───┴───┘ > > trace '([:<([: (([ (,^:(0:`(<'`:'))) 6:) ) [ , [: < [ ('0' ; ]) ]) f."0 > _)"0 _' > |domain error > | trace '([:<([: (([ (,^:(0:`(<'`:'))) 6:) ) [ , [: < [ ('0' ; ]) ]) > f."0 _)"0 _' > > Linda > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Jose Mario > Quintana > Sent: Wednesday, April 17, 2013 6:04 PM > To: [email protected] > Subject: Re: [Jprogramming] Table of Verbs > > all=:([:<([: (([ (,^:A) 6:) ) g) f."0 _)"0 _ > > On Wed, Apr 17, 2013 at 3:58 AM, Linda Alvord <[email protected]>wrote: > >> I'm trying to write this in simple J. >> >> T =: 2 2 $ +/`|:`|.`(-/ .*) >> g=:[ , [: < [ ('0';]) ] >> A=:0:`(<'`:') >> all=:([:<([:(,^:A)&6 g) f."0 _)"0 _ >> T all i.2 2 >> ----T---┐ >> │2 4│0 2│ >> │ │1 3│ >> +---+---+ >> │2 3│_2 │ >> │0 1│ │ >> L---+---- >> NB. u&n y is defined as y u n >> >> Can you write 'all' without using & in the function? >> >> Linda >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Jose >> Mario Quintana >> Sent: Tuesday, April 16, 2013 5:42 PM >> To: [email protected] >> Subject: Re: [Jprogramming] Table of Verbs >> >> I am referring to the verbs produced by ( u=. 2 2 $ +/ ; |: ; |. ; -/ >> . * ), ( w=. tf T ) and ( v=. T(4 :'<y`:0 x'"_ 0&) ). Although (v) >> and (w) are equivalent in the sense that they should produce the same >> results when given the same argument they are not the same in the >> following sense: ( tf T ) resolves into a verb defined exactly as (u), >> namely ( 2 2 $ +/ ; |: ; >> |. ; -/ . * ), whereas ( T(4 :'<y`:0 x'"_ 0&) ) resolves into an >> |equivalent >> verb with a different definition, namely ( 4 : '<y`:0 x'"_ 0&(2 >> 2$(<(<,'/'),<,<,'+'),(<'|:'),(<'|.'),<(<,'.'),<(<(<,'/'),<,<,'-'),<,'*') ). >> >> Moreover, since the verbs (u) and (w) are, in the end, defined exactly >> in the same manner, their atomic representations are also the same, >> >> ar=. 5!:1@< >> >> (ar'u') -: (ar'w') >> 1 >> In contrast, the verb (v) has a different atomic representation, >> >> (ar'u') -: (ar'v') >> 0 >> That was the intended significance of, >> >> (tf T) `'' -: u f.`'' NB. (tf T) is (2 2 $ +/ ; |: ; |. ; -/ . *) >> 1 >> in my original post. >> >> I hope this helps. >> >> On Tue, Apr 16, 2013 at 9:48 AM, Raul Miller <[email protected]> >> wrote: >> >> > Now I'm thinking you want a nice display using the built-in display >> > mechanisms for the result (to be distinguished from the code which >> > generates that result). In other words (except you would not do it >> > this way), something like: >> > >> > (3 :'(($y)$(4 :''(x`:6;y`:6)`''''''''''/,y)`:6)`'''''T)`:6 >> > >> > I could make that prettier, of course, but single line execution is >> > nice enough for discussion purposes. >> > >> > (Here, also, the shape has been factored out of the computation, and >> > is applied as a final step. But I am currently thinking that that's >> > a means to the end, rather than the end itself.) >> > >> > >> > On Tue, Apr 16, 2013 at 9:00 AM, Jose Mario Quintana >> > <[email protected]> wrote: >> > > "Would you consider Tfixed`:0 as being U?" >> > > >> > > No. Maybe the following can clarify what I tried to convey: >> > > >> > > u=. 2 2 $ +/ ; |: ; |. ; -/ . * >> > > v=. T(4 :'<y`:0 x'"_ 0&) >> > > w=. tf T >> > > >> > > u >> > > 2 2 $ +/ ; |: ; |. ; -/ .* >> > > >> > > v >> > > 4 : '<y`:0 x'"_ 0&(2 >> > > 2$(<(<,'/'),<,<,'+'),(<'|:'),(<'|.'),<(<,'.'),<(<(<,'/'),<,<,'-'), >> > > <, >> > > '*') >> > > >> > > w >> > > 2 2 $ +/ ; |: ; |. ; -/ .* >> > > >> > > >> > > >> > > >> > > On Tue, Apr 16, 2013 at 12:14 AM, Raul Miller >> > > <[email protected]> >> > wrote: >> > > >> > >> On Mon, Apr 15, 2013 at 8:28 PM, Jose Mario Quintana >> > >> <[email protected]> wrote: >> > >> > So far no solution is transforming T into U and perhaps >> > >> > emulating U is >> > >> what >> > >> > was meant, as in >> > >> > Raul's solution T(4 :'<y`:0 x'"_ 0&). >> > >> >> > >> I don't understand what you mean here. >> > >> >> > >> How was my solution "not U"? >> > >> >> > >> What is the difference between being U and emulating U? >> > >> >> > >> I think the distinction you are drawing here has to do with >> > >> replicating some functionality in each cell of the table of >> > >> verbs, but if that's the case I don't know why it's important. >> > >> Those approaches take more code to implement and also result in a >> > >> table with different cells. >> > >> >> > >> Put differently, `:0 was the probably the right approach - the >> > >> problem was that the verbs were not conformable. Fixing the >> > >> "problem" means changing the verbs or changing the environment in >> which >> they operate. >> > >> If you're going to change the verbs, I'd change them from the >> > >> start, or I'd use something like: >> > >> >> > >> T =: 2 2 $ +/`|:`|.`(-/ .*) >> > >> Tfixed=: 3 :'{.''''`(<@(y`:0))'"0 T >> > >> >> > >> Tfixed`:0 i. 2 2 >> > >> +---+---+ >> > >> |2 4|0 2| >> > >> | |1 3| >> > >> +---+---+ >> > >> |2 3|_2 | >> > >> |0 1| | >> > >> +---+---+ >> > >> >> > >> So... >> > >> >> > >> Would you consider Tfixed`:0 as being U? >> > >> >> > >> Thanks, >> > >> >> > >> -- >> > >> 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 >> > -------------------------------------------------------------------- >> > -- For information about J forums see >> > http://www.jsoftware.com/forums.htm >> > >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
