12:19 AM
You're the best.

8 hours later…
8:32 AM
Funny puzzle: https://leetcode.com/problems/merge-sorted-array/
The question looks for me really cumbersome to probably overcome the lack of changing the size of an array in other programming languages.
The simple question is, merge to vectors and sort them. But to stick to the question I made the following solution:
`nums1←nums1{a[⍋a←(⍺~0),⍵]}nums2`
and the only reason I reassigned nums1 is that it was part of the question
sticking to the question only makes sense for a language that allows you to modify things in place
and passing references
is there a bqn naming rules page on the website?
8:51 AM
@Richard I’ve had similar reflections with leetcode - a lot of language assumptions are built into the questions.
@Razetime thanks!
@Richard numbers can be negative, so `~0` doesn't work.
Any one of these is more in the spirit of the challenge:
```nums1{⍺[⍋⍺]}←nums1[m+⍳n]←nums2
nums1{⍺[⍋⍺]}←(m↓nums1)←nums2```
9:36 AM
i was experimenting with complex numbers and graphing with them and such, but i had issues like this one:
1+(*1)*0J1×○1
i tried doing the famous e^(i pi)=-1
but i was only able to get 0J1.224646799E¯16
what did i do wrong?
oh also i simplified it to *0J1×○1 which gives the same useless result :/
@user17925981 you should get ¯1J1.224646799E¯16, which is substantially -1
`⋄ *0J1×○1`
@AlexB `¯1J1.224646799E¯16`
yae in my original script i did +1 at the en
at the end*
in this blog post i included a small function to get rid of really small inaccurancies like these: palaiologos.rocks/posts/poly-root-apl
`⋄ ¯1 = *0J1×○1`
9:47 AM
@AlexB `1`
`⋄ {+/¯9 ¯11○(⊢×⎕ct<|)9 11○⍵} *0J1×○1`
@KamilaSzewczyk `¯1`
why is this: {}← possible? I don't get it. Do you assign nums1?
and where is it going wrong with negative numbers?
automatically adjusts them judging by comparison tolerance
@xpqz ...which is a bit unfair to APL-ers, but OTOH it's not different than with natural languages. As everyone who speaks 2+ languages knows (probably everyone in this chat) there are concepts that are easily expressed in one language and untranslatable to another language.
9:51 AM
@AlexB but wait i dont get why it isnt minus one on its own. evaluating if its equal to -1 is also wierd. why does it return true if there are trailing imaginary numbers?
@xpqz maybe we should make our own (simple!) page with weekly puzzles. Every week a puzzle in three different difficulties. If I can assist in that in some way ?
```F←{⌈/⍺+/⍵}   ⍝ APL
F←{⌈´+˝˘𝕨↕𝕩} # BQN```
@Richard Well, the hard work for that is done: problems.tryapl.org
@user17925981 Here:
`⋄ ⎕CT`
9:53 AM
@AlexB `1E¯14`
@AlexB See "lagom" :)
ahhhh ok that makes a lot of sense thanks
@PyGamer0 is there a short BQN solution? (i guess its probably tacit)
@user17925981 Comparison tolerance is about 100 times higher than the residual imaginary part.
@xpqz Huh? This? lagomframework.com
9:56 AM
@xpqz Yes, I just found it... :)
Cool
It's a Scandi word/concept considered untranslatable
yes! Very nice! I've been working on those puzzles too.
But than as a weekly puzzle.
So, aren't we glad that programming languages are a bit human after all?
@Richard That page is open-sourced, and I'm sure @Adám or @RikedyP would welcome nicely crafted PRs or suggestions for new problems.
Although if you know where to look, you can dig out the solutions.
And again, if there is anything I could do to assist, please! I am not trying to push work to others but looking to make APL more accesible for newcomers :)
10:08 AM
@Richard There is also Project Rosalind (rosalind.info) which is great for APL. Although they do ramp up in difficulty rather quick.
One thing I do like about leetcode is that they put constraints in place for peak memory and execution time.
10:29 AM
@user17925981 You're explicitly multiplying using `×` when `○` already has multiplication built in: `⋄ 1+*○0J1`
@Adám `0`
@Richard it is in-place assignment to `nums1`. You can increment `a` with `a+←1` which is kind of shorthand for `a←a+1`. Any dyadic function can be used instead of `+`
@PyGamer0 `⌈´+˝˘∘↕` which is just `⌈/+/` in APL.
@Richard How about a weekly event where we get together to solve and discuss one of those problems? If you have ideas for similar-style tasks, we could use them in future competitions, so you could submit them to [email protected].
Of course, the challenge is to find a time that works for as many as possible. Any ideas?
10:44 AM
friday end of the day?
UTC? I can do that, most weeks.
I can never do Friday end-of-day, but maybe someone else can run it?
I was thinking about around 15:00 UTC. (end of the working day:))Till what time are you available?
We blissfully enforce a no-meetings Friday, so I can do just about any time on Fridays (UK hours).
But (as we should know by now....) Fridays don't work for @Adám... but for tail-end of days I can do Mondays and Tuesdays
11:03 AM
tuesday 1515/15:30 UTC?
Works for me.
@Richard If that early, I actually can. 15:00–16:00 UTC?
14:30 is even better.
I can do 15:00, but not 14:30
11:20 AM
for me also 15:00.
OK. I suggest starting next week, rather than tomorrow, so we have some time to advertise/plan/prepare. How do we want to run this? In chat, or as a Zoom meeting with live coding?
@RikedyP A new APL event is being born ^
11:34 AM
I think I (weakly) prefer chatting here; easy for all to talk to the bot so to speak. But happy to go with the flow.
in chat is simpler
Yeah, my thinking as well, and it makes it easy for others to copy and paste to modify expressions, etc. However it might be an idea to record a short screen cast post-event.
One way could be to tackle an easy problem, and then extend it to a more general/harder problem. For example, the two-sum, three-sum, three-sum-closest leetcodes.
I have no issue talking about generalisations after the given problem has been satisfactorily solved.
Up to our first weekly APL Quest!
And in line to @xpqz effort to write down the APl Orchard lessons, we could publish the results online
11:39 AM
We have 100 problems (because 2022's will be available by the time we get there) so this event can run for 2 years straight.
I (personal opinion) prefer to know the topic in advance for a chance to prepare a bit.
I am a slow coder...
Yes I agree, that makes it also more productive and publish ready
I'd say we begin next week with 2013:1,2,3,…,10,2014:1,2,3,…
So, this week the problem for next week is announced, and at the end of a session a new problem is announced for the following week?
@AlexB exactly!
11:41 AM
Both announced and predictable.
are we doing both phase 1 and 2
@Richard I'd be ideal with weekly video plus a repo of contributed solutions.
@Adám I see that @Adám prefers a planned season. That works as well, but it may be a bit rigid.
@Razetime No, just phase 1. Phase 2 is too much for chat, I think.
@Adám It'd be nice if the repo of solutions had some structure to it, e.g. rating for speed, conciseness, elegance, handling of corner cases, etc.
11:43 AM
@AlexB It is a 9 row, 10 column array in ravel order ;-)
@AlexB Yes, we can assign categories/theme's
@AlexB One folder per year, one file per problem, one line per solution. We can put a comment next to each solution and/or use sections for these categories.
Would a Jupyter Book work as a repo? @xpqz? @Adám?
The chat transcript could be made into one, but I don't think that's ideal.
11:45 AM
a video conference would be a nice addition beside the chat. And perhaps more inspiring.
@AlexB Yeah.
@Adám OK, then our Jupyter-book-expert-in-residence @xpqz will have to transcribe... ha ha
I'm thinking something like this
The weekly APL Quest live show
@Adám Yes , I found the same for the AoC
I think chat is best for the live part, but a video follow-up would be nice.
APL Chips, anyone?
11:48 AM
@Adám Yes, that works. In a JupyBook transcript the statement of the problem and the examples could be added, so that it can be read without following the hyperlink.
It really could in a source file too.
So is it Friday 4th Feb 2022 @ 15:00 UTC in t'Orchard re: 2013 phase 1 problems available at problems.tryapl.org?
@RikedyP Specifically 2013:1.
aight we'll announce that today
@RikedyP tuesday 15:00
12:01 PM
Oh, I thought we wanted Friday and Tuesday was only suggested because of me? 15:00 on Tuesdays is very often used for meetings at Dyalog, so not the best choice.
12:13 PM
12:59 PM
not sure how much time can be spent on problems as basic as phase 1s
even a beginner could quickly come up with `{¯1+2×⍳⍵}` for that for example
@rak1507 well maybe it'll work as a focal point to start the conversation, who knows where it'll go, but I do know that starting small and focused is easier to sustain than saying "every week we're gonna all solve 10 problems"
I meant that one harder problem like a phase 2 might be a bit better for having a lot of potential options
most of the phase 1 are 'do this thing' and it's normally fairly clear how to do it if you know any apl
@rak1507 It doesn't have to be a long event. Even that solution has things to discuss. using addition of negative numbers instead of subtraction, dfn vs tacit, scalar extension. It can also be expanded to take a stride as left argument, or an offset, or both. We can discuss `⎕IO`
`¯1+` vs `1-⍨` vs `(``)-1`
pretty unimportant detail really idk just personal preference
I guess ⍳+⍳-≢ is more interesting if you're golfing
Yup, that too.
1:11 PM
@Adám i think it depends on the use case
the first one is certainly suitable only for constants
while the second one is better for everything else
and the last one is really long.

