g^:f as if in J is one of the cooler patterns of the language.
if. 1 = f(y) do. g(y) else. y end.
From: Nollaig MacKenzie <[email protected]>
To: [email protected]
Sent: Saturday, October 3, 2015 1:06 AM
Subject: Re: [Jprogramming] problem using ,:`]@.
fie is my preference, I think - I wouldn't have
thought of getting a no-op by doing an op 0 times :-)
fum looked perverse at first, but quickly became
intriguing. It would have other uses:
fum (2 3$'abcdef'),:2 3$'UVWXYZ'
On 2015.10.02 21:48:39, you,
the extraordinary Raul Miller, spake thus:
> It sounds like you are asking for this:
>
> fie=: ,:^:(2>#@$)
>
> but you might want to consider alternatives such as:
>
> foe=: , $~ _2{.1,$
>
> or
>
> fum=: ,.&.|:
>
> Good luck,
>
> --
> Raul
--
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm