« first day (1346 days earlier)      last day (1316 days later) » 

3:27 AM
Is it possible to specify the empty value for expand?
 
3:43 AM
What I'm doing now is padding the compressed result of a boolean with the default values, and doing and up down grade indices on the boolean to sort
This is a bit convoluted
 
4:33 AM
@nathanrogers you mean, replicate, or reshape?
 
4:49 AM
@nathanrogers Like ⋄ 1 1 0 1 1 0 1 0 1('X'{⍺⍺@(⍸~⍺)⊢⍺\⍵})'abcdef' ?
 
@Adám abXcdXeXf
 
5:12 AM
Yes
I'm doing That with upgrade of downgrade of the boolean vector while appending the default value
To omega
Is this considered correct? Maybe expand should take an inner operand for a default value?
Bool('x'\)vec
 
@nathanrogers Can you show your code?
 
I'm on mobile
I will later
 
@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. .
Also, what if you want a non-constant fill?
⋄ 1 1 0 1 1 0 1 0 1('ABC'{⍺⍺@(⍸~⍺)⊢⍺\⍵})'abcdef'
 
@Adám abAcdBeCf
 
Then specify a fill vec that matches the number of 0 values
 
5:26 AM
OK, but that also implies that you have to enclose any non-scalar fill value (as indeed you have to in my above solution).
Furthermore, this only works for a Boolean expansion vector. How about ⋄ 1 1 ¯1 1 1 ¯2 1 ¯3 1\'abcdef' ?
 
@Adám ab cd e f
 
Either a scalar expanded to fill or a vector of equal length to the expanded slots
Same as before
 
So this would need what, a 3 or a 6 element fill?
 
3 in the case of the boolean vector
This is not a bit vector
So 6 in this case yes
It seems like type checking is not out of the question
 
What do you mean?
 
5:31 AM
Check whether alpha is a bit vector or not
And branch thusly
 
I don't understand, what would be different in the two cases?
 
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
Or scalar in both cases
Cases
 
Well, that isn't two branches, since you can mix zeros and negative values.
 
Right but its either a bit vector or it isn't
 
Sure, but I still don't understand why a bit vector needs special treatment.
 
5:34 AM
Can you mix 0 in with negative numbers?
I need an example
 
For sure, and positive numbers too. \ just requires an integer scalar/vector as left argument.
@nathanrogers ⋄ 3 1 0 1 1 ¯2 1 ¯3 1\'abcdef'
 
@Adám aaab cd e f
 
Right
 
But the spec could be simple: Left operand has to be conformant with the number of fills inserted.
 
So count of 0 + the sum of negatives
Would be the length of inner operand default
Or a scalar
Zeroes
Hard to type on mobile
 
5:38 AM
@nathanrogers Like ⋄ 3 1 0 1 1 ¯2 1 ¯3 1('ABCDEF'{⍺⍺@(⍸(1⌈|⍺)/0≥⍺)⊢⍺\⍵})'abcdef'
 
@Adám aaabAcdBCeDEFf
 
That's ugly to me compared to x('A'\)y
 
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…
 
5:58 AM
expand←{(⍵,(-/≢¨⍺⍵)/⊂⍬)[⍋⍒⍺]}
this is what I'm doing right now. you could very well index your default value with ⍸~⍺ to obtain the correct default values
expand←{(⍵,defaults[⍸~⍺])[⍋⍒⍺]}
The specific use case is providing default values where 0=X.⎕NC name
I have a list of names and I compress the list to evaluate X⍎¨names
but I can't use each name if it doesn't exist, so I need to provide a default value for each term based on its data structure
how do I do an eval @Adám?
 
@nathanrogers Not ?
 
I mean in chat
 
@nathanrogers Just begin a code block with ⋄
 
⋄{names←'ABCD' ⋄ defs←8×⍳4 ⋄ {⍵{(⍵,defs[⍸~⍺])[⍋⍒⍺]}ns⍎¨⍵/names}∊0≠ns.⎕NC¨names}(ns←⎕NS'').(A B D)←⍳3
 
@nathanrogers Illegal code
 
