« first day (1426 days earlier)      last day (1411 days later) » 

12:17 AM
@JoshD are you the same person who won the problem solving competition?
… and subsequently got hired. Yes, he is.
Oh cool
Now an employee! Extra cool
I just found the blog post
12:46 AM
Hi again folks! Could somebody walk me through "eval"ing a tree structure? I'm re-reading Aaron Hsu's paper but it still didn't click yet. Here's the rough description: is.gd/mjtree
I'm thinking I need something recursive, like (fn¨⍣≡) v
Maybe best to ask Aaron himself. I can email him and ask him to come in here.
I actually wrote him an e-mail so maybe I can ask him a followup. Or if it's useful to you to have a transcript here for future searches, why not.
Either way, but if you didn't tell him so, he'll not realise he can converse with you here. He has been here extensively on occasion, and is quite happy to explain at length.
I will ask him to come here and discuss it. Thanks for the push!
np
12:50 AM
Anyways to rubber-duck explain my train of thought, it seems to me the fn should have guards and based on a) whether result has been calculated already and b) the t of the node + all children are calculated, it would do some calculation or keep it as is. The power fixpoint operator would then call it until all levels have been walked and calculated
Does that sound reasonable or like a common practice?
What is the tree structure you're working with like? A nested list or flat numeric arrays like Aaron does?
See is.gd/mjtree - I've got it down to the flat structure Aaron works with.
The link is a simplified version of my real problem, I have some nastier calculations there but this should illustrate nicely
Ah, yes, then you need Aaron, the tree-wrangler.
Btw, you can post a long URL in a separate message by hitting Shift+Enter before you submit it.
Huh! That's a new one for me. I always chickened out at the "your message is too long" error message. Thanks!
1:31 AM
@ngn thanks, I'm gonna ask (again) on SO
Hi, I have a question about ⎕FX - if I have a dfn and a name I want to assign it to, how do I add a function with that name to the current namespace? ⎕FX seems to assume I've already made a function and assigned it to a variable so I can use its name.
@user What exactly do you mean by "if I have a dfn"?
Do you have the code as a text variable or do you want to use a new name in this namespace for a function of a different name in another namespace?
I meant that I have something like {⍵+1} and a name n (say 'f'), and I want to do f←{w+1}.
I wanted to use a new name in this namespace for an anonymous function
@user But that is the nature of that {⍵+1}? Is that a character vector?
Can't believe but I've got it
1:36 AM
@MartinJaniczek Congrats! Looks like very little code too.
It's a dfn I got from an atop where the first function is ⍎ and the second is a function returning a string representing a function
@user Ah. Can you maybe avoid applying so you instead can catch the string?
Yeah, I can probably change my code a bit for that.
Then you can either do ⍎n,'←',string or ⎕FX,⊂n,'←',string
Oh, that's a lot easier than I thought it would be!
1:39 AM
The latter is the safe option, as it doesn't allow execution of arbitrary code.
I think I tried something like the first one, but it didn't become global
Can I somehow do multiline functions in tio.run? Or is it only reserved for )ed in the desktop editor
@MartinJaniczek Yes, they should "just work".
Thanks, I've got to go now
All the best!
1:41 AM
And inside the editor itself (other than )ed)? doing x←{ and newlining results in syntax error
Remind me of your OS again.
Right now I'm on Windows. (But would be interested in RIDE@Linux options too.) But ultimately this is just a question out of curiosity, I can work with )ed if need be.
Options → Configure… → Session → Extended Multiline Input
On all platforms, you can enter ]dinput before entering a multi-line dfn.
@Adám That's awesome. Thank you!
@Adám is this there on mac?
1:45 AM
]dinput, yes. Proper multi-line support is coming soon.
@MartinJaniczek Btw, did you APLcart that?
@Adám Ah, I didn't. Need to go there more often.
One lingering question in my head. Will :If etc. control structures hurt performance? Are they eg. less parallelizable? (They seem not as idiomatic, if anything)
It at least seems to me that "APL, the good parts" is tacit definitions and dfns
I'm not sure where you expect your code to run in parallel, but in general conditions are bound to slow down code due to branch prediction errors.
If you want good performance, then use flat (non-nested) homogenous (all-character or all-number) arrays of the smallest possible type, and use array operations instead of loops and conditions.
> arrays of the smallest possible type

