Jürgen,
Actually '&' is a dyadic operator:
x u&v y <-> (v x) u v y
It's also the currying operator when applied to a function and data (keep in mind there is no strand notation in J):
u&y x <-> x u y <-> x&u y
The error is because & is being fed two numbers, when it can only digest one non-function argument at most.
Makes J look excessively complicated doesn't it :)
One does tend to get used to and appreciate it though. The choice of primitives (and, surprisingly enough, their very mnemonic ASCII symbols) was particularly well done. Logical 'and' is written '*.' and works like APL's dyadically. Monadically, it yields a pair of a number's magnitude and complex angle (in ]-pi,pi]), and this for each scalar of an array, thus adding a trailing dimension to it. A cool usage example is sorting a complex vector by angle, then length (useful for calculating a convex hull among other things):
/:~ &.: (|. @ *.) v
/:~ is sort, |. is reverse, *. is length/angle, @ is function composition, and &.: is an operator 'under' which applies the right function, then the left, then undoes the right one (applies its inverse, if applicable).
I do find such operations on complex data easier with primitives like this than having to use a dyadic circular function (whose left arg I always have to look up). I guess both languages have their quirks :) Cheers, and keep up the good work Jürgen; I second Peter's praise!
Louis
Hi Louis,
I am not at all a J programmer, but I remember that in old APL the
'and' was purely boolean (giving
a domain error as well if the arguments were not 0 or 1), but the
ISO standard for extended APL then
allowed non-boolean arguments as well (and the result is then the
least common multiple (aka. LCM)
of the arguments).
I suppose that J is still behaving like the old APL for dyadic
&. No idea, though what monadic & does in J, it seems
to have a meaning there? Or was it the !!! that cause the error?
One more reason to use APL.
/// Jürgen
On 04/27/2017 07:49 PM, Louis de
Forcrand wrote:
Jürgen,
At first I thought I had been doing it wrong all these years,
and that now I finally had seen the light, but in J:
1, 2, 3 & 4!!!
|domain
error
|
1,2, 3&4!!!
1, 2, 3, & 4!!!
1
, 2 , 3 ,&4 ! ! !
What are we going to do???
Louis
Hi,
the Oxford Comma is definitely broken because 'and' is
dyadic:
1, 2,
3, ∧ 4
VALENCE ERROR
1,2,3,∧4
^
1, 2, 3 ∧ 4
1 2 12
/// Jürgen
http://www.theonion.com/americanvoices/oxford-comma-wins-court-case-workers-55578
On Sat, 22 Apr 2017 16:25:52 +0200
Juergen Sauermann <address@hidden> wrote:
Hi,
this sentence is the verbatim copy of the phrase proposed in https://www.gnu.org/licenses/gpl.txt
(chapter 17) and I do not feel like criticising the GNU project for their spelling.
/// Jürgen
On 04/22/2017 12:28 AM, address@hidden wrote:
Thanks you guys doing this )help is really appreciated - maybe I can make a contribution too
line 13 but WITHOUT ANY WARRANTY; without even the implied warranty of ; -> , for oxford comma?
references :
https://www.grammarly.com/blog/what-is-the-oxford-comma-and-why-do-people-care-so-much-about-it/
http://www.necn.com/news/new-england/Missing-Comma-Could-Cost-Maine-Company-Millions-416458593.html
On Fri, 21 Apr 2017 23:01:01 +0200
Alexey Veretennikov <address@hidden> wrote:
Hi,
Sure here it is. Don't expect anything big in it - it is just a couple
of lines of text.
|