Dan, How about the the forks in the function to delete blanks which Erling
provided recently:
f=:[: ((' ' = {.) }. ]) [: ((_1 * ' ' = {:) }. ]) ([: (] +. $ {. 1 , }:)
' ' ~: ]) # ]
5!:4 <'f'
-- [:
│ -- ' '
│ -----+- =
│ │ L- {.
+----+- }.
│ L- ]
│
│ -- [:
--+ │ -- _1
│ │ +- *
│ │ ------+ -- ' '
│ │ │ L----+- =
│ +----+ L- {:
│ │ +- }.
│ │ L- ]
│ │ -- [:
L----+ │ -- ]
│ │ +- +.
│ +----+ -- $
│ │ │ +- {.
│ ------+ L-----+ -- 1
│ │ │ L----+- ,
│ │ │ L- }:
│ │ │ -- ' '
L----+ L----+- ~:
│ L- ]
+- #
L- ]
Also Kip;s solution:
5!:4 <'g'
-- 2
+- }.
│ -- [:
│ │ -- ~ ----- #
│ │ │ -- ' '
│ │ │ ------+- ~:
--+ +----+ │ L- {:
│ │ │ │
│ │ │ +- ~ --- ,
│ │ L-------+
│ │ │ -- [:
L----+ │ +- -.
│ │ │ -- ' '
│ L-----+ │ -- -:
│ │ +- " --+- 1
│ L-----+
│ │ -- }:
│ L------+- ,.
│ L- }.
│ -- 'z '
L----+- ,
L- ]
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Devon
McCormick
Sent: Wednesday, July 16, 2014 5:36 PM
To: J-programming forum
Subject: Re: [Jprogramming] trains
How about "split":
{. ,&< }.
?
On Wed, Jul 16, 2014 at 5:12 PM, Alex Giannakopoulos <
[email protected]> wrote:
> I suppose the most useful, from a beginner's point of view, is the cap
> fork, e.g.
> [: *: sin
> which allows composition, and is equivalent to
> *: @ sin
> Some people prefer this former notation as clearer than the latter.
>
> So,
> sin =: 1&o.
> cos =: 2&o.
> (([: *: sin) + [: *: cos) 9876543210
> 1
>
> Basically, a handy notation for anywhere that a dyadic operator acts on
two
> others (if these others are monadic then the fork is monadic, if dyadic
> then fork is dyadic)
>
> Also check this
> 4 ([+[*]) 5 NB. two forks ([ + ([*]))
> 24
>
>
>
>
>
> On 16 July 2014 21:26, 'Dan Baronet' via Programming <
> [email protected]> wrote:
>
> > I am looking for good examples of use of trains.
> > Apart from the classic +/ % #, I can't think of many more.
> > Anyone with some examples? They can be of any length.
> > /Dan
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm