bug-apl
[Top][All Lists]

## Re: [Bug-apl] IOTA

 From: Christian Robert Subject: Re: [Bug-apl] IOTA Date: Tue, 1 Mar 2016 21:50:55 -0500 User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

```thank you very much, I now understand how it work !

looks so easy for you ;-)  and so hard for me :-(

Xtian.

On 2016-03-01 21:43, Elias Mårtenson wrote:
```
```On 2 March 2016 at 10:28, Christian Robert <address@hidden

IOTA ← {∘.,/⍳¨⍵}

yes, it does the trick (you are really good btw)

I don't consider myself good. :-)

Anyway, it's quite simple. Let me break it down:

First of all, ¨⍳⍵ will simply create the individual iotas:

*      ⍳¨2 3 4*
┌→──────────────────────┐
│┌→──┐ ┌→────┐ ┌→──────┐│
││1 2│ │1 2 3│ │1 2 3 4││
│└───┘ └─────┘ └───────┘│
└∊──────────────────────┘

The ∘., function will take two lists, and apply the function , (concatenate) on
each permutation:

*      (⍳2) ∘., (⍳3)*
┌→────────────────┐
↓┌→──┐ ┌→──┐ ┌→──┐│
││1 1│ │1 2│ │1 3││
│└───┘ └───┘ └───┘│
│┌→──┐ ┌→──┐ ┌→──┐│
││2 1│ │2 2│ │2 3││
│└───┘ └───┘ └───┘│
└∊────────────────┘

You've probably seen the ∘.× function used to create a multiplication table in
a similar manner.

Finally, the / operator acts on a function and a list as if the function was
placed between every element in the list. Thus:

*      ∘., / (1 2) (1 2 3) (1 2 3 4)*

will be equivalent to:

*      (1 2) ∘., (1 2 3) ∘., (1 2 3 4)*

Regards,
Elias
```
```

```