Random thought: seeing as BQN uses different notation for function application and stranding, would it be more possible to make an 'array of functions' or something like that?
Any reason BQN uses the opposite to dyalog for ×÷?
@Razetime i don't. i use curl and vlc. it's puzzling that there are links to various streaming services but no big fat download button. it's as if the author is hoping to profit from this somehow.
All the primitives are good, the fact that you can have first class functions, the symbols are really nice and consistent as well, it just seems to be well thought through and quite polished
@chrispsn probably won't happen :( k9 is work in progress and you're not supposed to make performance comparisons, iirc. k6 is dead. bqn doesn't have an implementation with decent performance. dyalog won't get into a fight that will make them look bad.
@ngn I don't think Dyalog is being that strategic about it. They haven't managed to publish benchmarks against Numpy, and I'm sure Dyalog would win that one.
@chrispsn I guess the first X Project Euler problems would be the Schelling point task and there are probably Dyalog and K solutions for those out there. They ask you not to publish solutions, though, and the problems are very biased towards number theory and solutions will be pretty short for my tastes.
@chrispsn In case you haven't seen it, I have translations of about half of Roger Hui's 50 functions, which you could compare to the originals with some amount of effort.
@chrispsn I'm not sure that question (or my interpretation of it?) is very helpful. BQN deliberately strips out anything vaguely domain-specific because those things should come from libraries.
The main advantages versus APL I'd say are functional programming and greater consistency and rigor. BQN has fewer moving parts and is less likely to do something unexpected or force you into an unreliable solution (say, one that only works on vectors). Versus K it would be the ability to use multidimensional arrays.
And closures, which as far as I know aren't in any published K?
@Razetime You mean AoC20 solutions, but solved after this year ends, right? Sounds really good, and I'd be happy to give you feedback or tips if you show me the code as you're working on them.
@dzaima yes, and lack of prototypes is my fault in ngn/k. k5 (at least early k5) had prototypes. afaik only k6 was experimenting with abandoning them, and i decided to follow suit. k9 has prototypes too.
@Razetime I'm not really inclined to change things at this point, and I think messing with ⊏⊑ would require a lot of other changes as well. Go ahead and look if you want, but I probably won't use what you find.
@Adám reading your bio on the APL wiki led me to your style guide, which I like a lot. I have a problem following it in the MENACE book, though: afaik it is not currently possible to write or edit multi-line dfns using the daylog jupyer notebook, so the only thing I can do is place comments after the dfn def, and the dfns cannot be traced as they are single line :)
@Marshall two primitives that do almost the same thing and one can be expressed trivially in terms of the other. you put 2 in the language, arthur limited himself to 1.
@Marshall They all end up being syntactic sugar for each other (u@ux is always equivalent to u . enlist ux.) and (Nothing can be expressed with brackets that cannot also be expressed using ..)
@dzaima i mentioned "1-dimensional" only because list# is reshape (like in apl), and list_ is cut. these two don't feel like counterparts of one another like their 1-dim variants do.
@dzaima according to kolmogorov they are the same thing
@rak1507 I thought I'd read the wiki, but maybe too long ago. Several questions now answered. Of course, by reading the docs I lose my amateur status :)
@Marshall I think this is one of the only places in k where there's so much overlap between the builtins. I assume it's an artifact of how dealing with deeply-nested data is difficult, so having more specialized tools in this specific niche makes sense. I mean this is the same language that expects you to use -_- (negate floor negate) for ceiling
@rak1507 .[a;i;f;b] means amend the array a (it could be a symbol, in which case the global with that name is amended) at indices i, with the function f and right argument(s) b
@ngn I don't know exactly how this fits into the discussion, but my position is that by far the most significant cost of adding a (well-designed) primitive is the difficulty of learning and remembering what it does. Both for writing and reading, so it's not enough to say "just ignore it if you don't want to learn it". By this criterion some primitives are far more costly than others. The second case of / is essentially free.
@rak1507 If you somehow have a list of the arguments you can use {x,y,z} . (so the first element in the list is the first argument passed to the function, the second the second, etc.)
@coltim I consider indexing one of the hardest problems in array language design. I don't think there is a really satisfactory solution. Probably BQN's way could be improved, but I don't know how.
@ngn Um, I chose to add primitives when it wasn't costly? Arthur says every primitive is extremely expensive, and ASCII sets a hard limit on how many there can be. I say primitives can be cheap.
@ngn Also worth pointing out that being able to choose a symbol from all of Unicode rather than being forced to find a closest fit in ASCII means that BQN primitives can have more intuitive representations, making them cheaper than K ones (not that Unicode has perfect coverage of useful symbols).
@Marshall i'm a little torn about this, tbh. i like expressive symbols, but the advantage of being able to type on any keyboard without extra configurations and fonts is just too great..
@Marshall in ngn/k my policy is to allow but not require unicode (some might argue that "allow" easily leads to "require" and that's not wrong)
@dzaima well, 1+ is there - it can be typed. it would be a shame to waste it as a syntax error. i think k projections/compositions are the most natural thing that could occupy that place.
a train is a sequence of terms. some of them are nouns, some verbs. it parses very much like apl in this respect. but noun-vs-verb is decided purely based on syntax, not runtime. so t would be a noun regardless of what you have in the variable t at runtime.
also note that {} is a noun - this is important for understanding k's grammar correctly
Well, at least it's context free, I guess. So basically things are nouns by default, except primitives, and there's syntax to treat something as a verb.
BQN's parentheses are purer because they can never change the semantics, only grouping, but it's also more difficult to convert a function to a subject in BQN.
With that requirement I'd probably rather have all user-defined verb application be done with brackets for consistency. So you'd basically have C with more operators/primitive verbs, plus adverbs.
@Marshall i see that as the sacrifice necessary to make the language statically parsable without resorting to things like _f_ (as in some other languages) for marking infix user-defined verbs
@Marshall even monadic? i like f x as an alternative to f[x]. in a long expression that can save a lot of ]]]
@ngn I'm on the other side of that tradeoff, I guess. BQN's syntax is way more complicated, but at least it lets you change a primitive to a variable without changing other things.
@Marshall coincidentally, a couple of days ago we were discussing with @coltim a possible extension of k6 to do exactly that with unicode chars - treat them as proper verbs
@rak1507 tl;dr you can do a←0 and if you forget to declare it as a local, that would modify the ain your caller's local environment (if it exists), not the global a (if it exists)