icen
I think there are far worse codebases!
Once you see +/, you understand ,/ or fn/ - whereas you have to remember that it’s written sum, concatenate, or np.ufunc.accumulate in numpy. The same goes for +\ vs cumsum etc (and you don’t get all of these pre defined).
The difference here means that whilst numpy gets the core array operations down, it’s much less convenient and less self explanatory than the apl system.
(1 ∾˜ " "⊸(¬∘⍷))⊸/
which removes the first space of each occurrence of double spacing ((«¬∘∧⊢)' '=⊢)⊸/
This works by building a boolean mask of spaces, and converting it to a mask of 'is a space, preceded by a space', negates that, and replicates out by that inverted mask (i.e. is not a space preceded by a space):Here's stepping through it with some input.
(' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 ⟩
(«' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 ⟩
((«∧⊢)' '=⊢) "this is a sentence with many spaces"
⟨ 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 ⟩
((«¬∘∧⊢)' '=⊢) "this is a sentence with many spaces"
⟨ 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 ⟩
((«¬∘∧⊢)' '=⊢)⊸/ "this is a sentence with many spaces"
"this is a sentence with many spaces"For example, & is monadic 'where' and dyadic 'min' (a logical extension of it being AND on bit-booleans), but this means you get different semantics, even if they all capture the 'where'-ness:
1 3 ~ &0 1 0 1 / when applied to a list, gives the indices of true elements
`b`d ~ &`a`b`c`d!0 1 0 1 / when applied to a dict, gives their keys
In both cases, you get that `x@&x` works, as `&x` will yield appropriate indices for `x`, but what that actually does has changed. In other languages, these would be spelled very differently, and so do seem like an overload, but sometimes it is just a point of view.As for why it's obvious- it's not, really, but it's no less obvious than the word `where`, and you have already learnt it, as it is (as it seems to me at least) to be punned on the C syntax (same as `*`, which gives `first`).
It’s regrettable that this is necessary, but with so few Ethernet ports on laptops it’s harder to install these things without access to WiFi.
I’ve not used it myself, but it appears to be the thing you’re wanting?
{ foo[x, bar] }(Not OP) Possibly, but one of the repeated themes in Boatmurdered is a number of fortress defenses (some with considerable collateral damage) attached to a variety of scattered and unmarked levers.
Does pulling this lever lower the drawbridge, irrigate the fields, or douse the world in cleansing magma? Only one way to tell!
I did eventually find this in the documentation, under the "regexp selections" section. I think it should be more prominently displayed in other sections, since it's a natural thing to want (at first).
I am enjoying the editor (as a current helix user), and looking forward to trying it more.
Q is a different language to K, implemented in K. There are more versions of K than Q- kdb+ is the only Q implementation, but there are others like shakti, ngn/k, and kona that implement K.
Somehow the usual culprits of +-/*|^&% get a free pass on this, and are somehow less arcane than symbols like ⍋ or ⊃.
There's nothing inherent about this, it's about familiarity, and once familiar, everyone always prefers the symbols over spelling it out like plus, minus, divide, multiply...
Most often I end up with some enormous one-liner that I then break down into functions again.
stringOrInt : (x : boolean) -> int -> (if x then String else int)
stringOrInt true x = toString x
stringOrInt false x = x + 1
1 + stringOrInt true 37 # this will error, because it knows you've not returned an int
The other example that you can do in depedently typed languages, but is too involved to write out here, is make a type-safe printf, where the format string produces the types for the other arguments.Some optimisations aren't quite there (like under on higher rank arrays not being as fast as computing the indices on the flattened array), but everything else has been good.
There is a concept of tacit, or point-free, programming, which avoids the variable names as parameters, for example the calculation of the mean `avg ← +⌿÷≢`. However this does become unwieldy pretty quickly, and it's easy to juggle too much. It is very useful for short snippets, where you avoid all of the ceremony and can just express the core thing you want to talk about (for the avg example, it's not improved by including a parameter: `{(+⌿ ⍵)÷≢⍵}` - the ⍵ parameter isn't informative at all, and nor would anything else, like `samples`). I think it is best to keep the tacit snippets short, and to assign good names to them.
BQN is, in my opinion, the most slick of the array languages; it consistently takes the best of the approaches to high-rank arrays and combinator (including tacit) programming from the others. Some things are unique, and amazing, like structural under.
It is small, it is new, so I would agree with your hesitation to start a business based on it, but to understand these languages or use it for the typical small calculations, it is more than capable.
If it's licensing/a desire to use open-source software, perhaps taking a look at its close relatives of J, or BQN, would be reasonable?
* Dyalog https://www.dyalog.com/download-zone.htm * J https://code.jsoftware.com/wiki/System/Installation/J903/Zip... * BQN https://mlochbaum.github.io/BQN/index.html
All of the languages and implementations have their differences, but they are all driving toward the same ultimate goals.
https://www.arraycast.com/episodes/episode-07-marshall-lochb...
The other (and main) implementation is in C, so I think between the two you shouldn't worry about BQN compatibility when choosing your saucer.
Scientific Realism holds that in some sense scientific theories approximate the world, not just in what the experiments observe, but also in the content of their explanations (precisely, you gain knowledge not just about observables, but also non-observables: things that the theory requires to be true, but can't show). The article ascribes this view to Einstein, who presumably thought that there was a such thing as space-time, and it does actually curve under the influence of mass - despite only seeing things that are explained by the curvature, and not the curvature, or the space-time, itself.
The article then goes on to say that the anti-realist approach (dominated by not-undeserving practical concerns and application) focuses on computation: the mathematics is good so long as it gets the right answers in the end, and the end justifies the means. Therefore, it doesn't matter what contrivances must be dealt with in-between: if you get a better prediction, or can do a new exciting thing, then that was always the aim.
Thus, I read the article as advocating a stepping back from this view: it blames this focus on sheer mathematical sophistication as the route to truth as the source of profound disinterest in philosophy by physicists (it is important to note that I think that aeon is a philosophy newsletter!). Earlier and contemporary physicists (prominently, Einstein) had an interest in not just what their theories produced, but what they explained the world to be, and the article decries the modern lack of this.
I recommend the SEP article on scientific realism, which is dense but on a brief reading gives enough of the context to recognise the article. https://plato.stanford.edu/entries/scientific-realism/ (Although it is even more philosophically focused).
NB. I'm not a physicist or philosopher either, so grains of salt! My only self-endorsement is that I spent the last year reading a bit of philosophy, so perhaps I can be at least a stepping-stone to better resource.
Dyalog has some introductory documentation on how to set up the mappings. https://www.dyalog.com/apl-font-keyboard.htm
If you want to type something very small, you could also go to tryapl.org and use the on-screen keyboard and copy and paste.