Does that just mean minimizing the values, or is there some annotation/typehint mechanism? Or was it about rank?
Eh I guess not about rank since you mentioned flat
It means e.g. if you have a choice between moving to Boolean now or later, do it now. (Dyalog uses 1 bit per Boolean.)
2:01 AM
From a language implementor perspective, does Dyalog go through the arrays to check what minimal type can it pack the arrays with, or is it eg. just enforced by the operations? (× on array previously known to contain integers -> guarantees array of bools)
It tends to squeeze, but it isn't guaranteed. ⎕WA will force a squeeze of everything, and ⎕DR will force a squeeze of the given argument.
@MartinJaniczek Here's an example: {+/0>,⍵} counts the number of negative elements of a flat numeric array.
However, ,⍵ needs to copy the array in memory to ravel it, and only then is it replaced a Boolean array of the same dimensions (but using down to a 64th of the memory).
If instead you use {+/,0>⍵} then the whole array is never copied. Instead, all elements are traversed, and only one bit is written to memory per element. This new Boolean array is obviously not referenced anywhere, so , can act in-place, at basically 0 cost.
Huh. Yeah so that ties into "minimize your values ASAP"
That's really helpful (and interesting), thanks
@MartinJaniczek Dfns have some oddities, including wasting memory and keeping unnecessary stack frames. Tradfns may be clunky, but they are not "bad".
@MartinJaniczek Did you ever see my personal style guide (not endorsed by Dyalog)?
@Adám I only saw Aaron describing the style guide landscape in some video. Will read yours!
I made a new userscript which does the same thing as ]rows -style=long on tio: gist.github.com/razetime/542bb93a37c6b31ae0eb26859fc63880
2:10 AM
@Razetime Hold on, you don't need a user script for that. Just inject a little bit of CSS with e.g. Stylus.
I didn't want to install another extension
:-) I prefer not running JS unless I have to. I like CSS.
equivalent CSS:
textarea {
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: scroll;
}
Yep.
I'd add an !important after everything just to be sure
2:14 AM
<klg> or better yet, prefix selectors with :root:root or something like that to increase specificity without cluttering the rest
My web philosophy: If you think you need a server call back, you can probably just use a JavaScript library. If you think you need a JavaScript library, you can probably just use vanilla JavaScript. If you think you need JavaScript, you can probably just use CSS. If you think you need CSS, you can probably just use HTML's default formatting.
2:25 AM
But HTML's default formatting is different across browsers (IIRC). Supported CSS features are also different across browsers, and the same goes to JS features. So I use JS library, which lets me abstract away from individual browsers. Server callback is probably too much.
There are only 3 browsers left, they render almost identically, and support all the features I need.
Fine then, I guess
(Are the 3 browsers Firefox/Chrome/Edge?)
No Firefox/Chromium/Safari.
Right, there was Safari
/i thought safari ran on webkit as well
2:31 AM
"as well" as what?
chrome
so that makes it two
Chromium uses Blink.
But Blink and WebKit share history, so the are quite similar.
 
2 hours later…
4:27 AM
Idea: making a webseries with the content of APL cultivation, organized into seasons on youtube.
 
