Here's the stuff I was preparing to send you:
d=:0 0.5 1 1.5
f=: 13 :'o.j.y'
f
[: o. j.
]a=:f d
0 0j1.5708 0j3.14159 0j4.71239
]g=:^a
1 6.12323e_17j1 _1j1.22465e_16 _1.83697e_16j_1
This has to be the correct answer! So, I compared the three versions:
h=: 13 :'^o.j.y'
h
[: ^ [: o. j.
h d
1 6.12323e_17j1 _1j1.22465e_16 _1.83697e_16j_1
5!:4 <'h'
-- [:
+- ^
--+ -- [:
L----+- o.
L- j.
This was as I expected. Since I copied that all from jijx, I got suspicious
when I pasted it into the message. It is a different type face. That seemed
odd.
i=: 13 :'^@[email protected]'
i
^@o.@j.
i d
1 0j1 _1 0j_1
5!:4 <'i'
-- ^
-- @ -+- o.
-- @ -+- j.
This seemed like the wrong answer. I never did like @ anyway. But, @:
should work.
j=: 13 :'^@:o.@:j.y'
j
^@:o.@:j.
j d
1 6.12323e_17j1 _1j1.22465e_16 _1.83697e_16j_1
5!:4 <'j'
-- ^
-- @: -+- o.
-- @: -+- j.
Again this is as I expected. I finally realized that:
1 0j1 _1 0j_1 -: 1 6.12323e_17j1 _1j1.22465e_16 _1.83697e_16j_1
1
I was going to post this when I read about your special code. It is hiding
were @ and @: are supposed to be alike. But I must admit that the third
element of the list:
1 0j1 _1 0j_1
is more comforting than:
_1j1.22465e_16
How about advertising that @ is always a hiding place for special code.
Actually I don't know where the rest of the special code is hiding.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Tuesday, December 06, 2011 4:09 AM
To: Programming forum
^@o.@j. 0 0.5 1 1.5
1 0j1 _1 0j_1
^@o.@j. 0.5 * i.5 4
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
^@o.@j. 1e9 + 0.5 * i.5 4
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
1 0j1 _1 0j_1
2011/12/6 Linda Alvord <[email protected]>
> Can you make a simple example that looks like this u@v@w ? Please use
> actual verbs so that it is a tight little nugget that might come about in
a
> fairly simple mathematical situation. Use it in a situation that does not
> require rank. Next, write it in explicit form without @
>
> Here's what I would like. Remember foo ?
>
> foo=: 13 :'an expression with x's and y's and three verbs like # , %: ,
> ? or * '
>
>
> Also:
>
> Let us use [: u v or u@:v as we like, and specify a rank when we
> need one.
>
> I think I could live with:
>
> Let us use [: u v unless rank is involved. Only use u@:v if rank is
> needed, thus @ vanishes from the planet.
>
>
> Linda
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Henry Rich
> Sent: Monday, December 05, 2011 10:08 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Turkey Roll - Challenge 2
>
> If you are OK with @: , then we agree. @ is hard for beginners.
>
>
> u@v is equivalent to u@:v"v or ([: u v)"v
>
> u@v@w is u@:v"v@:w"w or ([: ([: u v)"v w)"w
>
> Henry Rich
>
> On 12/5/2011 9:57 PM, Linda Alvord wrote:
> > Can you make a simple example that looks like this u@v@w . Is it
> possible
> > to write an explicit version that will create a tacit expression to do
> the
> > same thing?
> >
> > I don't have a problem with @: . My concern is only with @
> >
> > Linda
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Henry Rich
> > Sent: Monday, December 05, 2011 9:28 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Turkey Roll - Challenge 2
> >
> > I don't understand why u@v is anything other than 'right to left'. It
> > means do v, then do u. u@v@w means w, then v, then u.
> >
> > The complication of @ is not its ordering, it's its rank. In my classes
> > I teach @: as a primitive. We don't use [:, or @ .
> >
> > Henry Rich
> >
> > On 12/5/2011 9:15 PM, Linda Alvord wrote:
> >>
> >> Compare your expression for dice :
> >>
> >> faces=: {&' o'@((i.3 3)e.&":"1])&.>4 80 840 8620 86420 865320
> >> faces
> >> ------T-----T-----T-----T-----T-----┐
> >> │ │o │o │o o│o o│o o│
> >> │ o │ │ o │ │ o │o o│
> >> │ │ o│ o│o o│o o│o o│
> >> L-----+-----+-----+-----+-----+------
> >>
> >> With Kip Murray's version:
> >>
> >> one =: ' ',' o ',:' '
> >> two =: 'o ',' ',:' o'
> >> three =: 'o ',' o ',:' o'
> >> four =: 'o o',' ',:'o o'
> >> five =: 'o o',' o ',:'o o'
> >> six =: 'o o','o o',:'o o'
> >> ]dice =: one;two;three;four;five;six
> >> ----T---T---T---T---T---┐
> >> │ │o │o │o o│o o│o o│
> >> │ o │ │ o │ │ o │o o│
> >> │ │ o│ o│o o│o o│o o│
> >> L---+---+---+---+---+----
> >>
> >> Your dice are great looking! However that change has greatly increased
> the
> >> complexity of the code. Also, there is a condition of the challenge to
> >> exclude @ in each expression. This requirement encourages considering
> > the
> >> execution from the right toward the left. In your example 4 80 840
> 8620
> >> 86420 865320 could be puzzling to a beginner. Your other ideas are
> >> thoughtful ideas to incorporate in an actual design of a program. At
> this
> >> stage, I'm trying to raise issues that can be discussed and explored
> >> further.
> >>
> >> From your design so far, is it possible for you to capture the actual
> > values
> >> of the and display them following each toss ? It is this data that
> > will
> >> be useful as you finish the challenge.
> >>
> >> Linda
> >>
> >>
> >> -----Original Message-----
> >> From: [email protected]
> >> [mailto:[email protected]] On Behalf Of Raul Miller
> >> Sent: Monday, December 05, 2011 9:50 AM
> >> To: Programming forum
> >> Subject: Re: [Jprogramming] Turkey Roll - Challenge 2
> >>
> >> Personally, I have been baffled by a number of the choices and
> > requirements
> >> here. And, by this, I mean that I do not understand them.
> >>
> >> That said, here is my current interpretation of a mix of some of the
> >> statements expressed here, about what is being accomplished:
> >>
> >> faces=: {&' o'@((i.3 3)e.&":"1])&.>4 80 840 8620 86420 865320
> >> toss=: (] {~ (?@$ #)) ".bind 'faces'
> >>
> >> Example use, with ascii box drawing enabled:
> >>
> >> toss 2 10
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >> |o |o |o o|o |o |o |o |o o|o o|o o|
> >> | o | o | o | o | o | | | | o |o o|
> >> | o| o|o o| o| o| o| o|o o|o o|o o|
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >> |o |o o|o |o o|o o|o |o |o |o o|o |
> >> | o | o | | o | | | | | | |
> >> | o|o o| o|o o|o o| o| o| o|o o| o|
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >> toss 2 10
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >> |o |o |o o|o |o o|o |o o|o o|o o|o |
> >> | | | | o |o o| o | | o |o o| |
> >> | o| o|o o| o|o o| o|o o|o o|o o| o|
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >> |o o|o |o o|o o|o o|o o| |o o|o o|o o|
> >> | | | o | | | o | o | | | |
> >> |o o| o|o o|o o|o o|o o| |o o|o o|o o|
> >> +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
> >>
> >> Notes:
> >>
> >> 1. I spaced my pips out wider, horizontally, than the original. I
think
> >> this looks better.
> >> 2. toss has 'faces' as an implicit dependency
> >> 3. I can change the number of dice being tossed by changing the
argument
> > to
> >> toss
> >>
> >> In my opinion, this is not a very good design. In "real life" code, I
> >> would either replace (". bind 'faces') with (faces) or I would make it
> an
> >> argument to the function.
> >>
> >> I could probably compress a few characters out of the definition of
> faces,
> >> but it would become more mysterious if I did so.
> >>
> > ----------------------------------------------------------------------
> > 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