@nathanrogers Uh, Expand is a function, it can't take an operand. In principle, one would extend Scan to be Expand when the derived function is used dyadically expansionVector(fillElement\)mainArray but that begs the question of how to specify fills for all other filling functions, e.g. ↑.
Bit vector requires a default vector the number of false values, vectors containing negative numbers take a default operand length of the sum of negative numbers
Ugly or long? I find it rather elegant considering \'s odd definition. In any case, the non-Boolean case is rare, and the Boolean case is pretty simple: fill@(~exp⍨)exp\data in 18.0
@nathanrogers And again, how would we specify fill for / ↑ ⌺ ⍴ ⍤ ⊃ ? J uses a magic operator to specify fill…
(⍎'defaults'⎕NS⍬).(a b c d)←⍳4 ⋄ 1 ⎕JSON X
{"a":10,"c":30}
(⍎'X'⎕NS ⍬).(a c)←10 30 ⋄ 1 ⎕JSON X ⍝ user input
{"a":10,"c":30}
{'X'⎕NS⍵⊣'X'⎕NS defaults}⎕NS X ⋄ 1 ⎕JSON X
{"a":10,"b":2,"c":30,"d":4}
If you don't care about destroying defaults in the process, you can replace the last statement with:
'X'⎕NS⍎'defaults'⎕NS X ⋄ 1 ⎕JSON X
{"a":10,"b":2,"c":30,"d":4}
Write a program rotates some Cartesian coordinates through an angle about the origin (0.0,0.0). The angle and coordinates will be read from a single line of stdin in the following format:
angle x1,y1 x2,y2 x3,y3 ...
eg.
3.14159265358979 1.0,0.0 0.0,1.0 1.0,1.0 0.0,0.0
The results should b...
@MortenKromberg Figured as much, but thought it was worth asking. It's fine- it didn't happen to me at least. A colleague was following the tutorial outlined in the Interface Guide (page 61), and fell victim to the ⎕OFF quit function in the temperature converter app.
Find what is the distance for a given string to its closest palindrome of the same length.
For this task I decided to give the characters further away from the string's center more weight (think of it as contributing more torque), proportional to their distance to the center.
Let's define the pal...
I use Common Lisp most of the time, and having transparent bignums are useful. But I'm not entirely sure it's wirth the effort to implement it. Have you felt that it's ever been a life-saver in NARS?
@EliasMårtenson bigints aren't needed often, but when they are, there's pretty much no way around needing them. So it depends on for how much you want to use the lang for. Most of my usage has been for base conversion
@dzaima (1: move the | somewhere else (in Adám's latest solution); 2: there's a way around needing that -∘)
@dzaima two problems - variable overriding is stupid (i knew this very well), and •CTIME compiles the code as if it were to be executed in the global REPL scope and so needs to set vars
@TessellatingHeckler Those are the values of primitives provided by the runtime. You could also represent them as their own type, as long as whatever method you use to call functions knows what they are.
Only the bytecode itself is shared between implementations. In a portable format, the objects would be serialized as well, but there's nothing like that now.
yay https://dzaima.github.io/paste/#0lZQ9jtQwFID7nMLaakYrJbbjxMlU/LQICQnR246ZsSZxgp1hxVZbIUAUHIACUXGAlbZjpaHkFjkJTqbIm6lI5e8957P9nq0ghMTw8RuJUIDoNISYnuJpWHtlojfCGSFr7TchtcJrdLAHr6sQiA2i0dMebetWihp51XZ61HxYZvj0e0Xw9ZN1gL/fj7@Gu58vrL9Kdm2jk@pWmEYkW9Mnz169TLxTiYrlO3s12qvh65fjfdCuj/d/HobPP9aIYIyHu0caFnn@2jQa@YhwgjlhY5bkOSlYXLJ0gU5zxrKQeSRpxnGJY5qTRXqOy2zSKWcZiSmni/SUcDbppCxyGhc0W6ZzWp52D0EZs2KZnudZetLzIhtbxxfpPMV80lnwWcxZ@b@vJTyODRLOiQ8B67ebMO11H9iKmdVOuEAgsa3nQDt3sHvb3tjpu3NNtZWeMxJsIBvACjBYQW4BS8Bge9kCNoArwBYwKEzeAO5mBkd7b84Lcm0NCgI9MZAJCHwHquvbvbbmVp@1zx4a7Yy6aJ/TogozIFNreeY1xjeiVztdSSfUXvf@…
Is there a better way to concatenate along the leading axis than something like ⊃⍪/⊂⍤¯1 ? I think there's some fractional axis specification magic here for catenate/laminate/reduce, but I'm not finding anything
@Marshall Ah right, thanks. There's usually some bracket-axis specification thing when I want to work with axes somehow (insert a new one, combine existing etc.). But to be honest using the bracket notation makes me feel kind of... gross.
Though I have started using ,[0.5] when I want to laminate two vectors