Do these experiments help?

to =: -.&i.~,]

3 to 5

3 4 5

3 -.&i.~ 5

3 4

5 -.&i. 3

3 4

(i.5)-.(i.3)

3 4



On Sat, Jun 29, 2019 at 2:30 PM Thomas Bulka <thomas.bu...@posteo.de> wrote:

> Hello everyone,
>
> I stumbled across another understanding problem during my efforts to
> learn J. I do currently struggle with a sentence defined in the essay "A
> Composition on Composition":
>
> https://code.jsoftware.com/wiki/Fifty_Shades_of_J/Chapter_2
>
> In this essay the sentence "to" is defined like this:
>
> to =: -.&i.~,]
>
> It works as expected and generates a list of integers from x to y
> (dyadic use). I do unterstand (I think) the use of the &-conjunction in
> this sentence, but what I don't get is the i.~,]-part. My (obviously
> wrong) interpretation goes like this - (s[n] denotes my assumption on
> the different steps of evaluation when called with, say, 12 as the
> y-parameter):
>
> s1 =: i.~,]
> s2 =: i.~,12      NB. ] denotes the y-parameter
> s3 =: i.~12       NB. Now y is raveled
> s4 =: 12 i. 12   NB. By using ~ 12 is the x- and y-parameter of i
>
> The result of the final step would be zero (according to my
> understanding), but explicitly calling "s1 12" gives the result 0 12.
> Neither do I understand that result, nor do I understand, how this
> contributes to the to-sentence defined above. As you can see, I'm
> totally lost here and would very much appreciate any explanation on how
> to interpret that sentence correctly.
>
> Please excuse the lengthy description of my misunderstanding, but I
> tried to describe my train of thought to make as clear as possible,
> where my difficulties in understanding are.
>
> Thank you very much in advance!
>
> Kind regards,
>
> Thomas
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to