6:09 AM
haha
it doesn't like it
 
@nathanrogers The bot is limited like Try APL.
 
but you can see the inner function there {(⍵,defs[⍸~⍺])[⍋⍒⍺]}
 
@nathanrogers You can create a namespace of default values, and the replace the non-default values: 'defaults'⎕NS X
 
fair enough
is there some reason why this form of expand is less good that @?
seems pretty direct IMO
probably that it isn't general enough to solve the negative case
 
6:37 AM
@nathanrogers Not really. And you can write defs[⍸~⍺] as defs/⍨~⍺
@nathanrogers Sure, but if it works for your needs, go for it.
@nathanrogers Did you understand the ⎕NS method for default values in a parameter namespace?
 
not especially, I hadn't looked at the docs yet
 
@nathanrogers Here:
      (⍎'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}
 
 
7 hours later…
1:45 PM
{(9 11○⊂)¨(*⌾⊃⍵)×⌾/¨⍵⊂⍨(≢⍵)⍴⍳2} @Razetime here's a dfn for that rotation, just need to format it correctly
I think it works, in theory
 
2:30 PM
@rak1507 um
which one exactly?
don't remember
 
4
Q: Rotate Cartesian coordinates.

david4devWrite 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...

 
Is there any way to recover work from a ⎕OFF? Someone just lost a lot of code...
 
@JamesHeslip I'm afraid not. Have to hope the code will be better the 2nd time round, it often is, at least if you slept the night before...
 
2:50 PM
@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.
 
@rak1507 oh, for imaginary coordinates
cool
Made this one for palindrome distance
Anything I can imporve here?
9
Q: Palindrome distance

Galen IvanovFind 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...

 
3:10 PM
@JamesHeslip Consider autosaving.
 
⋄ 2*1000
How does the bot work?
 
⋄2*1000
 
@EliasMårtenson Use backticks around your code. (Also, it doesn't pick up edits.)
 
i think the bot isn't active now..?
 
Oh, indeed, it seems to be MIA
@Moonchild Any idea where the bot went?
 
3:13 PM
but yeah it parses anything in backticks , that starts with
 
(I should have opted for running it on a Dyalog server…)
@Razetime It should also work on code blocks that begin with now.
 
⋄ 2*1000
Anyway, I wanted to know if Dyalog supports bignums.
Anyone know the answer?
 
@EliasMårtenson ⎕FR and ⎕PP are there
and there's a bigint arithmetic lib
 
I see.
I was thinking about implementing full bignum support in KAP, but I think I won't. :-)
 
3:30 PM
@EliasMårtenson (fwiw dzaima/APL has bigints)
 
@EliasMårtenson Roger is working on bigrat(ional number ― a superset of bigint) support. You can follow his progress on the forums.
NARS2000 has too (and bigrats), and so does J.
 
Thanks.
 
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?
 
@Razetime use a train instead of a temporary x
 
3:34 PM
@Razetime With ^^: Try it online!
 
train
 
i have 22
 
23 here
 
@dzaima 20
 
OK, I give up. I have dishes to wash… and I'm not supposed to be working today.
 
3:40 PM
lol cya
 
@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 -∘)
 
a way around it...
oka, down to 22
@dzaima the |, however isn't too obvious to me
Ok, now at 21
 
@Razetime a prerequisite is having the train form for the starting part (i.e. no dfns)
 
hmm i got to 21 with dfn
This is the same thing I did, but with a train
but it's 22
 
@Razetime think about it :) (aka you're most definitely on the right track)
 
3:54 PM
trust me, I'm really trying (:
 
as a hint, my solution is a subsequence of yours
 
4:28 PM
nice
 
4:49 PM
How good is RAD?
 
5:27 PM
@Razetime nice idea, but unfortunately somewhat unfinished
 
 
2 hours later…
7:34 PM
wonder how terrible of an idea writing an apl derivative in haskell is
 
7:49 PM
@rak1507 I did early drafts of I in Haskell. Not a bad idea.
 
wow, cool
 
8:01 PM
 
@dzaima Your JIT compiler seems to be working in reverse.
 
@Marshall my to-java compiler isn't even touched
 
I'm seeing the same effect with that code.
 
and i can't really blame javas JIT too due to that being a pretty convincing linear increase in runtime
 
@dzaima I assume it's really some kind of resource leak.
 
8:06 PM
@Marshall there is indeed RAM usage leaking (linearly too)
now to find where
 
Memory usage doesn't increase when you wrap it in braces, so maybe the definitions (folded constants?) are getting leaked?
Could be something to do with REPL scoping.
 
40k strings leaked per execution ¯\_(ツ)_/¯
ah yes
https://dzaima.github.io/paste/#07ZK9TsMwEMf3PoXVqVEl0gCVaCc@VoSEhNht50it@iPYCRWdOiFADDwAA2LiASqxgVRG3iJPgsuSa1@BkzL8/E/Ozp1/jLHQ3D0395@9bNA/TCL8vKzem8XbqQ3ddOIMpPmcK8PTQlXp8flZGrxM5Y64tt0OY6zXPD2ulrGsv1p@fzQPrwnLBs3iazducXKhDLDQGQ5H6yem2d5wlGXZ/s7BujYJUnUuuVdcaAjjGPUGCattHSCPizBm3Ht@G1FfjWMeoIpsectywn0kFBS6XYD3tZ1aN7N/322WSZdDmwh0gDCIJWK0gygQC8ToeOEQK8Q5YosYNSZmiMuW0a/dqM2GvNOoITQThTlDi1Ci7io3BavmsDE@WxvwSm6NzwPP4xuUaBAbdUYFwys5gVx4LqdQha1byUFq7gFNolzfJOrImVLhhkgBUoAUIAVIAVKAFCAFSAFSgBQgBUgBUoAUIAVIgX@qwFHFCu0E1yxIV8Iv#BQN
 
I'm a bit surprised that the compiled BQN byte code includes lambdas from the surrounding language in the list of Objects.
the Javascript and dzaima/BQN Java versions use the same bytecode, what about those functions?
 
@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
 
8:24 PM
@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.
 
@Marshall I see, ok
 
yay
https://dzaima.github.io/paste/#0lZQ9jtQwFID7nMLaakYrJbbjxMlU/LQICQnR246ZsSZxgp1hxVZbIUAUHIACUXGAlbZjpaHkFjkJTqbIm6lI5e8957P9nq0ghMTw8RuJUIDoNISYnuJpWHtlojfCGSFr7TchtcJrdLAHr6sQiA2i0dMebetWihp51XZ61HxYZvj0e0Xw9ZN1gL/fj7@Gu58vrL9Kdm2jk@pWmEYkW9Mnz169TLxTiYrlO3s12qvh65fjfdCuj/d/HobPP9aIYIyHu0caFnn@2jQa@YhwgjlhY5bkOSlYXLJ0gU5zxrKQeSRpxnGJY5qTRXqOy2zSKWcZiSmni/SUcDbppCxyGhc0W6ZzWp52D0EZs2KZnudZetLzIhtbxxfpPMV80lnwWcxZ@b@vJTyODRLOiQ8B67ebMO11H9iKmdVOuEAgsa3nQDt3sHvb3tjpu3NNtZWeMxJsIBvACjBYQW4BS8Bge9kCNoArwBYwKEzeAO5mBkd7b84Lcm0NCgI9MZAJCHwHquvbvbbmVp@1zx4a7Yy6aJ/TogozIFNreeY1xjeiVztdSSfUXvf@
 
 
1 hour later…
9:56 PM
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
 
@voidhawk Raze but not in Dyalog. If you find anything good put it on that page though.
 
@Adám Interpreter ICE. (In rakudo, not dyalog.)
 
Oh, but you just want to merge the two leading axes so it's a bit simpler. The fast way would be a reshape, but I don't know anything elegant.
@voidhawk Now I remember. It's ,[0 1]. Adjust for ⎕IO to taste.
 
@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
 
@voidhawk Especially considering it's ,/ in J or ∾˝ in BQN (laminate's ,: or ).
 

« first day (1346 days earlier)      last day (1316 days later) »