[Jprogramming] Binary representation without #: or #.
Björn Helgason
gosinn at gmail.com
Tue Jan 3 02:50:40 HKT 2012
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 <lindaalvord at 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-bounces at jsoftware.com [mailto:
> programming-bounces at 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 <lindaalvord at 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-bounces at jsoftware.com
> > [mailto:programming-bounces at 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
>
More information about the Programming
mailing list