1 hour later…
2:39 PM
For Europeans and American early risers: in an hour and a half (at 16:00 GMT) I will be presenting the April APL compiler to the British APL Association. You can watch it at zoom.us/j/858532665 with the passcode 391680
@phantomics Fantastic!

1 hour later…
3:59 PM
@phantomics damn, I'm gonna miss it :(
4:22 PM
@rak1507 Hasn't really started yet. They're having tech problems with screen sharing.
@rak1507 They're also recording it.
@Adám Is there a way to output the first line like `12+3` LF `<Source>` outputs `15`?
@Fmbalbuena I don't follow.
4:51 PM
@Fmbalbuena Ah, you want to echo each line of code with its output?
If you used a full APL system, you'd basically have that for free.
The three first OO-lessons added to xpqz.github.io/cultivations
@xpqz thanks. Is a namespace something like a record in C?
@Richard I think this explains it fairly well: xpqz.github.io/learnapl/namespaces.html
(But I would say that)
It did strike me today that the dyalog docs Overview page on namespaces isn't super-helpful.
5:00 PM
@xpqz Overview page on namespaces ftfy
5:33 PM
f
Sorry. I'm confused about global variables. In MDAPL 6.4, it states that one can set them and read them. But, when I try in the context of a function, it doesn't seem to work:
:Namespace TestGlobals
Words←⍬
Words←Words,⍵
}
:EndNamespace )clear
clear ws
]import # '/Users/williamallen/src/TestGlobals/TestGlobals.apl'
Imported: # ← /Users/williamallen/src/TestGlobals/TestGlobals.apl
⎕CS TestGlobals
Words

