How do I define a monadic function to work on a list in J?
- by Gregory Higley
Let's say I have the following J expression:
# 3 ((|=0:)#]) 1+i.1000
This counts the number of numbers between 1 and 1000 that are evenly divisible by 3. (Now, before anyone points out that there's an easier way to do this, this question is about the syntax of J, and not mathematics.)
Let's say I define a monadic function for this, as follows:
…