up 1 _1 2 _2{~1?.@#4'
0.0219618 395264
ts'ddup 1 _1 2 _2{~10?.@#4'
0.2124874 3147776
Jasmin's solution is far too slow
ts'(delitemG~ 2, 0 i.~ 2&(+/\))(^:_) 1 _1 2 _2{~1?.@#4'
1.2363434 1585408
Thanks for all the contributions
R.E. Boss
> --
Not particularly J-ish, but (array-shuffling aside) linear solution:
s=: ,`(1}.])@.(= -@{.)/
s 1 _1 2 _2{~100?.@#4
2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2 _2 _2 _2 _1
_2 _1 _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2
Since the reduced form of the input list is unique,
If the answer to Jimmy's question is no, then the uniqueness of the resulting
array has to do (surprisingly) with free groups
(https://en.wikipedia.org/wiki/Free_group).
Indeed we can view a vector of numbers as a word over the alphabet [0,∞) of
positive real numbers (where negative numbers / ze
>>> there many times."
>>>
>>> We say "I lie down for a nap. I lie down, I lay down yesterday, I have
>> lain
>>> down..."
>>>
>>> the rest of the sentence was drowned out by cries of "No!". They had
>>
I believe that as Devon said the subarray selected by m in x m} y must not
contain any fill elements, which isn't the case of your example as in its case
the first element of m specifies a length 4 vector while the other two elements
specify length 2 vectors. This leads to a 2 by 2 matrix of fil
Just to correct a mistake that I always hate making:
"... for use after _its_ application ..."
Sorry for the noise,
Louis
> On 21 Nov 2019, at 03:49, Louis de Forcrand wrote:
>
> (a,a=.?@#) is a verb, namely (?@# , ?@#). In this expression a is set to the
> _verb_ ?@# a
(a,a=.?@#) is a verb, namely (?@# , ?@#). In this expression a is set to the
_verb_ ?@# and then train (a,a) is evaluated.
In the second case a is set to the _result_ of ?@# and then (a,a) is evaluated.
To do this tacitly:
(] , ]) @ (?@#)
or more concisely
,~@?@#
or equivalently (how I would
A simple use case which resembles the German-English dictionary is to implement
variable-value bindings in a small interpreter. I've run into this many times
in what I've been doing lately.
Cheers,
Louis
> On 18 Nov 2019, at 19:38, Raul Miller wrote:
>
> Dictionaries might provide a useful op
Another (possibly lighter on memory) approach:
~. ; (#:i.2^4) <@(10 #. i.@!@# A. ])@# 0 1 2 6
Cheers,
Louis
> On 21 Oct 2019, at 01:09, Skip Cave wrote:
>
> Is there a less-verbose way to list all the integers (one-digit, two-digit,
> three-digit, four-digit) can be formed by using the charac
If this makes it any clearer, here is an implementation of /. key:
key=: 1 : 0
=@[ u@# ]
)
where = self-classify can itself be defined as
sc=: ~. -:"_ _1"_1 _ ]
Cheers,
Louis
> On 14 Oct 2019, at 21:26, Raul Miller wrote:
>
> I'm not sure what you mean, but consider:
>
> 'abcba' +--+--+
I am missing something:
a == 0 iff popcnt(a) == 0, so indeed
a == 0 || b == 0
is equivalent to
popcnt(a) == 0 || popcnt(b) == 0
which can be written as
!(popcnt(a) && popcnt(b)),
but if this is translated into a single-branch sequence of machine
instructions, then wouldn’t
!(a && b)
be as well?
T
Do we have access to an instruction which counts leading zero bits?
Interesting problem,
Louis
> On 28 Jul 2019, at 19:51, Henry Rich wrote:
>
> Many of the members of this Forum will remember the days of assembler language
>
> ...and who could less than merry be
> when writing out BXLE?
>
Quick correction: the answer given by Pascal is not 1019 but P(2166)-P(1019),
and my email should use that instead of 1019 wherever it is mentioned.
Sorry for the noise,
Louis
> On 14 Jul 2019, at 01:58, Louis de Forcrand wrote:
>
> I’m with Skip here: how do y’all guarantee that y
I’m with Skip here: how do y’all guarantee that your brute-force answers (which
search through a list of the first few pentagonal numbers) actually return the
pair with the smallest _difference_? How do you know there isn’t a pair outside
your search range, where each number in the pair is much
Hi Daniel,
If the ravel indices into the array M are stored in I, the multi-dimensional
indices are then
($M) #: I
So for your toy example a possible verb is
v=: $ #: , I.@:= _1:
Cheers,
Louis
> On 12 Jul 2019, at 02:11, Daniel Eklund wrote:
>
> Double thanks.
>
> One for that sparse arra
joined)#y
> )
>
> On the other hand, I appreciate that your solutions are very general,
> thank you for shedding the light on correct path. E.g. "P" can be
> easily replaced to test for unordered subsets instead. Then another
> dilemma, whether repeated part numbers ar
Hi again,
I’m back with a speedier solution.
comaxs is a conjunction, and if P is a boolean-valued dyadic verb and L any
monadic verb on the items of the array A, P comaxs L A does the following:
P and L are supposed to represent orderings on the elements of y. P represents
a partial order, suc
. Thank you so much. I'm not yet comfortable with defining
> my own adverbs, and you show me constructs like "&.(B&#)" are
> possible. That will keep me busy for a while. One thing though, what's
> definition of "mxs3"?
>
>
>> On Sun, Ju
s per second, even though it will produce
> wrong answer:
>
>
>(6!:2) '1&= +/"1 lines1000 ((>@:[)(+./@:E.)])"0 _ ;lines1000'
> 0.013242
>(6!:2) '1&= +/"1 syms1000 ((>@:[)(+./@:E.)])"0 _ ;(,&(s:'' ''))
Hi,
Try this:
maxs=: 1 : 0
for_i. i.-#y do.
if. (i{y) +./@:u (<<
fast=: cmp maxs NB. fast
fstr=: fast@(\: #@>)NB. faster?
maxs is a generic adverb that takes a boolean-valued verb and an array.
The verb represents a partial order on the elements of the array, and maxs
returns the
0 0 0 0|
+-+---+
Sorry for the extra noise!
Louis
> On 5 May 2019, at 17:25, Louis de Forcrand wrote:
>
> Hi,
>
> Not exactly an answer to the question, but rather a cute way to pad an array
> of any rank using a cool feature of ;. cut that I ran into today.
> From the dictionary
Hi,
Not exactly an answer to the question, but rather a cute way to pad an array of
any rank using a cool feature of ;. cut that I ran into today.
From the dictionary:
u;.0 y applies u to y after reversing y along each axis; it is equivalent to (0
_1 */$y) u;.0 y .
Using this:
padop=: &((+
If you mean a textual representation of the array y, check ": .
Otherwise if you want something like this
var=: i.3
'var' -: v var
1
then I doubt that such a v exists.
Cheers,
Louis
> On 3 May 2019, at 12:58, Piet de Jong wrote:
>
> If m is the name (ie string) of a variable then ‘m'~ i
This subject regularly pops up every now and then, and it reminds me of
something I wrote a little while back that might interest you. I found a couple
of errors in them (oops) so I’m copying them here in hope that they are of help
to you. They aren’t pretty or succinct but they work. (Code at b
Sorry! Misunderstood / read too fast.
Devon’s using expand is the way to go. Does this do what you want?
]t=: 0,.#:0 14 14 0
0 0 0 0 0
0 1 1 1 0
0 1 1 1 0
0 0 0 0 0
(,t) #inv ,10+i.2 3
0 0 0 0 0 0 10 11 12 0 0 13 14 15 0 0 0 0 0 0
Hope this is better,
Louis
> On 27 Apr 2019, at 17:31, Bria
Hi,
From the dictionary page on # :
The complex left argument a j. b copies a items followed by b fills.
Also from the dictionary, we get that #’s rank is _ 1 _, so we can suppose the
left argument is a vector. In that case each atom of the left argument must
match an item of the right (scalar
f=: |.~ 3 : 0
... (explicit code here)
is simply a hook which acts the same as
g= |.~ t
t=: 3 : 0
...
I was also very surprised to see this could be done the first time I ran into
it!
Cheers,
Louis
> On 17 Feb 2019, at 13:03, R.E. Boss wrote:
>
> I am embarrassed to admit I don't understand
A possible version of the signature verb:
sig=: |.~ >:@(# -~ {: i. 1:)@min
min=: (_1 |. ] #^:_1 (= <./)@#~)^:(1 < +/@])^:a: 1"0
Perhaps not the fastest version, but it’s light on memory.
Cheers,
Louis
> On 13 Feb 2019, at 18:52, Roger Hui wrote:
>
> Yes, well, left as an exercise for th
Hi,
This is very similar to what you’re doing (you have to transpose the result to
get exactly what you want):
AC=: ({.~ -@>:@#) {~ #\ *"1 [: #:@i. 2 ^ #
|:AC 'PNDQ'
DD DD DD DD
Q Q Q Q Q Q Q Q
This one is quite cute if you don’t care about the ali
Hi,
R. E. Boss’s thread gave me an idea for an interesting problem:
Given two vectors v and s of the same length, find the permutation w of v such
that
((s=x)#w) -: /:~(s=x)#v
for any scalar x in s.
I have two solutions; the first is more obvious and relies on the key adverb
and boxing, where
> On 12 Dec 2018, at 17:26, R.E. Boss wrote:
>
> Foo=: (\: %)
Very nice! Here’s mine:
Foo=: /: <&0 ,. ]
Cheers,
Louis
--
For information about J forums see http://www.jsoftware.com/forums.htm
You must have wanted to write
taher2= 13 : '%: (S2 y) * */ (S2 y) - y'
instead of
taher2=: 13 : '%: (S2 y) * */ S2-y
Cheers,
Louis
> On 6 Sep 2018, at 09:26, Linda Alvord wrote:
>
> I got a domain error. Is this right (in a complex plane)?
>
>
> S2=: 13 :'-:+/y'
>
> taher2=: 13
I sent this message earlier today, but it seems that I used the wrong email
address. I didn’t find it in the forum archives; sorry if it comes in twice.
I see that most of what I said has since been covered by Mike.
~~~
I would’ve done it this way; the semi-perimeter is n
Hi,
If I understand your wording, you would like to generate n “multisets” of 6
random numbers which sum to 172. I say multiset because I imagine that order
doesn’t matter, but that multiplicity does (so numbers can be repeated).
If speed is a concern, then you could generate all possible multi
I don’t know if this is the right place for this, but I just read through the
beginning of a few sections, and looking at the one on groups I found the
mathematical definition of a group kind of peculiar, in particular point (c):
« every element e has a left and right inverse, that is there are
Since you have an even number of verbs in your train (1 and 2 are parsed as
constant 1"_ and 2"_ verbs) the whole is interpreted as a hook, with the
leading +/ taking its dyadic form. Your smodd1 verb is (in its monadic form)
equivalent to
] +/ 1 + 2 * i.
Since you want to apply +/ to the resu
solutiuon here:
> https://oeis.org/A211378/a211378.hs.txt
> In that file there are the ids of various Sloane Number sequences for
> Goodstein Sequences, just
> in case you wanted to verify your solution.
> e.g.
> A056193
> A222117
> A059933
> A211378
>
> Thanks,
&
Hi,
This is my tacit version. Not claiming speed (or anything in the way of code
legibility for that matter). The important verb is hbi, hereditary base-x
incrementation of y used in creating the Goodstein sequence.
My gs verb uses a starting base of 2, and gss starts with base x:
hbi=: ([ (] +
Hi,
Not a general answer about gerunds or tacit conditionals, but a particular
solution for seq:
seq=: [ + (* * i.@>:@|)@-~
3 seq 7
3 4 5 6 7
3 seq~ 7
7 6 5 4 3
Cheers,
Louis
> On 6 Apr 2018, at 22:23, Devon McCormick wrote:
>
> Hi -
>
> I'm working with selecting sequential items
Hiya,
rc=: i.~ (] - {) /:@/:
rc 1 2 1 1 2
0 0 1 2 1
Cheers,
Louis
> On 28 Mar 2018, at 20:32, Joe Bogner wrote:
>
> I think this is an easy one but it's escaping me. How to calculate a
> running count of an item in a list?
>
> runct (1,2,1,1,2) -: 0,0,1,2,1
> runct (5,6,5,5,6) -: 0,0,1,
Yes that is correct; u"n M always divides up into cells formed by grouping the
last n dimensions together. Another way to see it is that elements of the array
M who have the same (#$M) - n first indices are grouped together.
A variant on u"n M is "(-n), which is roughly equivalent to u"((#$M)-n)
Try <.@%: .
I believe it returns extended results on extended arguments.
Cheers,
Louis
> On 27 Feb 2018, at 20:56, Don Kelly wrote:
>
> I agree with the series approach but the final result depends on division
> which has limited accuracy. I would suggest using the following which uses
> 100*
I believe you are looking for raze ( ; ).
Cheers,
Louis
> On 18 Feb 2018, at 10:02, Arnab Chakraborty wrote:
>
> Hi,
>
> I have a list of boxes like
>
> m=. 1; 2 3 5; 4 5
>
> All the boxes contain lists whose items have the same shape. So it is
> meaningful to make a combined list, eg co
ich could have matched original
> expression you were referring to.
>
> Thanks,
>
> --
> Raul
>
>
>> On Mon, Jan 29, 2018 at 12:39 PM, Louis de Forcrand wrote:
>> Yes, typed a little fast.
>>
>> sqrt33 = %:33.
>>
>> Why does i
oots of the
>> polynomial corresponds to even k and the other to odd k.
>>
>> Thus (with J’s ^. log)
>>
>> x = 2 ^. (sqrt33 + (-1)^k)/2
>> y = k*Pi/log2
>>
>> for any integer k describes the (countable) set of solutions.
>>
>> They
I would recommend using D. instead of d. in general for more complicated or
explicit verbs. (lower case) d. assumes your verb is a scalar verb and tries to
perform a symbolic differentiation on tacit verbs only, while D. differentiates
numerically.
Not all verbs can be differentiated with d., b
.
They are indeed arranged in a zigzag pattern on two vertical lines, and the one
real solution occurs when k = 0.
Cheers,
Louis
> On 29 Jan 2018, at 08:09, Louis de Forcrand wrote:
>
> Note that if the equation really is (in traditional notation)
>
> 4^x - 2^x - 8 = 0
>
Note that if the equation really is (in traditional notation)
4^x - 2^x - 8 = 0
then it can be rewritten as
y^2 - y - 8 = 0, y = 2^x
and solved in closed form as well,
yielding a countably infinite set of solutions aligned along one (or two)
vertical lines in the complex plane.
(If I am not mi
Since Newton-Raphson is mentioned, I’d like to throw in (even though it might
be mentioned on the wiki page) that
VN=: 1 : 0
- u %. u D.1
)
is a kind of holy grail.
It can iteratively find roots not only of complex scalar functions, but also
complex vector and even tensor functions I belie
You could try something with the polygon plot type. Assuming you have two sets
of points, one for the top curve and one for the bottom curve, each in the
usual form (xcoords;ycoords):
'poly' plot bot (, |.)&.> top
might do something interesting.
There may be other options like for opacity etc.,
vec3=: [: ((* {.)~ , {:@[)/ 2 1 o.~/~ ]
In the end though the most readable is probably Bo’s. No distracting array
tricks.
Louis
> On 7 Jan 2018, at 02:26, Jimmy Gauvin wrote:
>
> This might be easier on the eyes:
>
> vc=:_2 */\ 1 2 1 1 2 o. 5 $ o.
>
> vc 1.25,_0.55
> 0.110616 0.698401
Obviously nobody would ever enter
if. 0 > _.
them self. I guess if primitives never produce _. then we need not worry about
it; but in the very slight off-chance that a bug lets one slip through,
wouldn’t it be safer if an error is thrown?
Anyhow, this topic’s problem is solved; gotta stay up to
rgument and spend no time worrying about
> it.
>
> Henry Rich
>
> On 12/29/2017 10:50 PM, Louis de Forcrand wrote:
>> Sorry for not trying this in j806, I should install it on my Mac.
>> Will update.
>>
>> As for control structures treating _. as false, I was
because _. is not equal 0 so that
> the condition is true.
>
> What is your code that treating _. as false?
>
> Also on my J806 linux64
> 2 7 p.1e308j_
> _j_
>
>
> Пт, 29 дек 2017, Louis de Forcrand написал(а):
>> What about control structures treating _. as false?
&
gt;
> Henry Rich
>
> On 12/29/2017 6:06 PM, Louis de Forcrand wrote:
>> On the Indeterminate vocabulary page of the dictionary it is written
>>
>> The only ways to create _. are as follows:
>> direct entry of _.
>> ".
>> 3!:n
>>
On the Indeterminate vocabulary page of the dictionary it is written
The only ways to create _. are as follows:
direct entry of _.
".
3!:n
DLL call (database, LAPACK, etc.)
and
Primitives on arguments not containing _. signal NaN error instead of producing
_. .
Hi,
Does anyone know how to save a viewmat image to disk, and if so, how to chose
the resulting image’s size?
Thanks,
Louis
--
For information about J forums see http://www.jsoftware.com/forums.htm
I believe you can easily plot points in 3D space with lines betweens pairs of
points:
require 'plot'
plot (; 2&o. ; 1&o.) i:10j100
Cheers,
Louis
> On 28 Oct 2017, at 15:12, 'Skip Cave' via Programming
> wrote:
>
> Thanks to Raul & Esa for their very clear instructions and examples for
> plot
I’ve been trying to simply count solutions. The best I could do is with the
prime decomposition powers.
Say we want to find the number of unordered solutions to
n = */v
solving for vector v where n is a scalar, and both are non-negative integers.
Let p=: {: __ q: n.
Then we need to “partition” t
Otherwise if you just want the plot package I believe the following works:
load ‘pacman’
‘install’ jpkg ‘search’ jpkg ‘plot’
You could make sure that ‘search’ jpkg ‘plot’ brings up only one result.
Louis
> On 19 Oct 2017, at 20:02, Raul Miller wrote:
>
> I think I would try:
>
> install'al
Maybe he didn’t understand your original question?
In any case it seems you could use a lesson in good manners.
Louis
> On 8 Oct 2017, at 10:58, Erling Hellenäs wrote:
>
> Many people here have a habit of giving long lectures to people about things
> they already know to make it appear like t
Here is another approach using __&q: to generate only unique factors due to
their unique prime factorisations:
factors=: (*/ . ^ [: |:@:>@,@{ <@i.@>:)/@(__&q:)
Cheers,
Louis
> On 3 Oct 2017, at 12:23, Erling Hellenäs wrote:
>
> Hi all!
>
> a=: 2 5 7
> f=: 1 :'/:~ (#: }. i.2^#y) u@# y
Beyond wether these tests are useful or not, you should run "ts" with a left
argument, as a single run which lasts only 0.1 seconds can be somewhat
imprecise.
ts's left argument n is the number of times to run the string of code, and its
result will be the total time elapsed divided by n.
Cheer
That's what I understood from the J dictionary, NuVoc, and personal experience:
$: refers to the *largest, unnamed, tacit* verb containing it. And by "tacit"
here I mean in the same "colon-level" as the $: in question.
For example:
In
$: @ (3 : 'y')
$: refers to the whole verb.
In
3 : '$: y'
it re
I don't really understand what you wish to add either, Erling.
If you want to use explicit J syntax, you could write an explicit verb.
You write:
> Particularly to create what you most commonly need, a sequence of
> monadic verbs, each acting on the result of the verb to the right.
> Well, it is
You could compress twice:
drng=: {.@[ (<: # ]) {:@[ (>: # ]) ]
Perhaps faster on large data?
You could reorder and filter out the data under the lower bound first if your
data is usually smaller than it to speed up the verb.
Louis
> On 24 Sep 2017, at 22:37, Joey K Tuttle wrote:
>
> Yes, my
rob=: {: ,~ ({.[:`'') ,@,. }:
g=: %:`*:`+:
g
+--+--+--+
|%:|*:|+:|
+--+--+--+
rob g
+--+--+--+--+--+
|[:|%:|[:|*:|+:|
+--+--+--+--+--+
(rob g)`:6]5
10
"rob" transforms your gerund into a suitable train. You can then apply it with
`:6.
Cheers,
Louis
> On 24 Sep 2017, at 20:35, Rob
lnps=: 4 : 0
(i{p)+}.i.d{~i=. (i.>./)d=. 2-~/\p=. (<:x),(p:([+i.@-~)/_1 p:x,y),>:y
)
Cheers,
Louis
> On 15 Sep 2017, at 18:24, Raul Miller wrote:
>
> Oh, oops...
>
> thru=: <. + i.@(+ *@+&0.5)@-~
> biggap=: {~ (0 1 + [: (i. >./) 2 -~/\ ])
> f=: [: thru/ 1 _1 + [: biggap <./ >. >./ <. thru&.(p:
; used up (only 32-bit range is used to stay compatible with J32). The latest
>> addition is literal4 in j805. IMO extended complex or extended complex
>> rational are unlikely to be a candidate to use the nearly used up resource.
>>
>> On Sep 10, 2017 8:02 AM, "L
exponential aspects
> of complex number operations get handled?)
>
> Thanks,
>
> --
> Raul
>
>
>> On Sat, Sep 9, 2017 at 4:57 AM, Louis de Forcrand wrote:
>> There is no extended complex datatype in J (although its addition could be a
>> thought).
>>
There is no extended complex datatype in J (although its addition could be a
thought).
Louis
> On 9 Sep 2017, at 09:23, 'Bo Jacoby' via Programming
> wrote:
>
>
>%2 NB. floating
> 0.5
>x: %2 NB. extended
> 1r2
>%1j1 NB. floating
> 0.5j_0.5
>x: %1j1 NB. why not extended?
> |do
+/#~ -.@:(2&|)i.43
>
> 22
>
> Skip Cave
> Cave Consulting LLC
>
>> On Tue, Aug 29, 2017 at 4:17 AM, Louis de Forcrand wrote:
>>
>> Also count the verbs in
>>
>> #~ -. 2&|
>>
>> With three verbs this evaluates to a fork, so
Also count the verbs in
#~ -. 2&|
With three verbs this evaluates to a fork, so
(#~ -. 2&|) v
(#~v) -. 2&|v
which signals a length error because #~ changes the shape of its argument.
What you want is to apply -. mondadically to 2&|, not apply it between #~ and
2&|; to do so use a cap [: like
Not built-in to the language. You could pretend to be the computer and expand
tacit code yourself while referring to the dictionary, renaming chunks to help
you.
Otherwise there might be some code somewhere that does this, but I don't know
of it.
Good luck,
Louis
> On 29 Aug 2017, at 00:00, P
In general, if you want to apply u along a group of n of axes:
axis=: 2 : 0
u"(#n)@(n&|:)
)
This is I believe very close to the axis operator in APL if you are familiar
with it:
]m=: i.2 3 4
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
16 17 18 19
20 21 22 23
< axis 0 m
+++---
1 0 1 0
> 0 0 0 0 1 0 1 0 1 0
> 0 0 0 0 1 0 1 0 1 0
> 1 1 1 1 1 1 1 1 1 1
> 0 0 0 0 1 0 1 0 1 0
> 1 1 1 1 1 1 1 1 1 1
> 0 0 0 0 1 0 1 0 1 0
> 1 1 1 1 1 1 1 1 1 1
> 0 0 0 0 1 0 1 0 1 0
>
> But I don't know which direction the diagonal elements would belong to
Hi,
Given an array index vector i, how would you go about
finding efficiently all indices (or elements at them) of an
array for which the index in each dimension is either the
same as that in i, or is offset by +/- n, where n is the same
for all dimensions, and keep them grouped by “direction”?
I
I find it interesting that N-R works for vectors and complex functions (and
mixes of both). Just replace all those scalar functions by their vector
equivalents:
vn=: 1 : '- n * u %. u D.1'
I added a scaling factor; it makes the convergence slower, but it fixes
problems due to precision-loss.
Why so? Did I miss a non-scalar verb somewhere?
Thanks,
Louis
> On 9 Aug 2017, at 14:47, Raul Miller wrote:
>
> I think you have assumed that the user will use these with "0 or only
> on atomic numbers?
>
> Thanks,
>
> --
> Raul
>
>
>> On We
A few handy tests which are good to know:
N=: GI *. 1 0 e.~ * NB. naturals
Z=: GI *. R NB. integers
R=: = + NB. reals
C_R=: + = - NB. pure imaginaries (C-.R)
GI=: = <. NB. gaussian integers
These were made to accept any J number. They could be optimised if one knows
that they are working only wi
, "Raul Miller" wrote:
>
>> Negative rank is a convention - it means the rank is relative to the
>> noun rank. I'm not sure what a rank less than 0 would mean otherwise.
>>
>> Thanks,
>>
>> --
>> Raul
>>
>> On Mon, Aug 7
@.] should be used, not @.0 :
v
|value error: v
v123
|value error: v123
v`''@.]
v@.]
v123`''@.]
v123@.]
I still like the @.] test.
Louis
> On 07 Aug 2017, at 19:26, Jose Mario Quintana
> wrote:
>
> No joke was intended, undefined names are regarded as verbs in the context
> of ad
er words, -"_1 in -"_1 i.3 3 has an effective rank of 1, but in
> -"_ i.3 it has an effective rank of 0.
>
> Since it can't know what rank to use until after it sees the nouns,
> its announced rank has to be infinite.
>
> Thanks,
>
> --
> Raul
>
The same observations go for all operators which depend on their argument’s
rank, such as @, &, or &. :
<@(,"_1)~ i.3
┌───┐
│0 0│
│1 1│
│2 2│
└───┘
Louis
> On 07 Aug 2017, at 16:55, Louis de Forcrand wrote:
>
> Yes I guess it could be replaced by
>
> u”_1”_1
_
> +"_1 _/~i.3
> 0 1 2
> 1 2 3
> 2 3 4
>
> I'm not sure if it is the intended behavior.
>
>
>> On Aug 7, 2017, at 3:40 PM, Louis de Forcrand wrote:
>>
>> +"0/~ i.3
>> 0 1 2
>> 1 2 3
>> 2 3 4
>> +"_1/~ i.3
+"0/~ i.3
0 1 2
1 2 3
2 3 4
+"_1/~ i.3
0 2 4
+"0 b.0
0 0 0
+"_1 b.0
_ _ _
I understand that this is dictionary compliant:
"In general, each cell of x is applied to the entire of y . Thus x u/ y is
equivalent to x u"(lu,_) y where lu is the left rank of u ."
+"_1 b.0
_ _ _
So u"_
often the cyclical feature then
> I would expect it to be a matter of adding a minor complication.
>
> Do you really need the cyclical feature?
>
> You might also like to read the oblique (/.) entry in the Dictionary and
> other sources; it could help.
>
>
> On Fri,
ip would be best implemented as
ip=: * * <.@|
as it would return an integer result.
Louis
> On 06 Aug 2017, at 12:17, Skip Cave wrote:
>
> All, Thanks for the help.
>
> Here's some real numbers from a problem I'm working on:
> Calculate some values from this equation:
>v=:2%(3r19-%1 2
I quite like this idea. It’s unfortunate that m”n was previously defined
differently,
but as you say conflicts would probably be nonexistent, and I’ve often wanted
to apply one verb to the first element of an array, another to the second, etc.
On my wish list would be something similar for the “e
Just wondering why
isgerund=: 3 : 0 :: 0
y@.]
1
)
isn't an acceptable test for “gerundality”?
I also kind of agree with Bill, in the sense that J doesn’t seem to have been
designed from the ground up (or halfway up for that matter) to facilitate
pr
NB. tacit
run=: upd rec
upd=: [ ((({~ 0{::]) + 1{::])`(0{::])`[} - 2{::]) ~.@] ; ] (+//. ; ]) 1 <: [
NB. explicit
RUN=: UPD rec
UPD=: 4 : 0
b -~ x u}~ (x {~ u=. ~.y) + y +//. b=. x >: 1
)
rec=: ((] + ] >: i.@[) (?@$ <:))@#
Slower on short vectors, faster on larger ones (j805):
1e2 ts 't
Sorry; I did digress from multiple assignment.
Louis
> On 19 Jul 2017, at 09:31, Raul Miller wrote:
>
> I believe that this discussion was about something different.
>
> Thanks,
>
> --
> Raul
>
>> On Wed, Jul 19, 2017 at 3:45 AM, Louis de Forcrand wrote
it (unorthodox) version
>>https://rosettacode.org/wiki/First-class_functions#Tacit_.
>> 28unorthodox.29_version
>> [1] Tacit (unorthodox) version
>> https://rosettacode.org/wiki/First-class_functions/Use_
>> numbers_analogously#Tacit_.28unorthodox.29_version
>
We were
>> planning to wait for the official J806 to become stable and resolve the Jx
>> glitches but I might decide instead to release a current version, as is,
>> soon.
>>
>>
>> On Mon, Jul 17, 2017 at 7:40 AM, Louis de Forcrand wrote:
>>
>>>
A lot has been said on these forums about Jx and Unbox.
They are unofficial J interpreters (with extensions to the language), are they
not?
Are they publicly available? I couldn't find anything about them on Google
except older messages in the forum archives, but then again unfortunately this
la
qq=: 1e4?.1e6
ts'cs1 qqq'
0.045429 398080
ts'cs qqq'
0.180366 397440
Real fast!
Louis
> On 25 Jun 2017, at 14:47, Louis de Forcrand wrote:
>
> Let V be a vector of real numbers, and V[i] its ith component.
> Then
>
> min( V[i] … V[j+1] ) = min( min(
Let V be a vector of real numbers, and V[i] its ith component.
Then
min( V[i] … V[j+1] ) = min( min( V[i] … V[j] ), min( V[i+1] … V[j+1] ) ).
This version is based on that:
ms=: #\ >./ . * [: >./@> # 2&(<./\&.>)&< ]
1e3 ts 'ms qq'
0.00491435 5.74234e6
Incorporating this in Mike's explicit
Thanks for the quick answers (and quick bug-fixing for that matter).
Louis
> On 23 Jun 2017, at 14:25, Henry Rich wrote:
>
> After reflection it seems clear that this is a bug in the implementation, so
> I have fixed it for the next release, to match the Dictionary.
>
> Henry Rich
>
>> On 6/
Hi,
There's been recent discussion on the GNU APL forums about how to define the
residue function on complex arguments. I wondered how it was specified in J,
but the dictionnary page seems kind of vague.
Nuvoc says that
(x|y)=y-x*<.y%x+0=x
for all scalars x and y (including complex numbers).
H
How about
1 0 1 0 1 0 (#~ ((-: & 0 1 0)"1 @: ({~ & z)))~ z
?
You can then "simplify":
First the hook (and {~&z)
([ #~ -:&0 1 0"1@:(z&{)@])~
([ #~ -:&0 1 0"1@:(z&{)@])~
Then ~ can be "distributed" over the resulting fork:
[~ #~ -:&0 1 0"1@:(z&{)@(]~)
] #~ -:&0 1 0"1@:(z&{)@[
You can keep going
1 - 100 of 190 matches
Mail list logo