Cancel the magic!  These two are different. You really do need  /:~ (back to
bed time)
   
   f=: 13 :'b({. , #)/.b'
   f
(4 2$3 3 4 2 2 3 5 3)"_

   g=: 13 :'/:~b({. , #)/.b'
   g
(4 2$2 3 3 3 4 2 5 3)"_

   fdrs=: 13 :'/:~y({., #)/.y'
   fdrs
[: /:~ ({. , #)/.~

I can finally show the explicit version!

Linda

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
Sent: Friday, December 09, 2011 4:47 AM
To: 'Programming forum'
Subject: Re: [Jprogramming] FW: A simple function

Watch this little bit of magic:

    b=:3 4 2 3 5 5 2 2 3 4 5
    b({. , #)/.b
3 3
4 2
2 3
5 3
   f=: 13 :'b({. , #)/.b'
   f
(4 2$3 3 4 2 2 3 5 3)"_

   g=: 13 :'/:~b({. , #)/.b'
   g
(4 2$2 3 3 3 4 2 5 3)"_

  g b
2 3
3 3
4 2
5 3

Soooo.


b=:3 4 2 3 5 5 2 2 3 4 5

   fdrs=: 13 :/:~'y({. , #)/.y'
   fdrs
[: /:~ ({. , #) /.~

   fd b
3 3
4 2
2 3
5 3

Wow!  It turns out even more simple than I thought.  The Key really is the
Key!

Linda


   

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Ric Sherlock
Sent: Friday, December 09, 2011 3:36 AM
To: Programming forum
Subject: Re: [Jprogramming] FW: A simple function

The adverb "Key" ( /. ) is the key.
http://www.jsoftware.com/docs/help701/dictionary/d421.htm
The left argument specifies the way to group items in the right
argument. The verb to the left of key is applied to those groups.
   1 2 3 1 3 2 1 </. 'abcdefg'
+---+--+--+
|adg|bf|ce|
+---+--+--+
   1 2 3 1 3 2 1 </. 1 2 3 1 3 2 1
+-----+---+---+
|1 1 1|2 2|3 3|
+-----+---+---+
   </.~ 1 2 3 1 3 2 1
+-----+---+---+
|1 1 1|2 2|3 3|
+-----+---+---+
   ({. , #)/.~ 1 2 3 1 3 2 1
1 3
2 2
3 2

Soooo.


b=:3 4 2 3 5 5 2 2 3 4 5


   fd=: 13 :'y({. , #)/.y'
   fd
({. , #)/.~

   fd b
3 3
4 2
2 3
5 3

Wow!  It turns even more simple than I thought.  The Key really is the Key!

Linda


On Fri, Dec 9, 2011 at 9:16 PM, Linda Alvord <lindaalv...@verizon.net>
wrote:
> Kip,  Can you, or Ric, or anyone help with the jump from:
>
>    b=:3 4 2 3 5 5 2 2 3 4 5
>   ({.,#)b
> 3 11
>
> To:
>   ({.,#)/.~b
> 3 3
> 4 2
> 2 3
> 5 3
>
> My best guess doesn't work. Why not? What would?
>
>   b/:({.b),#b
> 3 4
>
> Linda
>
>
> -----Original Message-----
> From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
> Sent: Thursday, December 08, 2011 9:46 PM
> To: 'Programming forum'
> Subject: Re: [Jprogramming] FW: A simple function
>
> In the lull I got a chance to ponder this. I now like nothing.
>
> Linda
>
> -----Original Message-----
> From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Kip Murray
> Sent: Tuesday, November 29, 2011 4:22 PM
> To: Programming forum
> Subject: Re: [Jprogramming] FW: A simple function
>
> Here is my attempt to make [: lovable.  You love 0, don’t you?
>
>
>   g     When f is [: in the diagram at left
>  / \    the left branch disappears and you
> f   h   get the diagram below: “I do nothing”
> |   |   [: is like “I am nothing” 0 .
> y   y
>
>   g
>    \
>     h
>     |
>     y
>
>
>     g      Also here when f is [: the left
>    / \     branch disappears and you get
>   f   h    the diagram below:  “I do nothing”
>  / \ / \   [: is like “I am nothing” 0 .
> x  y x  y
>
>     g
>      \
>       h
>      / \
>      x  y
>
>
> Diagrams adapted from Dictionary Section II F. Trains
>
>> On Tue, Nov 29, 2011 at 2:29 PM, Tracy Harms<kalei...@gmail.com>  wrote:
> ...
>>> Also, I do see ways in which trains are more simple than modifier
phrases.
>>> I think this simplicity is significantly *reduced* by the incorporation
of
>>> Cap, whereas @ can be fruitfully associated with function composition as
>>> documented in uncounted texts.
>
> ----------------------------------------------------------------------
> 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

Reply via email to