Words

Am I misunderstanding what MDAPL is saying or just doing it wrong?
@bwanab Dfns (functions in braces) auto-localise (and thus shadow the global) names when you assign directly to them. Use namespace or modified or selective or indexed assignment to avoid this, e.g. one of the following:
```⎕THIS.Words←Words,⍵
Words⊢←Words,⍵
Words,←⍵```
Sorry.
@Adám I don't get all the Dyalog Doc bashing. I've always found the core documentation to be excellent.
5:51 PM
@PaulMansour The problem is that it describes what's there instead of being instructive. It is not very helpful if you don't already know what you want to work with and the name of the tool you want info on.
It is basically leaving out all the background concept knowledge that you need to get stuff done. Hence APL Wiki trying to fill that gap.
6:03 PM
@rak1507 I'll get you the video when it's posted
Thanks to Adam and others who joined, it looks like Zoom prevents the use of HD video when there are many participants to save their bandwidth, hence the low res, but I got a high-res recording
Thanks @phantomics
@PaulMansour I don't think it's bashing. Good documentation is hard to write. I was just reflecting on the following intro to namespaces:
`Namespace is a (class 9) object in Dyalog APL. Namespaces are analogous to nested workspaces. They provide the same sort of facility for workspaces as directories do for filesystems. The analogy, based on DOS, might prove helpful:`
Whilst undeniably correct, I think you'd be hard pushed to understand what they really are useful for.
Compare to the much shorter, but much more helpful intro from APL Wiki:
> A namespace is an encapsulation mechanism for names used within a program
NSes are best explained by example, or "You know how JSON works? This is like JSON in APL."
And it continues:
> Because code can be evaluated within a particular namespace, namespaces serve as a way to combine the context for a set of functions or other operations without interfering with other parts of a program that do not need this context.
@phantomics Ah, but that's not really true.
C++ (!) describes namespaces thus:
> Namespaces provide a method for preventing name conflicts in large projects. Symbols declared inside a namespace block are placed in a named scope that prevents them from being mistaken for identically-named symbols in other scopes.
6:10 PM
Yeah, APL NSes do a bunch of things that JS objects don't, but it at least gives someone a starting point to understand them
and BQN:
> A namespace is a type of value that groups together several values (fields) from the same scope.
I think the entire chapter on namespaces is not bad. The biggest problem with Dyalog documentation is clearly hardly anyone reads it.
@PaulMansour One of the reasons for that, is that it is hard to find the right page to read. Hence APLcart trying to be an interface to some of Dyalog's docs.
@phantomics JS used to have a `with` statement which kinda allowed some more stuff to be done with objects. It was eventually deemed bad practice. However, what is bad practice in JS may not be in other languages
The main Dyalog PDF is a great reference for the functions and operators, but you need lessons to first understand the language's grammar
6:13 PM
(I believe `with` is just a fatal error in strict mode JS)
@AndréLeria APL has `:With` and it is also considered bad practice (though mainly because it has strange behaviour).
Perhaps it's the same case then...
IIRC JS's `with` used to treat the passed object as the global context. So if you had `obj={foo: 1, bar: 2}` you could do `with (obj) { return foo + bar }`
@Adám you can do `with` in APL with `ns.(code)` though
@dzaima No, only `ns.(expression)`. I often want:
```ns.(
assign←stuff
more←things
…
)```
The array notation for namespaces will fix most such cases.
@theamoeba Hi there. Interested in APL?
I'm stuck for a few days in the Dyadic Transpose chapter of xpqz.github.io/learnapl. I don't know if it's just too hard or if I haven't spent enough time
(I also don't remember much from the Key and Stencil chapters. I guess I just kinda understood enough and thought I'd go back to them when needed)
6:26 PM
dyadic `⍉` is certainly one of the most hard to understand primitives
@dzaima `⍉`
oops did BQN altgr+shift+5 (which isn't even transpose in the APL layout)
I remember I stopped learning BQN and came back to APL when I saw you couldn't just (1 2 3) your arrays. It's petty, but APL and LISP do it so well, why couldn't newer languages also do it?
Sure, I'll go back to BQN eventually. But it threw me off.
@AndréLeria Because juxtaposition is already taken for binding arguments/operands. Overloading it causes issues, e.g. `f⍤1 y` and `-@3 y` don't work in APL as you'd expect them to.
I'm aware there was a reason, I just disliked it at first. I imagine there's a good reason to it down the line.
6:33 PM
BQN's strand format is one of the things I dislike about it.
6:49 PM
I'm now trying to use problems.tryapl.org, but something which works locally for a problem results in a syntax error on the website.
`{⊃∊/¯1⎕C¨⍺ ⍵}`
Any insight as to how that might cause a syntax error?
(specifically it's problem 7 of the 2015 problem set)
@taronish Yes, that site uses an older version of Dyalog, which doesn't have `⎕C`
Use `819⌶` instead of `¯1⎕C`
@Adám Oh! That makes sense then - thanks!
I hope to have that fixed soon after 18.2 comes out. Should be a couple of weeks.
@AndréLeria Dyadic transpose is one of the hardest thing to learn, and even after you understand it, it (for me anyway) usually comes down to a bit of trial and error to get it right. For me, what really made it click was this gem from Morten: chat.stackexchange.com/transcript/52405?m=57439754#57439754
If you're stuck on that chapter, leave it, and return to it some other time.
Hey, what's a pleasant way to go about updating a page using HtmlRenderer? You can easily send a new page via the data property.

I was considering storing the global state of a page then updating/appending to relevant parts with some basic parsing.
6:59 PM
I actually peeked at some later chapters. One of them was the Error Handling one. I hate it
Watch @Adám's webinar series on error handling.
Hmmmmmm
Or avoid errors :)
@FawnLocke If you want to update part of a page, you can use the ExecuteJavaScript method, setting innerHTML, or outerHTML properties.
@xpqz This looked more like the solution, to me
7:03 PM
Is this the canonical way? I'm aware of DUI's existence, I assume that's how it does it too?
Thanks for the response
@PaulMansour I so want `myHTMLRenderer.DOM.…`
I have one.
@FawnLocke DUI has some basic capabilities to update the client side without refreshing the content.
@PaulMansour Does it work like for real? `myHTMLRenderer.DOM.document.body.style.background←'red'`?
Thanks Brian, I was watching your talk from Dyalog 19 today to get me started. If you could point me at the relevant files I'd much appreciate that
7:05 PM
@Adám Its probably as real as you are going to get in the next 10 years.
Basically we can have a DOM object in APL, that is synced with the HTMLRenderer DOM
@FawnLocke The basics of event handling are found in github.com/Dyalog/DUI/blob/master/MS3/Documentation/References/…. If you have questions, please feel free to email me
Will do! Appreciate it
Then I can have an element in APL b (representing the body)and do things like:
` b SetProperty 'style.background' 'red'`
@PaulMansour Are changes in the client reflected in the APL DOM?
7:19 PM
I wonder if I should eventually learn the Dyalog-exclusive stuff. It's fun for hobby, but being brazilian, developing a commercial application in APL is completely off-limits due to license costs alone
No, unless there is callback into APL. . That would be some magic! My model for desktop cross-platform GUI is ALL state change goes through APL
That's why I initially tried GNU APL and April. Unfortunately GNU APL is pretty limited compared to Dyalog, and April is... good, but I don't know if I want to delve back into CL
So if you want to do say, autocomplete, each keystroke is a call back into APL, which then updates the APLDOM, and also the HTMLRenderer DOM
(not that I intend to have commercial applications written in APL. But I like to have alternatives available)
@AndréLeria You can get it for free and only pay money as a small percentage of revenue if you have profitable business
7:22 PM
Is there a percentage of revenue thing? I didn't see it when I glanced at them
Yes.
@AndréLeria Yeah, it is a bit obscure and hidden on the website, but it is 2% once you're above some amount, I think once the 2% amounts to €500 or so.
Is that monthly or yearly?
If it's monthly, it basically means it's free for brazilian users
If it's yearly... it may not be that much off
@AndréLeria 2% of what you earn using Dyalog.
So, if I take 10 years to reach 25k euros, I only have to pay after that time? (english is hard)
7:26 PM
Something like that. Don't take my word for it; we'll eventually update the website with clearer rules.
Don't worry, I'm aware licenses are more serious than a short chat
Still, that changes a ton
25k eur is like... my entire current 2 year long contract
Brazilian economy is in shambles
(actually I'm closer to 30k but still)
We're working on streamlining the licensing. You'll also be allowed to freely redistribute (subject to the 2%>£500 rule, of course).
@AndréLeria The point is you would only need to pay Dyalog if you are making money off Dyalog and successful, so there is virtually no price barrier to a startup.
@PaulMansour I got it, and that does change everything
@Adám Your direct assignment syntax would work if I went to formal classes, problem is I don't want to maintain a massive class structure,
7:38 PM
@PaulMansour Right, I totally understand that, but it'd be so awesome.
wonder if it could be dynamically generated. Anyway, I stopped at the element level, and then just use a javascript snippet tacke on to that.
Probably could. Think of how the .NET bridge works. That's basically what I want: exposure of members with type seamless conversion.
That would be ideal. Calling John D...
I wrote a prototype websockety thing (you embed a bit of JavaScript in your page and there's an APL side that knows how to talk with it) that allowed you to execute JavaScript and get results back... as I recall, my progress bogged down trying to accommodate more complex objects from the JS side
7:56 PM
@Brian I've been trying this with regular http connection, with limited success. Did you need threads on the APL side?
If more complex objects is the only problem, I wouldn't call that a problem!
I'd be happy to get anything that stringify works on.
@PaulMansour Truthfully Paul, it's been a while since I tinkered with it, so I don't recall if I resorted to using a thread. I think that it was just a simple callback
@PaulMansour I'll dig it up and share it with you...
That would be great, thanks.
@FawnLocke I'm not sure there is anything remotely canonical with the HTMLRenderer yet. The ExecuteJavaScript method was only introduced in v18
I'm also interested. I want to get something similar to [phoenix live-view](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html) working eventually.

Which uses sockets to re-render relevant parts of the DOM within the browser *from* the server. Allows for real-time applications, and SPAs without JavaScript :)
Well, you need a JavaScript shim for initializing the connection amongst other things, still
@PaulMansour fair enough
@xpqz Looks good, but maybe link to APL Wiki "namespace"?
@FawnLocke I was thinking about this too. A web worker to deal with the messages and sync up stuff, and a web socket to deal with the messaging
8:11 PM
Yeah
I just didn't mention it because... it seemed too obvious for anyone not to have tried it yet
So I just assumed people tried but couldn't make it work
Well, this is less cross-platform GUIs, and more chat applications etc. Something I assume people are less interested in
@FawnLocke Right, the HTMLRenderer is largely not relevant here , correct?
Yeah, I don't know if you can use web sockets in APL without it though? I assumed it's purely a method of it
Well, actually, there must be some library with that independent functionality. Conga, or what have you
Yes, you just need Conga on the server. The HTMLRenderer would I think have no purpose on a server.
8:17 PM
Gotcha
DUI is actually designed to work with either Conga or HTMLRenderer depending on whether you want to deploy as a web service or a desktop app
Where does MiServer come into play?
@Brian This is an interesting topic.
So, DUI has 2 server models, MiServer (Conga-based), and HRServer (HTMLRenderer-based)... the goal was to make it as flexible as possible for where and how you wanted to deploy
By definition then, DUI can't use a feature like HTMLRenderer.ExecuteJavaScript, no?
I guess you could use it, but you would need a totally different way of doing it with MiServer
8:21 PM
@PaulMansour You can do whatever you want with the content. There just won't be a MiServer analog
but, the websockety thing I wrote would work with either
DUI is two components, a server (either HRServer or MiServer) and a library of content-generating utilities that were supposed to make it easier to generate web content from APL... sadly how much easier is open to debate
for instance, the APL Problem Solving Competition website is MiServer-based, as was TryAPL for a decade until Adam and Rich Park rewrote it using Jarvis
I'm surprised there isn't a native cross-platform GUI solution. You would need to create bindings, though. And I believe there's no way to pass custom types or Gobject classes to APL, so qt and gtk, as well as most libraries are off the table
8:40 PM
@Brian So the websockety thing does not use HTMLRenderer.ExecuteJavaScript?
correct
It sends an expression that gets eval'ed
Got it.
How does DUI resolve resource requests? Eg. If you have `<script src="example.js"></script>` in the HTML
@FawnLocke You run DUI on a folder and relative requests are resolved based on that folder
Gotcha
8:46 PM
hey how do i interrupt on ride ide? like i'm messing with the life function and i keep getting stuck
ah thanks :D
No worries
I was thinking my APLDOM framework would not work over the internet because it relies on ExecuteJavaScript, but now realize I have no idea what I am doing. With a websocket things could work the same with a HTMLRenderer locally or a unknown remote client.
Only question is performance I think
@PaulMansour That was the conclusion I arrived at... websockets are bloody quick, almost no overhead
but of course you need to contend with dropped connections, etc... so, it's never as simple as you first think...
9:36 PM
`⎕←4(⊃(,∘.,)/⍤⍴∘⊂)'ab'`
```@Fmbalbuena
┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
│aaaa│aaab│aaba│aabb│abaa│abab│abba│abbb│baaa│baab│baba│babb│bbaa│bbab│bbba│bbbb│
└────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘```
Why?
TIO's outdated