Dataset Viewer
Auto-converted to Parquet Duplicate
question
stringlengths
27
654
answer
stringlengths
2
2.75k
A strange feature? somewhat surprised (hence the question mark in the subject line) to learn that innocent looking verbs (functions) can react quite differently to matching arguments. (Then again, that confirms in my case that the J learning curve is very distinctive.)
The J expressions are not exactly equivalent because the specs are different (but better). In the case of tc the J version is much faster, O(n) instead of O(n^2). (If _1 is already in y, O(2^.n) instead of O(n^2).) x classify y is x I. y tc y is {&(y,_1)^:a: 0
What does this J code do? 'key "Series 1" "Series 2";keypos *rti*' plot \:~"1 ] 2 100?@$1000
puts the legend on the right, top, and inside as it's supposed to, but
In the J programming language: Trailing 0's m10a & variants work on extremely large numbers. So does G if you use 5x instead of 5. e.g. m10a 10^100x G 10^100x
Gx=: [: +/ ] <.@% >:@i.@<.&.(5x&^.)
In the J programming language: recursion -- was alchemy (a) I could not understand the Dictionary. (b) There was no wiki, and no essays.
cDyads Nestclassify2 Tclassify2 t ) cDyads Nestclassify2 Tclassify2 t ) ) a=. <: I. > isname2 each y if. 0 > {. a do. a=. }. a end. NB. no space b4 first for_i. |. a do. if. -. ( , each '[:';' ';'=.';'=:';'(') e.~ i{y do. y=. (>: i) insertat (<' ') ; y end. end. y )
In the J programming language: The discussion on power sets brought me to an improvement on comb, which I thought was impossible.
Here's a variation on R.E. Boss's comb1 which makes it accept the same arguments as comb: ; z ) though I have to admit I find z=.<@i."1(1{.~x-y+1),.0 tempting.
COVID-19 and simulations in J I took the author's code, which is a modified SEIR model (The_SEIR_model
RGB=: (#:i.8) { 0 255 DSEIR =: (0 7 6 4 2 { RGB)
In the J programming language: Update a 2-D array in-place? Have you looked at } Amend? It replaces values using the same indexing options as { From.
Furthermore, expressions of the form 'y =: x m} y'
In the J programming language: Advent of Code, Day 2 (spoilers) I only have a few minutes this morning but here is my unrefined solutions to partA and partB
For part b I just used table and then eliminated 1's and non-integer results. +/,((=<.)#])@(-.&1@,@(%/~))@". ;._2 data
Can you recommend a handheld without a phone module, on which the Pocket PC-version of J is operational?
(B) No, you can not use these characters in J names: ]a?u?=.'txt' |spelling error | ]a?u?=.'txt'
In the J programming language: how to define f? I am wondering how to define a function f, which takes an integer n and
Array value at each stage: Just replace the constant function 0: with the appropriate array valued constant function x"_ . Thus: h=: (i.2 2 2)"_ ` (2: + 3: * $:@<:) @. * h 0 0 1 2 3
In the J programming language: Oblique Road to Success! I think you put that very well -- and you also managed to point out where I had included some pointless code in my illustrations (on topics directly addressed by the dictionary!).
A nice example of the use of obl is in multiplying polynomials: +/ obl */&>/1 3 3 1; 1 2 1; 1 4 6 4 1 NB. (x+1)^ 3 2 4 1 9 36 84 126 126 84 36 9 1 NB. (x+1)^9
In J (B. Locating & Selecting), loc Kronecker delta of x and y.
d80=: =
In the J programming language: Trains: past, present and ... Anyways... I do not see how "beware of line wrapping" solves anything here. Not yet, anyways.
defines a0, a1 and a2, the next line is J's response ((`'')(((@:[)(&`))(`:6)))((`_)(`:6)) and the next line, av=. ((ar'a0')`) (`(ar'a1')) (`(ar'a2') ) (`:6)
In J: If the locale name is elided, it is assumed to be base.
abc__ NB. the same as abc_base_ 4
In the J programming language: special coding for stack operations Or are you trying to reorder your stack?
swap =: (<_2 _1)&C. swap ;: 'bottom middle top' +------+---+------+
Evaluating a Gerund Array Roger, Raul, Thanks. Raul's answer is essentially what I needed. And I now have Learning J Chapter 14 open in my browser . I am still unsure about a few things, hopefully someone can clear these up. 1. If I have my nxn gerund array and I want to evaluate it on a list of n items, such that the...
The request is similar to the question posed in the post an underground answer is also similar to the one posted in modified as follows: plus=. train o ([ , (<'+') , ]) STAR=. >@:((box <'*')"_) NB. * boxed asa=. (] amper STAR) at [ NB. amper star at ( vrb=. > o (box x (< o plus/ .(asa e)) ])f. ) >@:(<@:(,^:(0:``...
In the J programming language: (Also, shouldn't it be FormClosed event?)
jObject.Do("BINPATH_z_=: 1!:46 ''"); jObject.Do("ARGV_z_=: ,<'oleclient'"); jObject.Do("0!:0 <BINPATH,'\\profile.ijs'");
In the J programming language: memory mapped tab delimited file Oops. The previous code gives the first column. This is the corrected code, with the same assumptions as before but with more than 3 columns.
Ganesh - Thank you. That is very fast. It runs on 4 seconds on my machine with a 9 million row sample string. secondcolumn =. (0;st;(< tab;LF))&;: NB. Boxed list of the second column
In the J programming language: Complex builds with PM Chris, can you give an example of a pre- or postprocessor? I do not fully understand the idea.
You can put anything you like into pre and post-build. As an example, in your project, instead of including the target of the first project as a source to the other, you could create a post-build script that joins the dat=. (freads 'target1.ijs'), LF, freads 'target2.ijs'
Parse this J expression and provide the trace. mix=: ] (+"1/#~&(,/)1-+./ .*&:*"1/) [ {.~"1 0 (-@}. i.@>:)&{:&$
parenthesized: (mix =: ((] (((+ " 1) /) (((# ~) & (, /)) (1 - (((((+. /) . *) &: *) " 1) /))))) ([ (({. ~) " 1 0) ((((- @ }.) (i. @ >:)) & {:) & $)))) 4 Conj i. @ >: i.@>: 4 Conj - @ }. -@}. 7 Bident -@}. i.@>: -@}. i.@>: 9 Paren ( -@}. i.@>: ) -@}. i.@>: 4 Conj -@}. i.@>: & {: (-@}. i.@>:)&{: 4 Conj (-@}. i.@>:...
In the J programming language: Times Table Therapy ?0 1 2?_5 _4 _3 _2 _1 0 1 2 3 4 5? The result above is what I want. But?
f=: 13 :'(,>{.y)x,>}.y'
How do you do this in the J programming language? Boxing and Finding
a a is a b is not a c is a or not a a=: 0 : 0 a is a b is not a c is a or not a )
In the J programming language: Searching large text files What is the best way to search a 300MB text file for lines containing a specific string? I tried all the obvious ways, but I kept running out of memory. Do I really need loop over the file in small windows? Is there some elegant way to do this with boolean arra...
02/27/01 10:51a 382,673 Bayesian partitioning for classification and regression.ps 10/05/00 01:40p 339,134 Bayesian Multi-regression1.jpg 10/05/00 01:39p 474,201 Bayesian Multi-regression2.jpg 10/05/00 01:38p 333,918 NB. Take a look at a few of the lines... >2}.&.>getLine&.>10{.whlns NB. Drop CRLFs...
Simple and effective spelling corrector I?m using this program as an exercise in learning Perl6 (which, believe it or not, now has an official release date). I wonder though, how would it look in J?
If I have read his implementation properly, it works something like this: require'regex' countbigwords=:3 :0 NB. handle persistent data explicitly big=. tolower fread '~user/temp/big.txt' they=. ;:(' ' (I.-.big e. alphabet)} big) words=: ~.they count=: (#/.~ they),0 i.0 0 )
Parse this J expression and provide the trace. ]CELLDATA =: (4 3 $ 'AAABBBCCCDDD') ; 4 3 $ 'EEEFFFGGGHHH'
parenthesized: (] (CELLDATA =: ((4 3 $ 'AAABBBCCCDDD') ; (4 3 $ 'EEEFFFGGGHHH')))) 2 Dyad 4 3 $ 'EEEFFFGGGHHH' EEE FFF GGG HHH 2 Dyad 4 3 $ 'AAABBBCCCDDD' AAA BBB CCC DDD 9 Paren ( 4 3$'AAABBBCCCDDD' ) AAA BBB CCC DDD 2 Dyad 4 3$'AAABBBCCCDDD' ; 4 3$'EEEFFFGGGHHH' ┌───┬───┐ │AAA│EEE│ │BBB│FFF│ │CCC│GGG│ │DDD│HHH│ └...
In the J programming language: atop continues to puzzle me No, hence the words "seems arbitrary? in
] ; [: |: u at v d._2 _1 0 1 2
In the J programming language: olesetlic not working? pc test closeok; xywh 0 0 200 100;cc grid ocx:FPSpreadADO.fpSpread.3; pas 6 6;pcenter; rem form end; )
create=: 3 : 0 key=. '67 0 111 0 112 0 ... ' wd 'olesetlic FPSpreadADO.fpSpread.3 ', key wd TEST wd 'pshow;' )
How do you do this in the J programming language? verb building help - 3rd mailing
Dick Penny should try the ;.0 construction $x A=.a.[;.0~(a.i.'a'),:26
In J (26. Obverse and Under), multiplication using base-10 logs.
g=: +&.(10&^.)
D. Adverbs & Conjunctions In J: Adverbs that apply to a noun argument, and conjunctions that apply to one noun argument and one verb argument are commonplace. For example:
x (i.16) b. y NB. All sixteen Boolean functions 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
Unsupported conjunction I am currently on the nearly vertical J learning curve and am primarily interested in number theory applications. To that end I have been working my way through Iverson's "Concrete Math Companion" and have encountered a conjunction which no longer works in J601. That conjunction is [.
Another way is to learn about multiple verb assignment, which would render the above as similarly with R =: 2 : 'v' .
Verb rank In J: Let's see how this works when adding two tables.
a =. i. 2 3 b =. 6 + a a 0 1 2 3 4 5 b 6 7 8 9 10 11 a + b 6 8 10 12 14 16
After looking at J loops, and the "j for c++", i am wondering how to make efficient loops that do different things at different times. for the simplest example, you have a list of numbers, and two variables (e.g. a and b), and you will add one number from the list to the smaller variable a or b, and continue until you ...
will put back into a and b the final result when all the terms of c have been added in. 'a b' =. f ^:(2&<@#) ^:_ a,b,c
In the J programming language: string subtract Back in 2002 and 2004 there was a thread on this topic that I started with a request similar to yours. I called my verb "strike" rather than sub - but wanted the same thing.
ts'a strikeb2&(1000 ,@:# ,:) b' 0.001690735 844032 ts'a strsub&(1000 ,@:# ,:) b' 0.0059314179 1230656 0.0059314179 1230656 % 0.001690735 844032 3.508189 1.4580679 a (strikeb2&(1000 ,@:# ,:)-:strsub&(1000 ,@:# ,:)) b 1
loopless code I want to write some nice J code using $: instead of nasty for loops. Please help me.
In fact, I think it would be a fruitful discussion to compare and contrast the cases where we use: * " * / * ^:iteration_calculator * ^:condition^:_ * $:
How do you do this in the J programming language? Lint control key for J602
I will ponder whether I should suppress the assignment warning if no later errors are found in the definition, and no globals are published. y=. <;._2 (0 : 0) to a form not recognized as a noun-start, such as y=. <;._2 (0 : (0)) If you do that, you will get an error message on the multiple assignment, because lint ...
In the J programming language: 4 even digits and 4 places for them, so the rest must be odd (and 5 is taken)?
though the single filter operation outperforms "successive pruning" v3 =: ([ (] #~ 0 = |) (BASE10DIVbyINDEX {::~ [) +("1 0)(,@:) 10 * ])
Parse this J expression and provide the trace. ooze =. * (* >./) (_2 ]\ 0 0 1 0 _1 0 0 1 0 _1) |.!.0"1 _ ]
parenthesized: (ooze =: (* ((* (>. /)) ((_2 (] \) 0 0 1 0 _1 0 0 1 0 _1) ((|. !. 0) " 1 _) ])))) 3 Adverb ] \ ]\ 2 Dyad _2 ]\ 0 0 1 0 _1 0 0 1 0 _1 0 0 1 0 _1 0 0 1 0 _1 9 Paren ( 5 2$0 0 1 0 _1 0 0 1 0 _1 ) 0 0 1 0 _1 0 0 1 0 _1 4 Conj |. !. 0 |.!.0 4 Conj |.!.0 " 1 _ |.!.0"1 _ 3 Adverb >. / >./ ...
In the J programming language: Parsing Pythonish I'm defining the term outdent as a line that is indented less than its previous line.
(The second dimension is always 2, and the contained elements are in the second half.) Here's an example implementation: words=: <@(((a: ,:@;~ }.~);])(0 i.~' '=]));._2 blank=: <,:0;~i.0 2 parse=: [: value [: crate^:(<:@#)@> [: shift&.>/ blank |.@, words value=: 0 {:: , level=: >:@*@-&(1&{::) shift=: leave`group`enter@...
In J (A. Inverse), inverse halve; double.
m37=: *&0.5 I
In the J programming language: Euler Project #1 is:If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. In C/Java I could easily do something like: int total =0;
Here's a look from a mathematics perspective and sets: set=: 13 :'0 = x | y' ]A=:3 set 1+i.35 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 ]B=:5 set 1+i.35 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
How do you do this in the J programming language? matrix to boxed list (WAS: RE: JDB Utilities: Export to Excel)
[data=. |:><every each 1 2 3 4 5;'abcde';6 7 8 9 10 +-+-+--+
How do you do this in the J programming language? 13 : on control words
g=:13 : '-:`+:@.(2|y.)y.'
In the J programming language: Stumped by unboxing situation I feel a little stupid for asking for help with something probably so elementary that I'm missing it for some reason. I've done lots of switching between boxed and unboxed data in the past, but this one's got me stumped. I would have attached the 28K data fi...
;a2 datatype;a2 literal $@> a2 I think what you want is: a3=: _&".@> a2
In the J programming language: Several questions about j Are verbs ( dyad or monad) first-class citizen in j? Is it possible to forward a verb to another verb? Is it possible to box a verb into list ? Is it possible to have a dictionary like the case in kdb? Something like : (`a`b`c)!(1 2 3)
I'm not sure how to answer your questions. A gerund is a boxed noun that contains a verb or list of verbs, created by using ` gerund =: +`-`multiply`divide
In the J programming language: Adverbial Tacit Jym *>* JAL addon to collect all these utilities. A sample follows together with an updated *>* I find useful. What do they do? *>* _5 From *>* _3 From Left
*>* v0@:[ v1 v2@:]
In the J programming language: wiki essay it really kill you to add a letter or two? Not to mention the extra difficulty of searching for single-letter names...
Here are some more fun examples: o =: +/ . *
In J (A. Permutations), permutation x to the power y.
m19=: pow=: {^:(](i.@#@[))`
J way of adding lists In J: But the J + handles both these cases the way you would like, and would expect!
1 + 2 3 4 3 4 5 2 3 4 + 1 3 4 5
In the J programming language: Can you turn this into a sequence that I can use to reproduce the error?
Sometimes it fails on the second-to-last line but, so far, by the last one 5 out of 5 times. d=: 4 : '''pensize 3'' plot ;/ |: 2{."1 x points/\. 0,~ |. ($~(4*x)*#) y' points=: 1 : '((4*m)|[+{:@]) ,~ (2&{.)@] + (3 : ''|:(,:y|.])(,-)}:y-|i: y'' m) {~ (4*m)|[+{:@]' 90 d 7 13 270 9 29 290 90 d 7 13 270 9 29 240
In the J programming language: Sequence Matching I have a vector of integers named 'aa', that could be millions of integers long.
Now given 'aa' as described in my previous post, I need a verb 'match1' that will find all the 'n' length vectors in 'aa' that occur again in 'aa', and list all their index locations. aa =: 2 3 4 5 4 3 2 5 6 7 6 5 4 3 2 3 4 5 4
In the J programming language: Mac 64 available But of course it shouldn't be expected to under j32, because (2^59)-1 is not represented exactly ...
179951 * 3203431780337 NB. This is really paranoid! 576460752303423487 zzz=:179951 * 3203431780337
In the J programming language: Web Service Client? Can you privide a few representative code samples what you are doing?
element_set_text ae;e;'Yahoo Demo';an element_set_text qe;e;'finance';qn NB. make the call NB. retn =: svc_client_send_receive c;e;rn call =: 3 : 0 try. retn =: svc_client_send_receive c;e;rn catch. smoutput 'error occurred' end. )
How do you do this in the J programming language? Splitting an integer into its digits
IOW a one-liner for special would be: = +/@(+ !)@(10&#.^:_1"0)
In J (C. Special Matrices & Lists), " but not for y=0.
m34=: +./"1@=@i.
In the J programming language: a conspiracy against APL and other languages ?! Good luck. The anti-commercial Nazis are pretty dominant on Wikipedia. The link to kx.com that I put there for K
id`(($: o selectLEfirst),first,($: o selectGTfirst)) choose notEmpty selectLEfirst=: (rest <: first) selectFrom rest selectGTfirst=: (rest > first) selectFrom rest quicksort=:
Multidimensional Root Finding with Newton Solver J looks very interesting. I have no previous experience with array languages and, being curious, started to experiment. Now, I would like to solve a system of non-linear equations. I could only examples solving single equations like this one:
You don't say whether you are a mathematician (in particular a functional analyst) or an engineer. Whichever it is, you'll either be baffled by, or scornful of, the code in CAL.ijs. are nowhere near as pretty as: N=: 1 : '- u % u d. 1'
In J, show an example of B. Partition.
x=:1 1 0 0 0 1 0 0 1 1 y=:3 4 8 2 5 6 9 4 5 4 x +/ ;. 1 y 3 19 19 5 4
How do you do this in the J programming language? Limit from the right
Raul, I have modified your adverb lim as follows: ) NB. 0.159154943091895 (_4 0 1&p.%_2 1&p.) limr 2 4 NB. 4 (1&o.%]) limr 0 1 NB. 1
In the J programming language: Detecting special products The number 720 is special: it is 8*9*10 the product of three successive non-negative integers. The first few special numbers are
(] = (^&3 - ])@:(1r3 >.@^~ ])) 990
In the J programming language: monad vs. dyad I'm trying to write a monadic function that will take a number, create a list of that number times 1..6, with each number's characters sorted, and return whether they are all the same. So f 17 would look at the list 17 34 15 68 58 012 and return 0. Here's my closest attemp...
The number of "each"es can be reduced as follows: =/@:(/:~ each)@:(": each)@:(<"0)@:((>:i.6)*])
In the J programming language: but it occurred to me that this might cause confusion if the name x had different semantics on either side of the assignment; in particular, if the two are in different locales. Try the following:
The last line should have returned 0. x_z_ =: 1000000 # 0 x =: 1 (42}) x +/x 1 +/x_z_ 1
In the J programming language: So far, Roger's solution for counting the divisors of any integer using __ q: seems the most efficient.
factors=:,@>@(*/&.>/)@(<@(1,*/\)/.~)@q:
Announcing: dissect, the 2-D J sentence analyzer; and request for a collaborator Yes, I meant J7/GTK. As I understand it, grid requires GTK (if not, I could try to do what's needed to run grid without GTK).
Henry, You may find this interesting. I was just experimenting with your ds in this script: load 'debug/dissect' a=: 0 : 0 a is a ?b is not a c is a or not a )
Files In J: Let's assume you had a numeric table that you wanted to write out as text file.
numtab =. i. 4 5 numtab writefile fn |domain error | numtab writefile fn
In the J programming language: Solving Maths with d. I don't know the best way to solve it, the method I employed was to do: define
Not infinity but still can be used to validate +/ ( (2^~]) % 2&^) i.1e5 6
How do you do this in the J programming language? Is there a way I can let J know what the sparse element ought to be for the result of a boolean comparison?
element should be e and 8$.y to "remove" the sparse items. However, both of these are "after the fact". You should avoid dense f sparse and sparse f dense if you want to keep everything sparse. t 0 &#9474; 1 1 &#9474; 1 2 &#9474; 1 3 &#9474; 1 4 &#9474; 1 ... q=: 8 $. (3;1) $. t 7!:5 ;:'t q' 5243072 320
In the J programming language: Removing annihilating pairs Maybe the specs assume an even number of items?
This has enough special cases in it that there's probably better approaches... an0=: #$2#0~:_2 +/\ ] fix=: ^:(1<#) an1=: ({.,(#~ an0)@}.@}:,{:)fix@(#~ an0)fix an2=: [:an1&.|. an1^:_
In the J programming language: Floating from On Sun, Jan 23, 2011 at 3:33 PM, Marshall Lochbaum <> wrote:
I think you can do something like mult=. (*/~ ([: (,-.) (-<.))`((,1)"_)@.(=<.))/ x
In the J programming language: Question regarding locales Why do I start getting the 'locale error' message - what am I doing wrong?
It looks like you are not allowed to create a new numbered locale with a number lower than any previously-created numbered locale. w__a | w__a a=.<'8888890' NB. but I can go forward to 8888890
In the J programming language: Plotting a 3D Ellipse And I don't get anything like a ellipsoid. Here's what I get... What is going wrong?
There's other ways of doing this, but basically you're working with a root-mean-square type of equation. rest=: ((x%a)^2) + (y%b)^2
Statistical Functions The tutorial is quite good, and the included statistics package is particularly useful for university-level statistics courses, and it is much less costly (free) than SPSS ($1200), which is the standard statistics package for many graduate-courses. However, the J code was written for J 4.06, so t...
NB. Analysis of variance wsqs=: ([: *:+/) % #
How do you do this in the J programming language? Recursive programming (and scoping therein)
Raul, The shorter version ii also gets a domain error using trace. hh=:[: < [: (^ ([: i. >:)) > ii=:[: < (^ ([: i. >:)) hh 6
What does this J code do? @ can ever be realised with [: , that is [:+/[:*:- can only mean +/@:*:@:- and cant be twisted to mean +/@*:@- . I now hold my breath
and wait for these some of these bright young minds to jump in and put me right!
Ups! I meant to run the script on an official version but I ended up using a Jx interpreter. Anyway, it runs on an official J interpreter:
That is, this sentence produces (illegally :) ) a noun made of boxed verbs. My guess is that you had predefined N, A or B as a noun(s). Try running the script on a fresh session or erase N, A, and B beforehand. train=. (<'`:')(0:`)(,^:)&6 NB. For compatibility with an official J an=. <@:((,'0') ,&< ])
In the J programming language: multiplicative inverse in a finite field gives us the inverse of k with respect to multiplication modulo p?
However, not very efficient on larger numbers: For prime p generates all inverses of 1,2,...,p-1: ,@(](]#~ 1:=[|*/~@])}.@i.)37 1 19 25 28 15 31 16 14 33 26 27 34 20 8 5 7 24 35 2 13 30 32 29 17 3 10 11 4 23 21 6 22 9 12 18 36
What does this J code do? canon=: {{ rtrim {. (/: +/@p:@I.@,"3) rotall trim y }}^:2
Finally, I want to work with all polycubes of a specific order, and to get larger batch I can use;
How to write a text file without trailing blanks I need to write out a text file with variable length lines and no trailing spaces. I can do it externally with sed but I'd prefer do it the J way.
This has rows padded with trailing blanks: $A=: ,"2 > rows 4 5
How do you do this in the J programming language? Another beginner's question
you must put parentheses around the definition. If you are replacing a verb ir =: i. $ with its definition,
In J (F. Geometry), volume of simplex in n-space (fixed).
m27=: Vol=: Area f.
In the J programming language: Random distribution Maybe show some valid vectors for small Q?
amend_z_ =: 2 : 0 NB. v is n or verb that will eval to n} s=. v"_ y (u (s{y)) (s}) y : s=. v"_ y NB. May change to x v"_ y (x u (s{y)) (s}) y )
Parse this J expression and provide the trace. div5=: /:~ @: , @: > @: (*//&.>/) @: ((^ i.@>:)&.>/) @: (__&q:)
parenthesized: (div5 =: ((((((/: ~) @: ,) @: >) @: ((((* /) /) &. >) /)) @: (((^ (i. @ >:)) &. >) /)) @: (__ & q:))) 4 Conj __ & q: __&q: 9 Paren ( __&q: ) __&q: 4 Conj i. @ >: i.@>: 7 Bident ^ i.@>: ^ i.@>: 9 Paren ( ^ i.@>: ) ^ i.@>: 4 Conj ^ i.@>: &. > (^ i.@>:)&.> 3 Adverb (^ i.@>:)&.> / (^ i.@>:)&.>/ 9 Par...
In the J programming language: How can I generate the following result extended 50 times, without explicit looping?
NB. more readable ... deal6=: 6&? linkr=: [ , <@] NB. similar to ; ... but boxes the the right side only NB. Explict> applytofirst =: 1 : ' u@:>@:{. ' APPLYTOFIRST=: @:(>@{.) fnpower=: ^:
How do you do this in the J programming language? Matrix Multiplication Question
sd=: (];+/"2)@+.*~
In the J programming language: The only difference between the correct and the incorrect result is a space before the second : . Should a space make a difference ever? In the correct result I can't understand what it is, what it does and why it does it.
I find this helpful to see differences: ?? @ ??? ": ?? &. ??? >
In J (F. Geometry), area of rectangle.
m0=: Ar=: */
How do you do this in the J programming language? Forked process in J7: child output appears in parent
NB. However, in J7: '(0 0 $ 1!:2&2) (6!:0) i.0' fwrite flnm=. 'testSpinOff.ijs' 25 JEXE=: '"c:/program files/j701/bin/jconsole.exe" '
How do you do this in the J programming language? Least squares on a matrix?
FitData =: k * ^(-((*: (x-x0)) % (2*(*:width)))) NB. Form
In the J programming language: Yes, your par2 is MUCH faster than Raul's nparts. If I have some time, I will put together a time/space test for all the proposed solutions.
I analysed Esa Lippus solution. The printout is long, but here is the code and my explanations. ) sort=: /:~ 3 par2 5 x=:3 y=:5 NB. All combinations of y elements [a=:(y#x) #: i. x^y NB. Select the combinations in which the y elements NB. are distributed over x buckets [v=: ((x=#@~."1 a)#a) NB. Pack the elements in ea...
for one easy way to play with Knuth's up arrow notation in J.
I would left a gramatically correct version as an exercise ;) ,^:(0:``:)&6@:((<@:((,'0') ,&< ])@:x:@:(1&{) <@:(,^:(0:``:)&6)@:, ((<;:'&*') , (<(<,'&'),<<(,'0');1) $~ 2 -~ ])@:(0&{)) , <@:((,'0') ,&< ])@:(2&{))
Is there a J routine to construct magic squares of side n?
I haven't tried this in a while but here is one method from an APL book transcribed into J NB. rotc - rotate the elements in their respective columns. NB. there is no way to tell J to specifically operate on NB. the columns individually so you need to use the NB. transpose op. (|:) to turn the columns into rows by NB....
In the J programming language: Looking inside the color cube Here's a way to look inside a 5x5x5 color cube. There are 125 colors. Any ideas to do it more simply or in a better image? load 'viewmat'
LYELLOW=:(i.5){"2 YELLOW
In the J programming language: The following changes make Chris Burke's script act that way for me. You'll have to repair it so that it works on the mac. (Start with Chris Burke's script which he posted this morning.)
doit=: 3 : 0 glrotate 2 3 5 startlist LRotate stdrotate'' endlist'' stdpaint'' )
Cut Question Playing with J for C and got to "Apply On Specified Partitions: Dyad u;.1
it applies each rank 2 of the numeric left argument, so you get a 2x2 starting at position (0,0) for the first left-hand matrix and a 3x3 starting at position (1,1) for the second. ((0 0,:2 2),:1 1,:3 3) <;.0 i. 4 4 +---+--------+ |0 1| 5 6 7| |4 5| 9 10 11| | |13 14 15| +---+--------+
In J (B. Locating & Selecting), delete leading blanks.
m143=: +/@(*./@(' '&=)) }. ]
In the J programming language: SDL2 integration under Jqt For me, I have settled for being able to stop the event loop, edit the code then resume the event loop where I left off and that's working well for me.
sdleventhdlr =: 3 : 0 NB. Look for a quit event and call sdlfullquit and exit NB. Stop the timer while we process (it avoid forever errors) wd 'timer 0' while. 0 ~: SDL_PollEvent <<ev do. evtype =: {. 0 (3!:4) memr ev,0,32 NB. smoutput 'evtype = ',":evtype if. evtype = SDL_QUIT do. NB. quit and return timer stays off s...
Parse this J expression and provide the trace. >e. E. i. i: j. L. o. p. p: q: r. u. v. x: _9: _8: _7: _6: _5:
parenthesized: (> (e. (E. (i. (i: (j. (L. (o. (p. (p: (q: (r. (u. (v. (x: (_9: (_8: (_7: _6: _5:)))))))))))))))))) 5 Trident _7: _6: _5: _7: _6: _5: 5 Trident _9: _8: _7: _6: _5: _9: _8: _7: _6: _5: 5 Trident v. x: _9: _8: _7: _6: _5: v. x: _9: _8: _7: _6: _5: 5 Trident r. u. v. x: _9: _8: _7: _6: _5: r. u. v. x: _...
In the J programming language: Partition by Contiguous Runs According to a Property I am sure this has been asked and formulated somewhere else. I don't know what the name of it is.
That said, I think you might be looking for something like this: F=: {{</.~ +/\@(1,2~:/\])@:u}} <&0 F _1 _2 0 1 2 _1 4 5 _6 +-----+-----+--+---+--+ |_1 _2|0 1 2|_1|4 5|_6| +-----+-----+--+---+--+
In the J programming language: Length errors when getting multiple columns from array I'm also not sure why your implicit loop, 2 4{."1 , works while mine didn't. Is there somewhere in the dictionary/NuVoc that explains this?
and Here's a few exercises which might help: 2 *&> 3 4 6 8 <&.>3 4 +---+---+ |+-+|+-+|
C. Specimens In J: Random arrays can be produced by expressions of the form ? 2 3 4$10, but for repeatable experiments it is necessary to use a specific random seed, as provided by the function ?., and in any other phrase that uses it. For example:
(QA&'A' ; QA&'a' ; QA&'+') 2 3 4 +----+----+----+ |DTLN|dtln|.>68| |FBRR|fbrr|0,<<| |YJNV|yjnv|C48@| | | | | |ABNR|abnr|+,8<| |AJBK|ajbk|+4,5| |RPYW|rpyw|<:CA| +----+----+----+
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
13