APL Library v6.6


I wonder whether I have now strange things with a Snap!_v6 project using the APL library.

Did I misunderstood something ? Thank you.

I have another problem with signum :

I throw 3 cubic dices 4 times :

Then I count the 6 :

(is this correct ???)

I expected 1 when True and 0 when False...

It worked before :

Ah, thanks for reporting these things! I'll look into them right away.

Okay, three different results.

Transpose: I am unable to reproduce this problem:

Would you please edit the transpose block and see if it looks like this:


Catenate: This is the expected behavior. For vectors, there is no "vertical" or "horizontal." You can see the difference in behavior for matrices or higher dimensions:

To get the effect I'm guessing you want, you can turn a vector into a one-row matrix by putting it inside a LIST block.

Signum: This one is indeed a new bug in 6.6, the result of my attempt to speed up the computation. Turns out you can't put a recursive call inside a compiled MAP. :~( This will be fixed next maintenance release, but meanwhile, edit SIGNUM (and also FACTORIAL and other such monadic hyperblocks) and chose uncompile in the compiled MAP block's right-click menu.

Not at all.

I first charged the APL primitives on a Snap6.6 editor.
Then I opened my project (created with the Snap!_v6 APL primitive).
And I noticed that the transpose bloc of my project substitute the one of the new APL primitives.

This is the transpose bloc that I have :

If I reload a second time the APL library, I have the right transpose bloc.

Thank you.
It works.

I have another big problem.

The map block doesn't work anymore.

Because I absolutly need the map function to prepare an APL lìbrary keynote for a university workshop of linear algebra.

In the previous example, I wanted to generate a random matrix filled with numbers choosed randomly in {0,1} .

Why am I obliged to create first my random numbers list to reshape it like this ?

You used a shallow map.

Hi Nathalie,

if you use MAP before RESHAPE this should work:

alternatively you could implement deep map as @18001767679 suggests.

... example:

I just figured it out.
Thank you Jens !

So I created this function to generate a random matrix :

It works perfectly. I love Snap!. You can really do whatever you want with it !

yep, that's exactly what I was suggesting, great!

And thanks for the deep map function !

It doesn't work for me... I don't understand why.

I don't think so.

hmm... how strange. Here's my project:

let's see how it might be different.... Can you share yours?

I see, did you make sure the first input (named "fun") is a ring and not an "any, unevaluated" input?

This was exactly the problem (I can see the logic now...).
It works now, have a look :

And now, I have to understand how this function deep map works...

I think it's easier to understand if you pull out the base case:


I try to map a function which takes a list of lists as entry (a matrix).

Here is a function that creates a special matrix :

Then I map this function to list([1,n]) (n is an integer, here equals to 4) :

Then I would like to map my function trace which calculates the trace of each matrix contained in the whole result matrix that I called M :

So, I tried to do this :
Snap6_discovery_2 script pic(6)
It works :
Snap6_discovery_2 script pic(7)

How can I do that with a map bloc?
Thank you.