439 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
1
answer
146
views
How to write an accumulative recursive function in J without looping
At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
2
votes
2
answers
173
views
How to write a tacit tetration verb in J?
The tetration is an operation defined as an iterated exponentiation (e.g 2^^4 = 2^(2^(2^2)) = 65536)
I'm learning the J programming language and want to experiment with the ^: (power of verb) function ...
3
votes
2
answers
173
views
Keep numbers which appear in both columns, in J lang
Given a table with two columns:
1 2
3 4
2 1
1 2
I'm trying to understand how to produce a list of only the numbers which appear in both columns.
E.g. 1, 1, 1, 2, 2, 2 in this example.
I can see Nub ...
user avatar
user479053
2
votes
0
answers
94
views
Need a more efficient sorted leaderboard prototype
Here is a leaderboard prototype for ranking on the left column and could be user indices on the right. The matrix stays sorted. It might get a lot of traffic. Typical size 100,000 and up.
(4 2 0ドル 342 ...
2
votes
2
answers
159
views
Differentiation in J
I am a beginner learning J based on this book (2015 version). I was able to run all examples until this one from the calculus chapter:
^&3 d. 1
3&*@(^&2)
I get this error locally:
|...
2
votes
1
answer
91
views
simplify tacit fork definition
I have the following tacit fork (intended to be used monadically):
F&.I G H&.I
i.e. the left and right verbs F and H of the fork get I applied with &. (under) before feeding the outputs to ...
3
votes
2
answers
123
views
How to use local variables in nested verbs?
Perhaps there's no facility to do this in the J language, but when I write:
succession =: monad define
greg =. 1 2 3
tom =. {{ greg }}
tom y
)
and then call succession 'season 1', I get the ...
3
votes
1
answer
82
views
How to reshape an array with an arbitrary size in one dimension?
How would you go about reshaping a length-N 1D array into an (N/2) x 2 array? In numpy, for example, you can use -1 in place of N/2 when reshaping:
>>> x = np.array([1,2,3,4])
>>> x....
1
vote
1
answer
156
views
What does 'm' stand for in an inline function?
What's going on that makes this code work? It seems that using m in an anonymous verb (if that's what it's called) turns the verb into a postfix operator.
1 {{ 1 + m }}
2
If I replace the m with y ...
3
votes
3
answers
179
views
Why is Insert (fold) right associative
I expected
-/ 1 2 3 4
_8 NB. ((1-2)-3)-4
but I got
-/ 1 2 3 4
_2 NB. 1-(2-(3-4))
I there a reason for this? How do I get the associativity that I was expecting? If there are relevant sections in the ...
3
votes
2
answers
107
views
Alignment issue when printing formatted prime numbers in J language
I am a relatively new programmer in J-Lang and recently discovered its efficacy in Code Golfing, where it excels in scoring. I am currently working on a coding problem that involves printing all prime ...
2
votes
1
answer
255
views
Can Prolog-like unification be expressed in a point free way?
Pattern matching can be implemented using a point free style, and there are many articles on the internet about it. I'm wondering if the more generalized case also holds, i.e. is it possible to ...
5
votes
1
answer
182
views
How to unbox a list of boxed lists of differing lengths in J?
Given the following list of boxed lists of differing lengths...
┌──────────────┬───────────┬─────┬───┐
│0 2 3 4 7 9 11│9 7 4 3 2 1│1 2 3│3 1│
└──────────────┴───────────┴─────┴───┘
How can I create a ...
3
votes
2
answers
558
views
How to get user input in the J programming language
I'm very new to the J programming language, so I got interested in array programming languages and decided to give it a go.
Unfortunately, It's a very niche language, meaning that there aren't many ...
1
vote
3
answers
268
views
Print char of string uppercase if it is a vowel and lowercase if it is a consonant
I am trying to come up with a verb that will take a string as input
and printa character uppercase if it is a vowel i.e. (aeiou) or lowercase
if it is a consonant.
s=:'authority'
t=:<&>s
│a│...