« first day (2365 days earlier)      last day (296 days later) » 

0
Q: How can I get the last input expression in Dyalog APL?

RikedyPI know I can re-execute lines by putting my text cursor on a previously entered line and pressing Enter, but sometimes the output is long and I am wondering if there is a keyboard shortcut to recall previously executed expressions to the bottom of the session log.

 
11:17 AM
what is the correct way to load multiple definitions from a file into dyalog?
]load only takes the first one
 
12:17 PM
@RubenVerg 2⎕FIX'file://path/to/file' should just work.
 
 
1 hour later…
1:38 PM
thanks
okay so I have a tradfn that sets up an HTMLRenderer with code that spawns a WebSocket. Eventually the JS sends a ready message through the socket to dyalog. can I make it so the construct function only returns after ready is sent? (I tried :While ~_Ready :EndWhile and then setting _Ready when the message is received, it blocks the thread so doesn't work)
 
 
2 hours later…
3:34 PM
@Adám this doesn't work, it just goes domain error without specifying anything else
 
4:01 PM
How does one convert integers to strings (1 to '1')?
 
it's the glyph that looks like Encode and Jot overstruck, can't remember the name
 
or Format
I still can't keep and straight...
 
It's called thorn, I think
This wasn't working. Must have messed something up
Is there a way to see the type of some entity? I get 1=1 evaluated as false, and I think it is because one is a string and the other an integer, but now I'm not so sure.
 
Are you comparing ⍕1 to '1'?
 
(Sorry, @rabbitgrowth, I was obviously not trying to correct you. I think the glyph is called Thorn, and the operation is called Format!)
 
4:11 PM
this might be already known, but sometimes the interpreter randomly segfaults when closing an HTMLRenderer window. trying to repro it just seems to happen sometimes, randomly, though I do have aplcores if you need them (cc @Adám who seems to be the most active dyalog guy here)
 
@rabbitgrowth I was comparing 1 to '1', I think, and now was trying to remedy it by doing what you just said, yes
 
You should compare it to ,'1' instead
 
@Schiphol check out Type
 
which is a character vector / string, '1' is just the character
I thought thorn was this thing → Þ?
 
4:16 PM
I just noticed you could use þ in variable names, interesting
But not the uppercase Þ
 
Ah, the problem was that I was doing ⍕d = (9 ⊃ ⍵), and of course it had to be
(⍕d) = (9 ⊃ ⍵)

evaluation order bites me every time
 
you actually don't need the parens on the right :)
 
@RubenVerg ...like I was saying :)
 
:)
Btw, is it possible to print to stdout without the newline?
skips the newline, but seems to write to stderr
(Trying to figure out how someone solved this in 28 bytes: open.kattis.com/problems/oddecho)
 
4:37 PM
@rabbitgrowth 28??
I have 20 without any golf
⎕∘←¨{⍵/⍨2|⍳≢⍵}{⍞}¨⍳⎕
if the ⎕: output is not allowed, ⎕∘←¨{⍵/⍨2|⍳≢⍵}{⍞}¨⍳⍎⍞ for 21
I actually cannot come up with a solution that is exactly 28 bytes
 
It looks like they count by UTF-8 bytes, so ⎕∘←¨{⍵/⍨2|⍳≢⍵}{⍞}¨⍳⎕ is 44, not 20
 
ahh, I see
I'll think about it then
I just made an account and submitted my solution, where does it tell me the byte count?
 
Metadata → Statistics → Show
or you can just use something like mothereff.in/byte-counter I think
@RubenVerg That's already a substantial improvement over my {⎕←⍵}¨{⍵/⍨1 0⍴⍨≢⍵}{⍞}¨⍳⎕ (50 bytes), thanks :)
I think if the number of lines is always even, you could do something like {⎕←⍞⊢⍞}¨⍳⎕÷2?
 
I found a 31 byte sol
 
Sadly it can be odd
Wow
 
4:48 PM
want a hint?
 
Yes please
 
you don't need to take all the input before you output
 
Hmm
@rabbitgrowth Am I going in the right direction with this
You can't conditionally ⎕← with ⍣0 or ⍣1, right?
⎕←⍣0⊢'hello' runs but prints hello, I don't even know why
 
@rabbitgrowth I was thinking about that too, but even though you can't there is still a pretty easy way to tell if you're on an odd or even input
@rabbitgrowth kinda
 
5:02 PM
can't seem to get it for less than 31
okay got it for 29 by abusing the fact that we count in utf8
 
@RubenVerg I assume you have code in the construct function you want to run after the web socket upgrade happens?
Did you try threading the construct function? That might work, but it would be better to just put that code in the onWebSocketUgrade callback.
 
Um, I just realized they accept extra newlines in the output, so the 28-byte solution is probably just {⎕←⍞/⍨2|⍵}¨⍳⎕
@RubenVerg Yours doesn't output extra newlines, right?
 
@PaulMansour I tried construct& but it doesn't work, afaict all the stuff after is still ran in the main thread
@rabbitgrowth not the 29 one
but yes the 25 one
(which I forgot to mention)
 
@rabbitgrowth it's basically just this one but slightly refactored
so you don't need the 3-byte-costing commute
the utf8 trick btw is that diamonds cost 3 bytes and newlines just 1
 
5:21 PM
Ah, I think I found the 29 one
That was fun, thanks Ruben!
 
 
5 hours later…
10:36 PM
@Schiphol Don't forget you can search APLcart
@RubenVerg What exactly does the file contain?
(if you can't reveal here, you can email me — adam@ with the same domain as www.dyalog.com)
@RubenVerg Zip the aplcores (they compress really well) and email them to support@dyalog.com
@rabbitgrowth You'd have to add the newline manually.
@rabbitgrowth Because if the string isn't assigned to then it'll be returned (and therefore printed).
 

« first day (2365 days earlier)      last day (296 days later) »