Now define a function or verb
f=:
then you can study it with
5!:2 <'f'
5!:4 <'f'
5!:6 <'f'
Also you can save it and not need to type (~.,.#/.~) again
b=:3 4 2 3 5 5 2 2 3 4 5
f b
3 3
4 2
2 3
5 3
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Friday, December 09, 2011 9:24 AM
To: Programming forum
Subject: Re: [Jprogramming] FW: A simple function
Personally, I prefer:
b=:3 4 2 3 5 5 2 2 3 4 5
(~.,.#/.~) b
3 3
4 2
2 3
5 3
That said, here's an alternative implementation of your expression:
(({.,#)@#"_ 1~ =) b
3 3
4 2
2 3
5 3
Or, if you prefer:
(({.,#)@#"_ 1~ (=/~ ~.)) b
3 3
4 2
2 3
5 3
In other words, (@#)("_ 1) is equivalent to dyadic /. and monadic =
provides the left argument for the monadic case and (] =/~ ~.@]) is
equivalent to monadic =
FYI,
--
Raul
On Fri, Dec 9, 2011 at 3:16 AM, Linda Alvord <[email protected]> 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: [email protected]
> [mailto:[email protected]] 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: [email protected]
> [mailto:[email protected]] 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<[email protected]> 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