@dzaima what is instantiated here? I was surprised when you said z←{a} should fail because in Dyalog APL it wouldn't be executed and doesn't fail until z ⍬
@TessellatingHeckler correct version: each time a block is called, it gets an environment, and the variable array that comes with that. As {a} is immediately called, it gets its environment immediately, and accesses a immediately, which is, at the time of its execution, not defined.
@cannadayr yeah, making BQN arrays be a class/tuple of ravel & shape is good for specifying shape
@dzaima i.e. see what {2+2} does
if immediate blocks don't exist/work, F←{𝕩+a} ⋄ F 1 ⋄ a←1 is an alternative that does the same thing
@TessellatingHeckler the parent environment. Otherwise you wouldn't be able to access a in a←1 ⋄ {a+𝕩}1
@dzaima that makes a "global" environment of a single variable a, and the {a+𝕩} block, when evaluated, creates an environment with 3 variables 𝕊, 𝕩, and 𝕨 (only one of which we use), and stores its outer environment as its parent (here, the global one)
@TessellatingHeckler It might help to read the scoping spec, which makes a point of carefully maintaining the distinction between blocks and instances of them (and identifiers versus variables). The last section is the part that's performed by the VM.
Lexical scoping is easy to use and easy to implement (assuming you have garbage collection already), but difficult to explain or talk about.
@Adám like im interested in helping with apl cart, just where do you want the blog post and content mentioned in the issues to go? like a brand new page or what
<moon-child> well, not entirely clear how the syntax is supposed to work. I tried running the latest version and {{expr}} does nothing other than it would otherwise. (Though perhaps the feature is yet unfinished.)
<moon-child> also, looks like it was changed to {{ }} from (. ). IMO the latter would be better as it doesn't overload existing syntax. But maybe even better would be open with (: and close with bare )
<moon-child> better for golf, and it matches the existing non-tacit fn syntax
<moon-child> (also, leading : matches k9 expression syntax)
I see you have created the LaTeX template, I was just trying to figure out where you defined it and couldn't find it. As for LuaTex/LuaLatEx and XeTex/XeLaTeX I don't know if they are different names for the same thing
@dzaima It's explicitly pointed out that it isn't.
@RGS Wikipedia doesn't specially typeset LaTeX, and I'd say we should follow suit. A name is a sequence of letters; the fancy representation is a logo.
rewrote a subset of bqn vm prototype in elixir last night. pros: elixir is less rigorous about mutation (instead using variable rebinding), which is good when I dont personally have a complete enough mental model to write a functional version. it has keywords [1], which seems to provide similar functionality as foo.sh where foo was a list. cons: erlang has named funs [2] which are very handy for writing self referential lambdas. there is a way to emulate it in elixir (wrap in outer function that you call with itself as a parameter) but its hacky
@ngn those are just stupid base64 of unicode escapes because i didn't know better. Now i'd either suggest a base64 of utf8 bytes of the wanted string, or, if wanted, some compression on top; paste uses pako, which is what tio uses, but comparing different compression algorithms is a todo item for me
but with any of those you want the encoded text to be after a # so that mess isn't sent to the server (unless you have a server and want server-side processing for it, but i doubt that)
@ngn For the BQN REPL, I used Base64 of the code in UTF8. It's not too bad in modern Javascript, or in BQN, and it gives a URL that isn't affected by URL encoding.
# Encode
let b=(new TextEncoder()).encode(doc.code.value);
btoa(String.fromCharCode(...b);
# Decode
let b=atob(code);
b=new Uint8Array([...b].map(c=>c.charCodeAt(0)));
(new TextDecoder()).decode(b);
@ngn it's definitely not the best, but setting up a custom codepage for APL, which still allows including arbitrary unicode besides APL, would be quite a bit more work
@ngn I'm just joking, I know golfing with compression is smaller. But I do have to wonder what would motivate a K programmer to share more than, like, a kilobyte of code.
There's kind of this phenomenon where the things users of a language worry about are precisely the kinds of things the language should prevent them from having to worry about.
Short answer - de facto limit of 2000 characters
If you keep URLs under 2000 characters, they'll work in virtually any combination of client and server software.
If you are targeting particular browsers, see below for more details on specific limits.
Longer answer - first, the standards...
RFC 26...
@ngn simple, just import golf and have it be a module full of one-character functions which implement golf problems. Call it 0SABIE or J3LLY or something and claim it's a golf language. (If golf is compression, it should be held to the standards of compression challenges and be sizeof(code+interpreter) which counts)
@Marshall I don't think it's the same; there might be some value in "how short can a general-purpose interpreter be", I don't see much value in "in FooLang, there happens to be a one-byte front end to this large and hyper-specialised back-end, 1 byte answer" and then switch languages every question
<moon-child> @TessellatingHeckler that's true, but a self-interpreter in joy (iirc) or lisp is not more than 20 lines. Which can't really compare with most other languages
<ioa> Somehow it makes me happy that the raku instance crashing is to blame and not the APL.
@moon-child it's probably not reasonably possible to do this in competitions anything like the normal codegolf ones, they'd be eaten up in IO code if nothing else. But if you can write a self-interpreter in Joy in 20 lines and also write a solver for whatever the problem is, that's impressive. More impressive than writing a one-liner in Python leveraging megabytes of hashing and set and generator and bignum code behind the scenes.
and more impressive than writing a 10 byte J answer that calls p: as a builtin
@TessellatingHeckler A self-interpreter isn't a reasonable measure of programming language complexity, because it can reuse all the language's functionality without ever implementing it in the first place.
Even if you somehow find a way to clearly define and disallow eval-like things.
here somewhere, github.com/mlochbaum/BQN/blob/… where the code inside D has to be able to reference vm() which is defined after it, that works in lexical JS and not in dynamic PS, and I think the way I addressed that is maybe only working for simple things and not modifiers
please, whoever starts implementing the next 100 apl-like interpreters in whatever super-cool language, do make the output look like an apl expression. don't print it as "1" when it's really a vector. print ",1". don't print empty. print ",⊂⊂0 0 ' '" or whatever it is with full information about the prototype.
@dzaima that could be an option, but i think the default must be round-tripping. it helps a lot with learning, and learners don't know how to configure their interpreter yet. the defaults must suit their needs.
(about formatting, there's the third option of it being interactive - by default the output is "pretty", but you can examine any previous output - get deeper insight, prototype info, roundtripping code, etc)
@dzaima OK, can you edit the startup.dyalog sibling file to the executable? Change the line [52] verSpec←{ into ⎕←verSpec←{ then start APL and let me know what it prints to the session.