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