AnalogClock






Monday, March 21, 2016

Understanding J

The j language is a terse APL derivative programming language that uses language like concepts.

noun
verb
adjective
adverb
etc.

There are also several programming styles. Parameterized functions, tacit functions, state machines, and many many ways of overloading verbs to get them to do what you want without having to use the full vocabulary of the language.
Tacit functions being my favorite style that I latched on to like a tick on a deer after I'd written my first couple of tacit functions.

Tacit functions are all about changing the meaning of verbs based on a chaining order that determines whether a verb is monadic(one parameter passed on the left or right) or dyadic(left and right parameters) and whether one or both of those parameters are the result of the previous verb or verbs or the original or outer parameters or a combination of the two. Basically a repeating set of 2, a hook, or 3, a fork, verbs in a chain with one verb being the original behavior. More on that here http://www.jsoftware.com/help/learning/contents.htm

So, any who, my big breakthrough moment was when I looked at an example adverb definition and it struck me that my love of terse and tacit function definitions was keeping me from being as productive as I could be in j and thereby keeping me from learning more through experience than I can through pouring through the manuals for the perfect way to cut a character off of a tacit expression.

After my big breakthrough I dug in with gusto and quickly and easily rewrote some j code I'd written  a couple of years ago when I was first learning j. The lesson I have learned is that sometimes you have to use a few more characters to get things done in j. That is just the way it is most of the time.

That being said I still look forward to the next time I have an insight that let's me shave a few characters off of an expression but I will no longer try to force it. I am still a little bit leary of using explicit functions unless it is in order to learn how to write adverbs in j.