Thanks Björn, I finally caught on to what was happening. It leads to some interesting thoughts.(an extension of barbeque from brAai )
why=: 13 :'x+ 10*y' why [ + 10 * ] why /|.1 2 3 4 5 12345 why /|.-1 2 3 4 5 _12345 why /|. _1 _2 _3 _4 _5 _12345 10#. _1 _2 _3 _4 _5 _12345 Change to base 2: why2=: 13 :'x+ 2*y' why2 [ + 2 * ] why2 /|.1 0 1 0 1 0 1 85 why2 /|._1 0 _1 0 _1 0 _1 _85 Or change to base 3: why3=: 13 :'x+ 3*y' why3 [ + 3 * ] why3 /|.1 0 2 1 34 why3 /|.-1 0 2 1 _34 why3 /|._1 0 _2 _1 _34 3#.1 0 2 1 34 3#._1 0 _2 _1 _34 I keep routing for negative numbers in different bases. Linda -----Original Message----- From: programming-boun...@jsoftware.com [mailto:programming-boun...@jsoftware.com] On Behalf Of Björn Helgason Sent: Monday, January 02, 2012 1:51 PM To: Programming forum Subject: Re: [Jprogramming] Binary representation without #: or #. why=: 4 : 0 smoutput 'x' smoutput x smoutput 'y' smoutput y x + 10*y ) why /|. 1 2 3 4 5 x 2 y 1 x 3 y 12 x 4 y 123 x 5 y 1234 12345 2012/1/2 Linda Alvord <lindaalv...@verizon.net> > I think you missed the problem. The definition why expects both a left > and a right argument. The original post shows no definition for x . So > erase any definition of x that might be floating around. > > why=: 13 :'x + 10*y'/|. 1 2 3 4 5 > erase names 'x' > 1 > why > 12345 > > The result has been produced without a value for x : > > x > |value error: x > > There is only one noun that the verb is supplied with in a dyadic > definition. How can it have a result? > > Linda > > -----Original Message----- > From: programming-boun...@jsoftware.com [mailto: > programming-boun...@jsoftware.com] On Behalf Of Raul Miller > Sent: Monday, January 02, 2012 11:28 AM > To: Programming forum > Subject: Re: [Jprogramming] Binary representation without #: or #. > > Every explicit verb has an implicit first line: > y=. right argument. > > Every dyadic explicit verb has an implicit second line: > x=. left argument > > Here, right argument and left argument are meant to represent the > nouns which the verb is supposed to deal with. > > The explicitly provided lines would follow the above implicit lines. > > -- > Raul > > On Mon, Jan 2, 2012 at 11:18 AM, Linda Alvord <lindaalv...@verizon.net> > wrote: > > Now I have a new problem: > > > > why=: 13 :'x + 10*y'/|. 1 2 3 4 5 > > erase names 'x' > > 1 > > why > > 12345 > > x > > |value error: x > > > > What is x in why ? > > > > -----Original Message----- > > From: programming-boun...@jsoftware.com > > [mailto:programming-boun...@jsoftware.com] On Behalf Of Aai > > Sent: Monday, January 02, 2012 5:42 AM > > To: Programming forum > > Subject: Re: [Jprogramming] Binary representation without #: or #. > > > > > > > > On 02-01-12 11:21, Linda Alvord wrote: > >> This was a while ago, but how about a simple J version: > >> > >> brila=: 13 :'([:(++:)/|.)"1 y' > >> brila > >> ([: (+ +:)/ |.)"1 > >> n=:5 3$ 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 > >> n > >> 0 0 0 > >> 0 0 1 > >> 0 1 0 > >> 0 1 1 > >> 1 0 0 > >> brila n > >> 0 1 2 3 4 > >> > >> I'm still puzzled by how it works: > > #. 1 0 1 0 1 0 1 > > 85 > > > > 13 :'x + 2*y'/ |. 1 0 1 0 1 0 1 > > 85 > > > > or > > > > 13 :'x + +: y'/ |. 1 0 1 0 1 0 1 > > 85 > > > > > > Simple J(?) > > > > 13 :'x + +: y' > > [ + [: +: ] > > > > or concise: > > > > (++:) > > > > Base 10 example: > > > > 13 :'x + 10*y'/ |. 1 2 3 4 5 > > 12345 > > > > (+10&*)/ |. 1 2 3 4 5 > > 12345 > > > > > > -- > > Met vriendelijke groet, > > @@i = Arie Groeneveld > > > > ---------------------------------------------------------------------- > > 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