« first day (1042 days earlier)      last day (1909 days later) » 

00:00
@Bubbler No, you can't, but if you want additional arguments, why not make an operator with array operand(s)?
Also, with the new array notation that's in the works, I'm hoping to extend tradfns so they can unpack namespaces as dictionaries for "named" arguments. E.g. myfn(param:42 ⋄ arg:1 2 3)
@Adám Because operators don't support default arguments (or operands)?
@Bubbler Right, only the left argument can have a default.
@Bubbler Really, Variant is a hacky way to introduce additional, optional, named arguments into a syntax that doesn't quite fit it.
@Bubbler What you can do is make a monadic operator with an optional left argument, and then treat the operand as left argument when there's no left argument.
00:26
@Adám Sounds hacky on its own, since the binding rule becomes different from normal dyadic functions
That's true.
Probably I should just define two separate versions, one with and one without the additional argument
Yeah, or you could hack your own Variant.
I found your Extended has a customized Variant, but I couldn't grasp how it works
@Bubbler It sets a namespace ⎕SE.VariantOptions and expects affected functions to check there.
00:46
@Adám That's awesome!
 
3 hours later…
03:48
@Adám I found an interesting way to specify modifiers
 
3 hours later…
06:41
@Adám For Advent of Code day 3, I needed an array that was about twice as big as the workspace I had available. Is there a way around this?
07:06
@Sherlock9 Remind me which OS you are on.
MacOS
Although it occurs to me that 13000 by 13000 might be overkill
@Sherlock9 open $HOME/.dyalog/dyalog.config in your preferred text editor and add export MAXWS=3G
Thank you very much!
@Sherlock9 It says here which you could find through docs.dyalog.com#MACOS
@Bubbler Sure, but if you're creating one "settings name" for each function, you might as well go a much simpler route.
@Bubbler Also, that pollutes ⎕SE with settings, and nested/subsequent calls to functions that use the same setting will interfere with each other.
07:27
@Adám XD of course it does. Sorry for the trouble
07:40
@Sherlock9 Not a problem, but it does show that our documentation should be more discoverable.
08:32
I'm trying to get our good friend Mendeleev to try APL, but they seem more interested in J. Largely because they use an Iris keyboard and so don't have enough keys
But also, I have the following answer for this year's Advent of Code Day 3 and I cannot for the life of me figure out why it isn't working
(i specified m←... for the loops so it doesn't return early, but I could just define a function, honestly)
... I should just define another function
Link to for posterity but I didn't want to leave the raw code in here tio.run/##SyzI0U2pTMzJT///…
@Sherlock9 I don't see what the problem is typing-wise.
@Sherlock9 I'd say dumping APL code into this room is on-topic :-)
@Sherlock9 That's the kind of case where I think a tradfn would be a better fit.
08:50
So with the above code, it still runs the first instruction, but doesn't run any of the others
@Sherlock9 I'm suspecting you've got the dfn style wrong here: i='R':c,←z+⍳j ⋄ x+←j won't do x+←j if i='R'
@Adám Ah hell
of course not
This is very much a procedural program → go tradfn
Okay, remind me how those work again?
@Sherlock9 You just need a calling syntax header like result←larg FnName rarg;list;of;locals
Then you can use normal procedural style control structures like :If cond ⋄ stuff ⋄ :EndIf and :Select thing ⋄ :Case val1 ⋄ do this ⋄ :Case val2 ⋄ do that ⋄ :Else ⋄ do something ⋄ :EndSelect
:For this :In all ⋄ process ⋄ :EndFor is much easier to debug than {, and doesn't fail on empty args.
09:01
Ooh
I've found the chapter on it in Mastering Dyalog APL too
@Adám So like this? tio.run/…
@Sherlock9 Recurse with fn name
line(1,0) : error AC0040: could not fix function "∇ M←rarg m larg; c x y ip z i j"
@Sherlock9 ;list;of;locals
;facepalm;
2
You can also put the locals on a separate line that begins with ;
09:31
@Sherlock9 Any luck?
Some. The intersection still doesn't work
@Sherlock9 But now you can trace through and inspect it.
@Sherlock9 You never assigned to the result variable M
Yep. I just changed the name to C ⍣ :P
Still not sure if it's actually checking for intersections properly
09:37
@Sherlock9 Why not?
The reason I was using complex numbers in the first place is that I wasn't sure how to compare two-item vectors in that sort of ∩ intersection
TIO still looks like it's printing both c and d not c∩d
@Sherlock9 simply looks at the elements of its arguments:
⎕←(2 7)(1 8)∩(2 8)(1 8)(2 8)
@Adám
┌───┐
│1 8│
└───┘
oh
then what the heck
@Sherlock9 Did you try tracing through?
09:41
Oh right. How do you do that?
@Sherlock9 Just hold Ctrl while pressing Enter. (at least on Windows it is)
Look for TC in the keyboard shortcuts list
09:59
Oh it's that last C at the end of h!
IT LIVES!
 
2 hours later…
11:44
@Adám I'm working on turning part 2 into APL, but it's slow going
12:03
@Sherlock9 Slow and steady wins the race.
12:55
@Adám Huzzah!
@Sherlock9 Reducing empty lists, by any chance?
@Adám Oh that's not the correct input, so there are no intersections yet
Any link with the correct input, even just up to the point where one gets the correct answers for the challenge as a whole, is too long to paste here
@Sherlock9 OK, no problem. This certainly looks cleaner. I'd probably go for :Select/:Case though.
@Adám Fixed and with the first intersection
Never mind the input's still too long
One moment
@Sherlock9 I think you can simplify ∊{⍸(⊂⍵)⍷c}¨q to something like ∊(⍸⍷∘c)¨q although I am wondering if you really need or = would do the trick, and if there's only one, then possibly ⍸c∊q or some such
13:09
Ahhh
@Sherlock9 I think you can combine (some of) the cases:
You see, that's the part I was fighting with the past couple hours (with breaks)
 :Select i←⊃INST
 :Case 'R'
     C,←y,¨⍨x+⍳j
 :Case 'L'
     C,←y,¨⍨x-⍳j
 :Case 'D'
     C,←x,¨y+⍳j
 :Case 'U'
     C,←x,¨y-⍳j
 :EndSelect
 x y+←(i∊'DU')⌽j 0ׯ1*i∊'LU'
@Adám This works
@Sherlock9 Hang on…
13:12
@Adám But the problem with ⍸c∊q is that I need to get the position in c of items in q
Meanwhile, that's the other way round
Brb, I need to get home from work
@Sherlock9 Does this work?
 j←⍎1↓INST
 i j←⊃INST
 sign←¯1*i∊'LU'
 swap←i∊'DU'
 (l r)←swap⌽y x
 C,←l,¨r+sign×⍳j
 x y+←swap⌽sign×j 0
@Sherlock9 Well, something like it should. Do you get what I'm after here?
14:04
Yeah, I think so
ngn
ngn
@Adám i couldn't disagree more. tradfns aren't a good fit for anything.
@Adám You forgot to swap when appending to C
And there's an extra assignment to j
@Sherlock9 Oops, that's a left-over from experimenting with splitting INST.
 j←⍎1↓INST
 i←⊃INST
 sign←¯1*i∊'LU'
 swap←i∊'DU'
 (l r)←swap⌽y x
 C,←(swap∘⌽)¨l,¨r+sign×⍳j
 x y+←swap⌽sign×j 0
@Sherlock9 (swap∘⌽)¨swap⌽¨
14:17
Ahh
Didn't seem to work earlier
Oh, I was trying swap∘⌽¨
 
1 hour later…
15:20
oh that's a fun way to do this AoC. seems me wanting to not rely on the distances being small led to a way slower program than that:
https://tio.run/##zZExS8NAFMf3fopsd0eupomtititi1AQCtlcrnGooCVTBNM6GAlt7BWLiH6AijcUHaSLixA/ie@LxHfXFqqjOAgh994v//fyzz8iPCkfnYvjU1EUML7bP4D0plIK8U5aO9yv8WaNNzaJRfxt3trijSpvVkmphFKUwChzbAcGD71cUcguQc7YBUiFZCOOBCrqDmRJrkC@WXB9ZUVn62y@ZPVI7OptcrYAWKMwS3BqJepoJr6zABl1NcuSDuP6vaaOlk9H78bKUyystlk/R449XmhXwHAaMNqG4WPA@rnaMy717r4TeyCfHfswpiDHLqS3iNnHPXWtCqP5izkqFhb6cJmxpUir6TcIyFfTznEl4YTq6VzVMRzOFjRcT@@/pUapjX@0F5Q/JwMP0kmuVk50BLbteIt@Df7MeTn2i7S72g3tmo/6@9iL4gs
 
2 hours later…
ngn
ngn
17:05
or 0.3⊖'⍋'
 
1 hour later…
18:13
@ngn Wat?
ngn
ngn
@Adám a funny picture, a joke
I don't get it.
@Adám there's a link in that message
ngn
ngn
⎕←t(3⊖t) ⊣ t←↑' x ' ' xxx ' ' x x x ' ' x x x ' 'xxxxxxxxx' ' x ' ''
@ngn
┌─────────┬─────────┐
│ x       │ x x x   │
│ xxx     │xxxxxxxxx│
│ x x x   │ x       │
│ x x x   │         │
│xxxxxxxxx│ x       │
│ x       │ xxx     │
│         │ x x x   │
└─────────┴─────────┘
ngn
ngn
18:18
ugh.. this didn't come out as intended
@Adám tio
it looks like markdown collapses multiple consecutive spaces into one
⎕←≢¨'01 34' '01 45'
@ngn
5 5
ngn
ngn
@ngn mhm. that's what it is.
@ngn and it's definitely markdown as the source still has extra spaces
ngn
ngn
⎕←≢¨'01 34' '01  45' ⊣ 'sorry for the spam. now testing if ctrl+k makes any difference'
@ngn
5 5
 
2 hours later…
20:12
@hoosierEE Welcome. Interested in APL? Maybe you know Aaron Hsu?
20:30
@Adám hey, yeah I know J and a little K, and I've met Aaron a few times. :)
@hoosierEE I can give you a quick intro to APL based on the differences from J.
Sure, I would be glad to hear a summary
@hoosierEE APL uses single fancy Unicode glyphs that are more mnemonic than J's (composite) symbols. APL uses a "floating array" model, which means that boxing a simple scalar is a no-op. Rank-0 functions are also level-at-0, i.e. they pervade boxes. Our 2-trains are atops. You can write inline explicit verbs using braces and / for left and right arguments.
Of course, there are a lot more details, but this covers most basic language features.
That is helpful, thanks. Are you aware of any compilers (not interpreters) for APL or similar languages (besides Aaron's)?
also "2-trains are atops" is that basically like 2 monads in sequence are composed, like f g is analogous to J's f@g?
@hoosierEE Dyalog APL comes with a built-in compiler. APL*PLUS automatically does JIT compilation for loops. There are various WIP compilers out there too.
@hoosierEE Yes, well more like f@:g but you get the idea.
@hoosierEE However, what are you trying to achieve? A stand-alone .exe and/or high performance?
20:45
Adding arrays to a subset of Racket for a class compiler. We compile to x86.
I've taken some inspiration from "An Implementation of J" and my basic idea was to use a fat pointer (pass the pointer to the first element of the array, with the metadata allocated behind it in memory)
@hoosierEE Ah, so you'd want to pull out the array language compiler from an existing project to use in a new(ish) language?
But it would be a standalone executable.
Just want to look at how someone else is implementing it, for inspiration.
@hoosierEE Well, Aaron's compiler is open source and fully commented.
I'll give it another look. The last time I saw his code, it was organized in a rather unusual way.
I think he has simplified it a lot recently.
21:11
@Sherlock9 i was thinking of a way to do this without if-else! If only I had broken down my desired representation (coordinates) into simpler data types (sign & swap)
21:37
@Sherlock9 alternative way to do that
 
1 hour later…
22:55
Failure of the day: I struggled to install Dyalog APL inside Userland Debian on my Android, only to realize that the binary wasn't built for ARM(AArch64)...
@Bubbler I keep pushing for releasing Dyalog APL on Android (it can already run, but needs an interface). Maybe if you bother support@…
It should be able to run in a terminal emulator, but it'd be nice to have a GUI REPL with a streamlined input method.
@Adám I'd say an ARM Linux build is enough for me right now.
And interestingly RIDE already has one
@Bubbler There's the Pi version, but it is 32 bit only.
@Bubbler For the above-mentioned, Pi.
I don't understand why Rasbian is 32 bit when the hardware is 64.
23:06
For the Android GUI, it'd be great to have a dedicated virtual keyboard too.
I tried some APL keyboards out there but all of them were broken in one way or another.
@Bubbler Yeah. Well, the RIDE protocol is public, so we just need a kind soul volunteering to write a GUI. Oh wait…
@Bubbler Did you try APL Keys?
@Adám I just tried it and that one does work.
:-D

« first day (1042 days earlier)      last day (1909 days later) »