@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)
@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.
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)
@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.
@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
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
@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.
@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?
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)
@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)
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)...