@Adám i find it a bit weird that functions return domain error when the result is too big to compute
because mathematically speaking, the domain is the interval on which the function is defined. Using the most basic definition of a factorial, it's defined on all natural numbers.
!1000000
DOMAIN ERROR
!1000000
∧
wouldn't it make more sense to raise something like a LIMIT ERROR here?
is there a workaround that allows me to determine whether the input to a function is just too high or it's actually outside of the domain (like ⍵=0 for ÷⍵)
@MasterQuiz Its not a natural go-to as an alternative to ⎕VFI or ⍎, I think a lot people forget about it for that use case. I know I do. (In fact I just found a bug in it, so I wonder how many people really put it through its paces.)
But it really is powerful solution to all the junk that something like excel might throw into a csv file.
The thousands variant will not work on a string without a decimal. So 3,000.25 will convert, but 3000 will not.
3,000 will not
When converting a column to numeric
In 18.0
I've got a lengthy legacy function for converting a char mat into a numeric vector. I think ⎕CSV can do it trivially, handling all the many things one needs to test for... but I just hit that bug.
Hi, can anybody help me understand how ⌿ works in dyalog? I understand that the rank is always reduced by one, but what I don't understand is how. I am used to how J does it with insert, since that is literally just "inserting" the function between the items of the array. Is there some general expression that ⌿ can be translated to?
The problem for me is that I don't understand how the rank always is reduced by 1, and the rest of the shape stays the same. Say I have a matrix M←2 3 4⍴⍳24 and i ⍪⌿M, in J, this would give me a 6 by 4 matrix, which makes sense as that is what i get when i put a ⍪ in between the two major cells. But in apl it gives me a 3 by 4 matrix with each element being a vector of length 2.
Therefore I would be happy if anybody knows a way to write this same result in a general way, without using ⌿ directly :)
Ah, well ⌿ is a right to left reduce, i.e successively applying a function between elements of an array. The rank is reduced by nature of the operation
That makes much more sense, thanks a lot. :) I'm working on my own apl interpreter just for the fun of it, and it is difficult to implement stuff that I don't understand
@dzaima
┌─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┐
│1 f 6 f 11 f 16 │2 f 7 f 12 f 17 │3 f 8 f 13 f 18 │4 f 9 f 14 f 19 │5 f 10 f 15 f 20 │
├─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│21 f 26 f 31 f 36│22 f 27 f 32 f 37│23 f 28 f 33 f 38│24 f 29 f 34 f 39│25 f 30 f 35 f 40│
├─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤
│41 f 46 f 51 f 56│42 f 47 f 52 f 57│43 f 48 f 53 f 58│44 f 49 f 54 f 59│45 f 50 f 55 f 60│
the hard part of ⍤ is making sense of the right operand format and understanding what it even does. The actual implementation can actually be pretty simple (if you ignore the mess of conditionals handling the various modes of the right operand)