From 4854a698fb966b3a9581a99234e73df7816f2b16 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 26 Feb 2021 22:10:38 -0500 Subject: =?UTF-8?q?Mark=20problems=20with=20math=20functions=20as=20solved?= =?UTF-8?q?=20(=E2=80=A2math=20namespace);=20minor=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commentary/problems.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'commentary/problems.md') diff --git a/commentary/problems.md b/commentary/problems.md index b1842c72..017d680b 100644 --- a/commentary/problems.md +++ b/commentary/problems.md @@ -15,22 +15,22 @@ BQN inherits the functions `+×⌊⌈|`, and adds the functions `∧∨<>≠≡ ### Glyphs are hard to type There's been a lot of work done on this. Still there, still a problem. On the other hand, glyphs are easy to read, and write by hand! -### Tacit and one-line functions are hard to debug -This problem hasn't manifested yet as BQN has no debugger, but it's something to keep in mind. Traditional line-by-line debuggers don't work when the line is doing so much work. Something like J's dissect or some kind of hybrid would probably do better. +### Syntactic type erasure +A programmer can call a modifier on either a syntactic function or subject, but there's no way to know within the modifier which syntax that operand had. Maybe this is a better design, but it doesn't feel quite right that `f˜` is `f`-Swap if `f` has a function value. The subject syntax suggests it should be Constant. Instead the Constant modifier `˙` has been added partially to mitigate this. + +### Control flow substitutes have awkward syntax +At the moment BQN has no control structures, instead preferring modifiers, function recursion, and headers. When working with pure functions, these can be better than control structures. For more imperative programming they're a lot worse. For example, it's natural to have two arguments for small structures, but that becomes unreadable for larger ones. However, predefined functions acting on functions can cover a lot of ground for the imperative programmer; see [Control flow in BQN](../doc/control.md). + +One particular sore point with Repeat (`⍟`) and Choose (`◶`) is that the condition and action(s) always apply to the same set of arguments. Often you'd like them to apply to completely different things: this seems like the sort of thing that split compose `F⊸G⟜H` solved for trains, but here there's no such solution. ### Search function depth The simplest way to define a search function like Index Of is to require the left argument to be a list, and search for an element that matches the right argument. But this means you can only search for one element at a time, which is annoying and doesn't work for Progressive Index Of. So we instead treat the searched argument as a list of major cells. Then we decide to search for cells of the other argument that have the same rank as those cells, since only cells with the same rank can match. That's a little strange for Bins, where it still makes sense to compare cells of different ranks. Furthermore, the result of any search function is always an array. To search for a single element and get an plain number, you need something like `list⊸⊐⌾