NB. Exploring Y

   Y =: (&({::))(@:])

   type<'Y'
+------+
|adverb|
+------+

   select=: (<2 3) Y   NB.

   select
(<2 3)&({::)@:]

   type<'select'
+----+
|verb|
+----+

    [DATA=: [&.>10 + i.4 7
+--+--+--+--+--+--+--+
|10|11|12|13|14|15|16|
+--+--+--+--+--+--+--+
|17|18|19|20|21|22|23|
+--+--+--+--+--+--+--+
|24|25|26|27|28|29|30|
+--+--+--+--+--+--+--+
|31|32|33|34|35|36|37|
+--+--+--+--+--+--+--+

   select DATA
27

   4 Y Alpha_j_
E

   NB. use Y in a sentence

   NB. written with Y
   f=: 2503 $ (0 #~  2 Y) ,~ 1 Y # 0 Y

   NB. similar sentence without Y
   g=: (2503 $ (0 #~  2&{::) ,~ 1&{:: # 0&{::) :[:


   f
2503 $ (0 #~ 2&({::)@:]) ,~ 1&({::)@:] # 0&({::)@:]
   g
(2503 $ (0 #~ 2&({::)) ,~ 1&({::) # 0&({::)) :[:


I'm convinced,  2503 $ (0 #~  2 Y) ,~ 1 Y # 0 Y
is easier to read, to write, and is generalized to dyadic use.
(A f B) -: (f B) versus (A g B) causes domain error.

On 12/14/2015 07:00 AM, [email protected] wrote:
Date: Mon, 14 Dec 2015 22:45:09 +1100
From: "Ryan Eckbo"<[email protected]>
To: "Pascal Jasmin"<[email protected]>
Subject: Re: [Jprogramming] advent 14
Message-ID:<[email protected]>

I don't understand what Y is, could you explain that?

On 14 Dec 2015, at 17:10, 'Pascal Jasmin' via Programming wrote:

>in =. ". leaf (3 8 _2 { ;:)"1 a =. > cutLF wdclippaste ''
>Y =: (&({::))(@:])
> sentence using Y

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to