No accounting for taste -- truer words never spoken. :)
---
Abandon all hope, ye who read further.
I try not to worry too much about making things tacit. But there's a
neat trick you can play in J to find a tacit definition for a
non-tacit expression (if one can be found). I don't know if there is
a counterpart in any common APL distributions.
First you define an expression in terms of values named 'x' and 'y'.
Your goal is to find a tacit verb -- let's say 'T' -- that you can
call as 'x T y'. (X is always on the left and y is always on the
right, by convention -- compare with ⍺ and ⍵, sort of.) There is a J operation, cryptically named '13
:', which will try to make such an expresssion tacit.
Here's a quick attempt at writing 'N M drop Y', which will return Y
but with the N:M section deleted. Again there might be off-by ones
here (you could use Increment/Decrement to fix that):
Define some 'x' and 'y' values for experimenting:
x =: 5 10 NB. these will be our N:M indexes
y =: 'abcdefghijklmnopqrstuv'
Here are examples of Take and Drop (these are just to help you
translate between APL and J):
5 {. y
abcde
10 }. y
klmnopqrstuv
Monadically the same verbs mean First and Last:
{. x
5
}. x
10
With M and N defined as the first ({.) and last (}.) values of X, take
M from Y, and join (,) it up with the result of dropping N from Y:
(({. x) {. y ) , (}. x) }. y
abcdeklmnopqrstuv
Close enough! Now here's where we invoke the 'make tacit' verb, '13
:'. We have to wrap the original x/y expression in quotes, to make it
a string, and then call it like this:
There's the magic. The tilde (~) is like ⍨ in APL, and the bare [ and
] represent 'take left value' and 'take right value'. The [: word is
called a 'cap' and is used to limit the left side of a verb
fork. (Sorry, I don't know the equivalent in APL.)
And that's our tacit version. We can try it out, give it a name, and
try it out again:
x ( (] {.~ [: {. [) , ] }.~ [: }. [ ) y
abcdeklmnopqrstuv
drop =: (] {.~ [: {. [) , ] }.~ [: }. [
x drop y
abcdeklmnopqrstuv
5 10 drop 'abcdefghijklmnopqrstuv'
abcdeklmnopqrstuv
Ooh that's interesting, and I can read enough J to see how the basic version works, and a bit of what the tacit version is doing; the left and right functions map to ⊣ and ⊢ in APL, I don't know that the cap [: needs an equivalent because Dyalog APL recognises two functions alone without that, and calls it an "atop" for (fg) is (f(g(x)) or "f atop g".
But I'm going to have to read more to work out what/how the tacit version works because I have no intuition for telling where the x and y or ⍺ ⍵ enter into them.
Dyalog have this document for tips for translating d-fns into tacit form: https://dfns.dyalog.com/n_tacit.htm but how that compares to what '13 :' does internally..
Cool! I didn't know that about APL, and thanks for the Dyalog 'n_tacit' link.
This sort of feels like we are two tourists, trying to help each other translate between two languages that neither of us speaks very well. :)
These two pages might help you to build an intuition about how J does verb trains. The diagrams help to explain where the x and y values are used throughout (and where they are not).
I'm starting to be able to write long-ish forks in J without mechanical help, although I usually get them wrong the first dozen times. Practice makes perfect, I guess!
I'm planning to do this year's Advent of Code puzzles (https://adventofcode.com/) in J this year... at least until I reach a problem that explodes my brain. I'm hoping that this will give me something concrete to sharpen my skills on.
---
Abandon all hope, ye who read further.
I try not to worry too much about making things tacit. But there's a neat trick you can play in J to find a tacit definition for a non-tacit expression (if one can be found). I don't know if there is a counterpart in any common APL distributions.
First you define an expression in terms of values named 'x' and 'y'. Your goal is to find a tacit verb -- let's say 'T' -- that you can call as 'x T y'. (X is always on the left and y is always on the right, by convention -- compare with ⍺ and ⍵, sort of.) There is a J operation, cryptically named '13 :', which will try to make such an expresssion tacit.
Here's a quick attempt at writing 'N M drop Y', which will return Y but with the N:M section deleted. Again there might be off-by ones here (you could use Increment/Decrement to fix that):
Define some 'x' and 'y' values for experimenting:
Here are examples of Take and Drop (these are just to help you translate between APL and J): Monadically the same verbs mean First and Last: With M and N defined as the first ({.) and last (}.) values of X, take M from Y, and join (,) it up with the result of dropping N from Y: Close enough! Now here's where we invoke the 'make tacit' verb, '13 :'. We have to wrap the original x/y expression in quotes, to make it a string, and then call it like this: There's the magic. The tilde (~) is like ⍨ in APL, and the bare [ and ] represent 'take left value' and 'take right value'. The [: word is called a 'cap' and is used to limit the left side of a verb fork. (Sorry, I don't know the equivalent in APL.)And that's our tacit version. We can try it out, give it a name, and try it out again:
If you've truly abandoned all hope, the J vocabulary is listed here: https://code.jsoftware.com/wiki/NuVoc