j Questions
2
In the paper "Combinatory Logic and Combinators in Array Languages" they give a solution in APL:
vec ← 1 1 0 1 1 1 0 0 0 1
⍝ split (partition) on zeroes
⊆⍨vec
┌───┬─────┬─┐
│1 1│1 1 1│...
2
Solved
I have been learning the Factor and J languages to experiment with point-free programming. The basic mechanics of the languages seem clear, but getting a feeling for how to approach algorithm desig...
Under asked 28/8, 2010 at 19:33
2
Solved
One can calculate f1(f2(f3(x))) as
*: +: >: 4 NB. 100
Given a gerund of "unknown" length (eg. m1 =: *:`+:`>:, or m2 =: +:`>:) how can one calculate f1(f2(...(fn(x)) ...))?
So far I hav...
Hydrocele asked 13/12, 2019 at 9:29
4
Solved
I'm trying to understand APL, J, K, and it's slightly frustrating since:
Most books seen to be about APL, but few APL implementations, and I don't have weird keyboards.
K appears to have been rep...
1
Solved
What is the preferred approach in J for selectively summing multiple axes of an array?
For instance, suppose that a is the following rank 3 array:
]a =: i. 2 3 4
0 1 2 3
4 5 6 7
8 9 10 11
12...
1
Solved
Given the following expression in J, how do I execute it n times?
6?99
The only solution I could come up with was to turn it into a verb, which works nicely, but I suspect there's a better way:
...
Gery asked 2/2, 2018 at 12:42
5
Solved
I had a J program I wrote in 1985 (on vax vms). One section was creating a diagonal matrix from a vector.
a=(n,n)R1,nR0
b=In
a=bXa
Maybe it wasn't J but APL in ascii, but these lines work in cu...
2
Solved
Consider a dyadic verb g, defined in terms of a dyadic verb f:
g=. [ f&.|: f
Is it possible to rewrite g so that the f term appears only once, but the behavior is unchanged?
UPDATE: Local C...
Credits asked 22/10, 2017 at 20:24
2
Solved
Consider a list of gerunds and some data we wish to apply them to, cyclically:
ms=.*`+`- NB. list of gerunds
d =.3 4 5 6 NB. some data
We can do:
ms/ d NB. returns 9, ie, the result of 3 * 4 + ...
Salic asked 9/7, 2017 at 20:21
2
Solved
I have already wrote the following code by my own, which calculates the correlation/correlation matrix step by step:
a=: 1 2 3
b=: 2 3 4
getmean=: +/%#
getmdevn=: -getmean
getvariance1=: (getmean@...
Lowland asked 28/6, 2017 at 14:30
2
Solved
Let's say we have array
0 1 2 3 4 5 8 7 8 9
There are two indexes that have value 8:
(i.10) ([#~8={) 0 1 2 3 4 5 8 7 8 9
6 8
Is there any shorter way to get this result? May be some built-in ...
Capitulation asked 25/9, 2016 at 12:45
7
Solved
The array-language landscape, while fascinating, is confusing to no end. Is there a reason to pick one of J or K or APL or A? None of these options seem to be open-sourced -- are there open sourced...
1
Solved
TL;DR
Given a string containing a (valid) verb, how do I obtain that verb without committing it to any variables? For example, say eval is that function; it should work like this:
eval '+ @ >...
3
Solved
I'm trying to reproduce APL code for the game of life function in J. A YouTube video explaining this code can be found after searching "Game of Life in APL". Currently I have a matrix R which is:
...
Barron asked 21/3, 2016 at 20:12
2
Solved
I've found in 'addons/math/misc/brent.ijs' implementation of Brent's method as an adverb. I would like to build a Newton's method as an adverb too but it's much harder than building tacit verbs.
...
Scientific asked 1/11, 2014 at 14:50
1
Is there a way to get J to use multiple cores ? I thought part of the benefit of APL/J was that the language constructs lent themselves well to parallel solutions.
Looking at my CPU usage (I'm on ...
Evelynneven asked 29/3, 2015 at 18:48
3
Solved
My primary programming language, j, was recently open-sourced. In order to improve it, I'm studying the source, which is written in C.
But it's been a long (!) time since I've read or written C, ...
1
Solved
Every time I use J's M. adverb, performance degrades considerably. Since I suspect Iverson and Hui are far smarter than I, I must be doing something wrong.
Consider the Collatz conjecture. There s...
Gummy asked 30/7, 2015 at 12:47
2
Solved
The rather verbose fork I came up with is
({. , (>:@[ }. ]))
E.g.,
3 ({. , (>:@[ }. ])) 0 1 2 3 4 5
0 1 2 4 5
Works great, but is there a more idiomatic way? What is the usual way to do...
Nickolas asked 21/5, 2015 at 4:40
1
J will answer the n-th prime via p:n.
If I ask for the 100 millionth prime I get an almost instant answer. I cannot imagine J is sieving for that prime that quickly, but neither looking it up in a...
Corody asked 14/4, 2015 at 22:37
7
Assume I have two lists, one is the text t, one is a list of characters c. I want to count how many times each character appears in the text.
This can be done easily with the following APL code.
...
2
As a beginner in J I am often confronted with tacit programs which seem quite byzantine compared to the more familiar explicit form.
Now just because I find interpretation hard does not mean that...
Blayze asked 12/4, 2015 at 16:7
2
Solved
I'm going to create a program that can generate strings from L-system grammars.
Astrid Lindenmayer's original L-System for modelling the growth of algae is:
variables : A B
constants : none
ax...
2
Solved
I'm a newcomer to J and I've been trying to create a Fibonacci function as an exercise (always the second function I create when learning a language). I just can't figure out what exactly is wrong ...
Havard asked 11/6, 2014 at 18:41
1
Solved
I'm coding some J bindings in Python (https://gist.github.com/Synthetica9/73def2ec09d6ac491c98). However, I've run across a problem in handling arbitrary-precicion integers: the output doesn't make...
Palecek asked 11/6, 2014 at 9:44
1 Next >
© 2022 - 2024 — McMap. All rights reserved.