6 hours later…
10:30 AM
CMC: This vector of 3 Boolean matrices:
┌─────┬─────┬─────┐
│1 1 1│1 1 1│1 0 0│
│1 0 1│1 0 1│1 0 0│
│1 1 1│1 1 1│1 0 0│
│1 0 1│1 0 0│1 1 1│
└─────┴─────┴─────┘
initial bet: {4 3⍴(12⍴2)⊤⍵}¨3965 3964 2343 - 29 bytes
@Adám dzaima/APL, 22
@KamilaSzewczyk Nice. 2343,⍨3963+⍳2
this produces PAL, not APL.
⌽2343,3963+⍳2 works
10:37 AM
Oh, right.
i was wondering if i could somehow catenate all these numbers together
shorter, maybe?: (4 3⍴(12⍴2)⊤⊢)¨⌽2343,3963+⍳2
@KamilaSzewczyk that's not shorter
but you can make the dfn version shorter
{4 3⍴⍵⊤⍨12⍴2}
i know, I wanted to do the same on the tacit version
{4 3⍴2⊥⍣¯1⊢⍵}¨⌽2343,3963+⍳2
4 3∘⍴¨2⊥⍣¯1¨⌽2343,3963+⍳2
10:41 AM
25 bytes it is
This beats dzaima's.
or does it?
wasn't dzaima's 22 bytes
@Adám i blame being stupid :p
also, dzaima/APL, 20
oh also
how can I load an APL source file using dyalog APL console?
10:44 AM
@Adám 19
@KamilaSzewczyk Did you try APLcart?
yes, it suggests quad load but it loads only workspaces
Anyway, it is ⎕FIX
I'll amend APLcart.
when you type in load you don't get fix anywhere
Right, I'm fixing that now.
OK, should work momentarily.
I hope that in the next version, we'll have my new Get tool, which allows getting pretty much anything from pretty much anywhere.
10:49 AM
@Adám I believe it doesn't load source files, but specific APL objects
Not sure what you mean by that.
@Adám you cant't ⎕fix a file containing a←1⋄⎕←'hi'
you need to wrap it in :namespace&:endnamespace or something stupid
@dzaima True, but that wouldn't be called "loading" would it? More like "running".
4 9∘⍴2⊥⍣¯1⌽6.653790033E10
We are getting a way to "run scripts" like that, though.
10:51 AM
@Adám loading a single function isn't much more "loading" than loading many functions, and loading a namespace is still just executing code
@dzaima Hold on, ⎕FIX can load many consecutive functions from a single file, without :namespace
@Adám i'm having trouble having it load any (both dfns and tradfns)
Did you use 2 as left argument?
@Adám yay for intuitivity (no)
Yeah, that left argument really bothers me. I understand why extending the functionality of 1⎕FIX (the default) is problematic, but still…
10:56 AM
(and that still only loads only multiple tradfns)
No, it should handle multiple dfns too.
Although I think there's a bug if the file begins with a bare one-liner dfn.
@Adám it errors with "could not fix function" for me (though i'm not on the latest version)
@dzaima What is your right argument?
@Adám 2⎕FIX'file:///home/dzaima/tmpf.dyalog'
:-D
Apparently, there's a but when the source begins with a dfn \○/
10:58 AM
@Adám that's what it looks like
fun behavior of dfn followed by tradfn running but the tradfn just isn't defined
Yeah, I think it is something to do with "anything beyond the } of a dfn is ignored". I'm trying to track down the internal issue…
11:29 AM
@dzaima Logged as 18732
@dzaima Logged as 18733
11:42 AM
@Razetime For whom to do? This is already on my list of possibilities for this year, but if someone external to Dyalog is willing to have a go it makes the APL video landscape more diverse - of course if you'd prefer them to come from Adam's mouth that would make sense too
12:00 PM
@RikedyP maybe me
I'll have a lot of time once my exams get over
12:40 PM
is there a way to "detect" if my dfn is ran monadically or dyadically? or force binding monadically or dyadically?
@KamilaSzewczyk APLcart?
nvm: it was on the bottom of APLcart list: 0=⎕NC'⍺'
1:28 PM
⋄ 4 9∘⍴2⊥⍣¯1⌽68278286695
ngn
ngn
@brgal you could also do 4 9⍴(36⍴2)⊤68278286695 and use to golf another byte
@brgal actually, the in the original is unnecessary
@brgal wasn't it supposed to be a vector of three matrices, not a single matrix?
@brgal ⋄ (9⍴3↑1)⊂4 9⍴2⊥⍣¯1⌽68278286695
@Adám
┌→────────────────────────┐
│ ┌→────┐ ┌→────┐ ┌→────┐ │
│ ↓1 1 1│ ↓1 1 1│ ↓1 0 0│ │
│ │1 0 1│ │1 0 1│ │1 0 0│ │
│ │1 1 1│ │1 1 1│ │1 0 0│ │
│ │1 0 1│ │1 0 0│ │1 1 1│ │
│ └~────┘ └~────┘ └~────┘ │
└∊────────────────────────┘
⋄  4 9⍴2⊥⍣¯1⌽68278286695
1:40 PM
@brgal
┌→────────────────┐
↓1 1 1 1 1 1 1 0 0│
│1 0 1 1 0 1 1 0 0│
│1 1 1 1 1 1 1 0 0│
│1 0 1 1 0 0 1 1 1│
└~────────────────┘
4 3∘⍴¨2⊥⍣¯1¨⌽2343,3963+⍳2 is shorter anyways
@ngn Thanks !
Sure, it was just for interest.
@KamilaSzewczyk I know.
@Adám if you have time today, I'd love to continue that yesterday lesson
1:43 PM
@Adám Thanks @Adám
@Konrad'Unrooted'Klawikowski Sure. When is good?
I have time till 1am tommorow, and I'll just go eat something around 4/5pm so
what about you?
Fits well with me. I have a meeting at 3pm UTC which is 4pm by you.
So you want to continue now?
Got it, Good luck with it
Sure, I'd love to
Btw, you're German, right?
1:48 PM
By Blood, yes
Over 60%
But German is your native tongue?
I use it in home, but I live in Poland so, both Polish and German I'd say
I just thought that APL Wiki's list of German terminology might interest you. There's also a German (-speaking) APL user group.
Remember that you defined IsInteger←{⍵=⌊⍵} ?
1:52 PM
@Adám assume I have a regex I apply using ⎕R, I'd like to perform replacement only if the regex matched at least one capture group - how would I do that? I stumbled upon documentation of the object passed to the dfn on the right, but it doesn't help much
@KamilaSzewczyk I'm not entirely sure I understand. How can your regex (with capture groups) match if no capture group matched?
@Konrad'Unrooted'Klawikowski You were on the path to define IsDivisibleBy. For that, you have to figure out what it means for a number to be divisible by another number.
⋄ 1{⍵÷⍺=⌊}1 213.7
@Konrad'Unrooted'Klawikowski SYNTAX ERROR
1:55 PM
You're just missing a on the right of
yes, regexes using | can return full match or full match and additional groups
⋄ 1{⍵÷⍺=⌊⍵}1 213.7
@Konrad'Unrooted'Klawikowski DOMAIN ERROR
If = gives 0, then you're dividing by 0!
wait I have to flip it over?
1:56 PM
What are you trying to do?
for example: b|(a) for input a gives a full match and group, for input b it gives only a full match
i'm interested in replacing the full match only if the group matched
@KamilaSzewczyk Just check the length of (e.g.) ⍵.Lengths. If it is 1, then no groups were caught.
VALUE ERROR: Undefined name: Length
Sorry. Lengths
1:58 PM
maybe tally + Offsets?
⋄ 'abc|(ab)d'⎕R{1=≢⍵.Lengths:⍵.Match ⋄ ⌽⍵.Match}'abd' 'abc' 'abd'
@Adám
┌→──────────────────┐
│ ┌→──┐ ┌→──┐ ┌→──┐ │
│ │dba│ │abc│ │dba│ │
│ └───┘ └───┘ └───┘ │
└∊──────────────────┘
It doesn't really matter which of the three plural names you use.
I see, thanks
@KamilaSzewczyk Do you actually need a function to process or would a pattern be enough?
2:01 PM
⋄ 1{⍵÷⍺ = ⌊(⍵÷⍺)}1 213.7
@Konrad'Unrooted'Klawikowski DOMAIN ERROR
@Konrad'Unrooted'Klawikowski Almost there. THink order of execution. What does the = see?
('''''[^'''']*''''|(a)'⎕R{(≢⍵.Offsets)=1:⍵.Match⋄'b'})'a'
1{(⍵÷⍺) = ⌊(⍵÷⍺)}1 213.7
2:02 PM
replace a with b only if a is outside of quotes
@KamilaSzewczyk Ah, I often do that. Simply use two regexes instead of | syntax, and let the first replacement pattern be '&' (or the equivalent '\0' which will work better for you).
the problem is, I don't want to get rid of the quoted data
⋄ 1{(⍵÷⍺) = ⌊(⍵÷⍺)}1 213.7
@Konrad 'Unrooted' Klawikowski
┌→──┐
│1 0│
└~──┘
2:04 PM
@KamilaSzewczyk Btw, what you wrote is outside doubled quotes.
⋄ 213.7{(⍵÷⍺) = ⌊(⍵÷⍺)}1 213.7
@Konrad 'Unrooted' Klawikowski
┌→──┐
│0 1│
└~──┘
You test cases are a bit funny, and the arguments are swapped, but yes.
The function name was IsDivisibleBy so you'd want to divide the left arg with the right arg.
Can you think of a way to avoid computing the division twice?
⋄ 420{(⍺÷⍵) = ⌊(⍺÷⍵)}1 213.7 2 3
2:06 PM
@Konrad 'Unrooted' Klawikowski
┌→──────┐
│1 0 1 1│
└~──────┘
hm, avoiding that
I have no other idea since just ⌊ thrown syntax error
sssh: assignment
What if I told you that a function can contain multiple statements, separated by ⋄ ?
@KamilaSzewczyk You don't need to shell out for this task, much less do you need authentication ;-P
wait, let me try what Kami suggested
Yes, that's the idea.
2:12 PM
⋄ dupa ← (⍺÷⍵) ⋄ 213.7{dupa = ⌊dupa} 1 2 3 4 5 69 420
@Konrad 'Unrooted' Klawikowski
SYNTAX ERROR
VALUE ERROR
The assignment would have to live inside the function.
{} delimits the function. You can have multiple statements in there.
⋄ 213.7{ dupa ← (⍺÷⍵) ⋄ dupa = ⌊dupa} 1 2 3 4 5 69 420
@Konrad 'Unrooted' Klawikowski
┌→────────────┐
│0 0 0 0 0 0 0│
└~────────────┘
2:14 PM
like that?
looool
Exactly like that.
Of course, a non-integer isn't evenly divisible by any integer…
can we have guards in dops? I wanted to refactor ((lhs'%')⎕R{(≢⍵.Offsets)=1:⍵.Match⋄' (Percent) '})⍵ to ((lhs'%')⎕R{' (Percent) '}{(≢⍵.Offsets)=1:⍵.Match⋄⍺⍺0}) 'abc', but it doesn't seem to like the guard
Also, you don't need the parenthesis here. While not a function, in some ways behave like one, so it also sees everything on its right as its value to be assigned. Furthermore, the result of an assignment is always the value on the right.
⋄ 420{ dupa ← (⍺÷⍵) ⋄ dupa = ⌊dupa} 1 2 3 4 5 69 420
@Konrad 'Unrooted' Klawikowski
┌→────────────┐
│1 1 1 1 1 0 1│
└~────────────┘
2:16 PM
it works
lol
@KamilaSzewczyk The guard isn't the problem. ⎕R is a dyadic operator, so it binds {' (Percent) '} as its right argument, and the derived replacement function becomes the operand to your operator.
Solution: just move the leftmost ( to the right of ⎕R.
ohhh, I missed it. Thanks
But, why are you using a constant function like that?
to strip off all the clutter related to matches to an operator, or hopefully, somewhere else
And you couldn't split your regex into two?
2:18 PM
but I can actually bind an operator to a constant so I can drop the braces
Yes, and you can even compose a left argument to the right operand of ⎕R, avoiding the need for an operator altogether.
I see regexes, my instant questions is: can we rewrite github.com/redcode-labs/Sammler to APL one day? lol
@Konrad'Unrooted'Klawikowski Very good. Do you know the the definition of a prime number?
yeah, prime number means divisible by 1 and n where n is the number itself
is this that one?
That's right. Can you write a function IsPrime now, which answers 0 or 1 when given a single positive integer?
2:22 PM
so is it like
the same, but this time I use iota alpha as an omega argument?
to check divisability by every number till n where n is the checked number?
Go ahead and define it. You may want to check it on a few numbers, like 1 and 2 and 9 and 10 and 11.
⋄ 7{ dupa ← (⍺÷⍵) ⋄ dupa = ⌊dupa} ⍳7
@Konrad 'Unrooted' Klawikowski
┌→────────────┐
│1 0 0 0 0 0 1│
└~────────────┘
and now I'll have to sum up the results
I think
Very good. You remembered how to count 1s in a Boolean.
2:25 PM
I mean, everyone can see it, but when we check higher numbers, the list can be bigger
⋄ 7{ dupa ← (⍺÷⍵) ⋄ dupa = ⌊dupa ⋄+/} ⍳7
 @Konrad 'Unrooted' Klawikowski
┌→────────────┐
│1 0 0 0 0 0 1│
└~────────────┘
wait no
⋄ 7{ dupa ← (⍺÷⍵) ⋄ +/ dupa = ⌊dupa} ⍳7
@Konrad'Unrooted'Klawikowski 2
yeah, seems to work
Nice. Now modify that so it takes a single number as arguments, instead of the number and its
2:29 PM
⋄ 7{ dupa ← (⍺÷⍵) ⋄ +/ dupa = ⌊dupa} 1 2 3 4 5 6 7
@Konrad'Unrooted'Klawikowski 2
an obvious version I can come up with is 13 chars
We're not golfing.
I know, I'm just suggesting my solution without spoiling it
a shorter one can be made using dfns
@Konrad'Unrooted'Klawikowski Should be rather trivial.
@Konrad'Unrooted'Klawikowski Any luck on converting to a simple monadic function?
2:38 PM
wait
just without +/ and iota?
@Konrad'Unrooted'Klawikowski No, so you don't have to call it with n and ⍳n as arguments. I want to call it just with n as a single argument.
⋄ 7{ dupa ← (⍺÷⍳⍵) ⋄ +/ dupa = ⌊dupa}
@Konrad'Unrooted'Klawikowski SYNTAX ERROR
You can't have a sole left argument. Monadic functions always take their argument on the right.
Also, a monadic function should not mention
2:54 PM
right
⋄ { dupa ← (⍵÷⍳⍵) ⋄ +/ dupa = ⌊dupa} 7
@Konrad'Unrooted'Klawikowski 2
Good, now you return the divisor count. How would you instead return a single Boolean 1 or 0 to indicate primeness?
⋄ { dupa ← (⍵÷⍳⍵) ⋄ dupa = ⌊dupa} 7
@Konrad 'Unrooted' Klawikowski
┌→────────────┐
│1 0 0 0 0 0 1│
└~────────────┘
2:58 PM
<klg> ah yes, Polish traditional metasyntactic variables
how about constants :^)

« first day (1426 days earlier)      last day (1411 days later) »