Dear list,
if I load a (longer) script, I sometimes want to ignore a part of it
beyond a certain line. Is there a way to achieve that gracefully? (I
sometimes just add something syntactically wrong to stop there, on an
error).
Thank you.
Ruda
Raul Miller writes:
> The problem here is that you told printf that you were giving it a
> list of characters but did not do so.
Thanks.
Is then this the right way to print such a combination:
b=: 6
a=: i. 2 2
'%d%s%d' printf b; (,((":a),"1 LF)) ; b
or can the middle part be made simpler?
Dear list,
I have been surprised by this:
---
]a=: _2 ]\ 1 2 3 4
1 2
3 4
b=: 6
'x%d%d' printf b; b
x66
'x%d%s%d' printf b; (":a) ; b
x
6
1 2
3 4
6
---
I do not understand who adds the newlines in the last case. I'd expect
something like
x61 2
3 46
especially when
'x%d%s%d' pri
Dear list,
what is the reason that the 'space' character is coded as '\' '0' '4'
'0' in the .jhistory file?
(I know that \040 is the octal code for a space, but in .jhistory there
really are 4 characters '\', '0', '4', '0' instead of just single
'space' character).
This makes the file less read
Dear list,
having a script file A.ijs with the contents
a =. 1
f1 =. a&+
f2 =. 3 : 0
a&+y
)
f1 0
f2 0
and loading it with
a =. 2
loadd'A.ijs'
I see that the value 1 of 'a' is used for f1, but a value of a *global*
variable 'a' is used for f2. This bothers me a lot. Hence just by
changing from
Eric Iverson writes:
> Also, there are workarounds that are not too awkward and don't encourage
> the use too much.
>
>(3 : 'if. ... do. ... else. ... 2 end.') ''
>
> And the new {{{...}}} in 903 might be more direct.
>
> On Mon, Jul 12, 2021 at 1:24 PM Henry Rich wrote:
>
>> Because the co
Dear list,
what is the primary reason for the limitation that control structures
like if., select. etc. can only be used from within functions, ie., not
directly on the top level of a script.
Thank you
Rudolf Sykora
--
For
'Rudolf Sykora' via Programming writes:
> in my program I have
>
> 2!:1 'gnuplot d.plt'
>
> to plot my data. From reading the documentation I thought that running
> it would spawn gnuplot and just continue. But it does not, running gnuplot
> blocks until
Dear list,
in my program I have
2!:1 'gnuplot d.plt'
to plot my data. From reading the documentation I thought that running
it would spawn gnuplot and just continue. But it does not, running gnuplot
blocks until gnuplot is finished. Is that expected?
Thanks
Ruda
--
Hello,
>> what libraries are actually needed to get an output of 'plot' on
>> screen?
>> Is qt needed for that?
Julian Fondren writes:
> system/main/stdlib.ijs has a list of commands that it tries in
> linux_pdfreader. The first x that `which x` succeeds for gets
> used. The initial one xdg-o
Dear all,
what libraries are actually needed to get an output of 'plot' on screen?
Is qt needed for that?
(At this moment I get plot.pdf file generated in ~temp, instead of an
on-screen figure; running through strace [on linux] mentions various
qt-related software).
Thanks
Ruda
---
> The task is to go from (as an example)
>
> X: 05 6 26
> Y: 10 _10 80 100
>
> to, say:
>
> U: 05 10 15 20 25 30NB. Equidistant mesh.
> V: 10 _10 84 90 94 99 104NB. Linear interpolation and extrapolation when
> needed.
> NB. The numbers with U>5 are
Dear Raul,
thanks for your writing, and also for directing this from the general to
the programming forum, where I probably should have posted it.
On the topic. I am afraid you misunderstood what I meant. The data
as a whole do not follow a simple trend, like lying on a line. they can
be even qu
Dear list,
are there somewhere utilities ready to plot 2D histograms? (I.e.,
having, say, x and y coordinates of points, we would have bins with some
x- and y- extent into which one pours the data).
Thanks
Ruda
--
For informati
Dimitri Georganas writes:
> Yes, in theory it will work, but it practice doesn't. I read that page of
> course, replaced the pathnames, looked into the code and eventually found
> out that it calls gnuplot as an .exe explicitly. I'm sure it can be made to
> work but being on a tight schedule I'm
Raul Miller writes:
> Also, once you have it working, maybe that experience can be useful in
> helping us (the j community) in fixing the script?
In addons/graphics/gnuplot/gnuplot.ijs I changed the getbinfiles verb
to:
getbinfiles=: 3 : 0
res=. '';''
if. 0 ~: 4!:0 <'GNUPLOTBIN' do. return. en
Dimitri Georganas writes:
> I also looked at graphics/gnuplot addon, but it seems windows-specific.
Why do you think?
I believe it could work anywhere, though on Windows, if
you define GNUPLOTBIN_pgnuplot_, as described here
https://code.jsoftware.com/wiki/Addons/graphics/gnuplot
one could hav
Dear list,
using
load 'plot'
'ylog 1' plot 1 0 3
leads to an error within the gettplog function in
jzplot.ijs, namely on its line
pos=.min+step*i.>:>.(max-min)%step
As I understand, max-min is _ , step also _ , hence the problem. Of
course, it would be nicer to issue a nicer message
Dear Devon,
Devon McCormick writes:
> |NaN error: gettplog
> | pos=.min+step*i.>:>.(max-min)%step
> |gettplog[:11]
> ...
>
> So, I am properly stopped at this point but I can't figure why my initial
> stops don't have an effect. At least the above will provide a work-around.
although t
Dear Bill,
bill lam writes:
> You can first isolate problem be related to pop up box by setting
> wdinfo_z_=: echo
> so there won't be any pop-up info box.
>
> If crash gone away then it is a jqt issue.
with
wdinfo_z_ =: echo
the crash is gone.
I get
'ylog 1' plot 1 2 0 3
++
Dear list,
I am running j901 and have tried to use the gnuplot addon on Windows.
Following
https://code.jsoftware.com/wiki/Addons/graphics/gnuplot
I tried the setup that could automatically run gnuplot from J. This
setup, however, uses some words which are apparently missing in j901,
namely jhost
Brian Schott writes:
> I think you mean to use
> dbss'gettplog * : *'
I believe that's essentially equivalent to
dbstop 'gettplog'
Anyhow, using dbss does not help.
Thanks
Ruda
--
For information about J forums see http://www.
Dear list,
if I do
load 'plot'
'ylog 1' plot 1 2 0 3
then I get an error message about NaN in 'gettplog'. Something like that
is almost expected to happen (but not necessarily, __ coming from log 0
still isn't NaN, or is it?). I wanted to edit gettplog to see what could
be done, but first
Dear all,
how do you usually generate a sequence of integers from 'a' to 'b' with
a step 's'?
If I ignore the step, yesterday I wrote
interval=.{.+(i. @ >: @ ({:-{.))
interval 5 19
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
but that seems overly complicated...
Then I can include the step in
Dear Henry,
Henry Rich writes:
>
> I did look into it a little, and you could do the same. This is what I
> did (in JQt):
>
> plot 1 2 ; 3 4 5
> crash - before the crash a dialog about length error in getgrafmat.
> Indeed, the arguments have incorrect length.
> load 'plot'
> open
bill lam writes:
> You seemed also got the error box for some invalid input, but then it
> crashed after 2 seconds. This is weird I don't know why.
Is there anything I can do to diagnose the issue? Ie., run the command
like
plot 1 2 ; 3 4 5
expecting that it is going to fail, but put some
'Michael Day' via Programming writes:
> It's OK - well, fails gracefully - in JQt 807 under Windows 10.
> ...
> while on my iPad, iOS 12.4.5, (typing what I see there)
Do you mean that jqt807 on Win10 does not crash, while a newer J crashes
on your iPad?
I noticed more crashes in the past
Dear list,
load 'plot'
'ylog 1' plot 1 0 2
leads to an immediate crash of the J session for me (now win 10,
jqt901). I know that log 0 is NaN, but still...
Thanks
Ruda
--
For information about J forums see http://www.
Dear list,
although I seem to be able to define a function within another function,
it seems that the inner function does not see private variables from the
outer one. What is then the correct way to write something like
g =: 3 : 0
b =. 2*y
f =. 3 : 'y-b'
f y
)
g 2
and get -2 as a result?
Her
Dear Raul,
thanks for your prompt answer, I hope I understand the logic at least somehow.
The first part is understood, you break the list of boxes and rebuild it
back.
The second question, by my fault, was misinterpreted.
I actually want to do the operation on each third box (where, by chance,
||
|+---+---+--+-+|+---+---+--+--+|
+--+---+
2) do an arithmetic operation on the 'position of big numbers of about
51000', ie. the 3rd box on level 0 of the original variable; eg. I want
to subtract 5 from them...
?
Thank you for comments!
Rud
R.E. Boss writes:
> What I did was translate your
>
> C_ijlmnop = sum_k A_ijkl * B_mknop
>
> in J-terms. If that's not what you want, then your specs are imprecise.
>
> Perhaps what you want to do (with thanks to Lochbaum), is
>
> (('ijkl i. ijlk')|: A_ijkl ) (+/ . *) ('mknop i. kmnop')|: B_mkno
Mike Powell writes:
> if you wish
> the result to also be a tensor, you must choose one contravariant and
> one covariant index. So when Ruda writes A_ijkl*B_mknop, my guess is
> that the two uses of the k index have different tensor types.
In principle and generality yes, but for the purely tec
Dear Marshall and Henry,
Marshall Lochbaum writes:
> Although a matrix product will execute faster, if I want to write tensor
> code that is straightforward, and extends to multiple contracted axes, I
> would transpose the contracted axes to the end and combine them with
> (+/@:*"1).
This is ex
R.E. Boss writes:
> a =. i. 2 3 4 5
> b =. i. 2 4 3 5 6
>$a *"0 _ b
> 2 3 4 5 2 4 3 5 6
>$+/"6 +/"4 a *"0 _ b
> 2 3 5 2 3 5 6
This is an interesting take on the subject.
If I understand, the first part does an outer product, P,
P_ijklmnopq = A_ijkl * B_mnopq .
And I believe
Dear list,
I tried to use the dissect functionality to understand the way how
sentences are processed. On windows I see that while, originally, the
highlighting of parts of the sentence (the pink/violet rectangles) is
ok, when I resize the dissect window, the rectangles appear at wrong
places.
T
Hello,
I have two questions:
1) how do I find what functions are contained
in a package? Can I see it also before loading it?
What is the simplest way to open documentation for a
package? (E.g., I want to see all functions defined
in the 'stats' package, and, if possible, read what
some of them a
On 6 November 2017 at 12:49, Linda Alvord wrote:
> *. Times any number wil be 0.
>
> (b=:>:a) *. (0 0
>b
> _4
> 23*.0
> 0
Yes, right you are!
Sorry for the noise, it gets always evaluated.
I just got puzzled a bit. Now it's fine again.
Thanks to R. Miller, too.
Sorry again.
Ruda
---
On 6 November 2017 at 12:21, Linda Alvord wrote:
> Wasn't sure so I guess the answer is it gets evaluated:
Well, sometimes it doesn't:
(>:a) *. (0:a) *. (0:a) *. (0http://www.jsoftware.com/forums.htm
On 6 November 2017 at 12:13, Henry Rich wrote:
> Since (v1 a) may produce an array, the interpreter cannot assume that v1
> need not be evaluated.
Thank you!
Ruda
PS.: it's amazing how many pitfalls there are in any language
one doesn't know well... :(
---
Hello,
when I have
(v1 a) *. (0 <: a=. v2 42)
where v1 and v2 are some verbs, isn't it
so that when a<0 the (v1 a) part is not evaluated?
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
Thanks all for the replies, I'll have to think about it more...
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
Hello,
several times I encountered a problem of scoping my variables.
As I understand, variables in J are either global, or local.
This is fairly similar to C, but in C the globals may be globals
just within a file, and, unless marked extern, they are still
invisible to the outside.
Since local v
On 28 September 2017 at 15:43, Raul Miller wrote:
> But, yes, this works:
>
>r=: , LF,.~": _7 ]\ 0 >. i.&.(+&5) 32
So this is much in the way I wanted it at the very begining.
Thanks.
Ruda
--
For information about J foru
On 28 September 2017 at 14:50, Raul Miller wrote:
> Another way to work around this problem would be to use stringreplace"1
>
>r=: _7 ]\ 0 >. i.&.(+&5) 32
>(":r) rplc"1 ' 0';' '
Ok. Thanks. So is there a good reason for txt=. ,y in stringreplace?
Or, can the whole of r be represented as
On 27 September 2017 at 19:13, 'Mike Day' via Programming
wrote:
>($$rplc & (' 0';' ')) @: ": a
Yes. (I guess the @: is unnecessary here, right?)
I actually had tried something similar first:
(' 0';' ') stringreplace ":r
which, however, yielded
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1516 17 18
On 27 September 2017 at 19:44, chris burke wrote:
> a=. (a<32) * a=. 0 >. _5 + i.6 7
>
>
> 'b<>3.0' (8!:2) a
Thanks, this is probably the expected form, though
I still have to find out, what exactly it does. :))
Ruda
---
On 28 September 2017 at 01:21, Roger Hui wrote:
> If you are making a calendar you may find the following of interest:
> http://www.jsoftware.com/papers/eem/qq101.htm . It's APL but the ideas
> translate pretty readily into J.
Thanks.
Actually, I am not making a calendar :), I just wanted to see
On 28 September 2017 at 01:09, Devon McCormick wrote:
> Assuming a is a numeric matrix:
>
>a=. ":a
>(a='0')}a,:' '
>1
> 2 3 4 5 6 7 8
> 9 1 11 12 13 14 15
> 16 17 18 19 2 21 22
> 23 24 25 26 27 28 29
> 3 31
>
>
see the missing zero in 10, 20, 30; isolated ze
Hello,
I have an array of integers
0 0 0 0 0 0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 0 0 0 0 0
and I want to have it printed (to a string, say) without
the zeros. I.e, I want to replace each isolated 0 with a space.
How can I do i
On 18/09/2017, Raul Miller wrote:
> Well, first, I'd ask why you would want to do that.
Well, it just somehow quite naturally appeared in my code...
(which, of course, could be reordered to avoid the construct)
> But I'd go with something like x u"1~/~ y
> (And note that y u~"1/ x is something l
On 18/09/2017, Raul Miller wrote:
> I'd use x u"1/ y
nice, thanks.
What about if it were the other way round, i.e.
u"1 _"_ 1
?
Following what I learnt from you, I now know I can shorten
to
u"1"_ 1
.
(One could also perhaps use some modification
of u"1/~ ...)
Thanks
Ruda
--
Hello,
I have found myself writing a pattern like this quite often:
x u"_ 1"1 _ y
Is there a more J-idiomatic way to write this, or would you
define a custum adverb?
(It's basically a table of all 1-cell combinations...)
Thanks
Ruda
-
On 15 September 2017 at 17:33, Raul Miller wrote:
> Yes, basically, except there's no recursion here.
ok. So it's become clearer for me.
The use of DET puzzled me; is it there to avoid writing something like
. = 2 : 'definition'
which would probably be syntactically wrong?
Thanks
Ruda
--
So in the dictionary we see
DET=: 2 : 'v/@,`({."1 u . v $:@minors)@.(0<{:@$) @ ,. "2'
minors=: }."1 @ (1&([\.))
which is as far as I can tell two definitions, for DET and minors.
Is the dictionary meant to say that this DET is used in place
of . when . is used monadically? (And then that DET is
On 15 September 2017 at 12:50, Erling Hellenäs wrote:
> http://code.jsoftware.com/wiki/Vocabulary/dot
>
> http://www.jsoftware.com/help/dictionary/d300.htm
unfortunately, I cannot find a serious definition at either place.
(And I still think the definition is not present in the mentioned
dictiona
Hello,
I am struggling to understand what the dot conjunction does.
Namely, the meaning of monadic u . v
.
Can I find the definition (and perhaps some explanation)
somewhere?
(It's not in the dictionary, nor in JforC, nor in LearningJ.)
Thanks
Ruda
--
On 14 September 2017 at 19:02, 'Pascal Jasmin' via Programming
wrote:
> myverb =: 4 : 0"_ 0
> ..body..
> )
thanks!
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
Hello,
if I define a verb using 4 : 0, can I define also its rank
straight away?
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
> (n^2) | 5729082486784839
>
> is promoted to float, and loses precision. Same when the big number is
> extended - it's converted to float.
>
Hello,
I still do not understand the logic here. Why do these three differ?
n =. 14
(*: n) | 5729082486784839
147
(n^2) | 5729082486784839
0
(n*n) | 5
> yes its efficient, simply collecting the results of each iteration
> while the function is applied to the "last value".
Do you mean that
F^:(5 3) y
does not do any calculation for the '3' ?
Does that mean that the evaluation can't be parallelized, and that it
proceeds in order?
Or is it even cle
Hello,
if I want to apply a function F iteratively say 0, 1, 2, 3 .. N times
on y (and see
the individual results), I know I can do
F^: (i.N) y
But is this efficient or not? I.e., does the F^:3 uses the result of previously
calculated F^:2 ? Or are the calculations completely independent (as I g
On 17 July 2017 at 19:10, chris burke wrote:
> There is no obvious workaround, so you might have to accept the current
> behaviour.
Eventually, I decided to edit the postscript file to get the dashed-line effect,
and also to obtain axes' labels with mixed
symbol/italic/normal/subscript characters
On 18 July 2017 at 15:38, chris burke wrote:
> load 'plot'
> 'dat1 dat2 dat3'=. 10 #&> each 1 2 3;4 5 6 7;8 9
> clr1=: (#dat1) {. STDCLR_jzplot_
> clr2=: (#dat2) {. STDCLR_jzplot_
> clr3=: (#dat3) {. STDCLR_jzplot_
> pd 'itemcolor ',":,clr1,clr2,clr3
> pd 'pensize 5'
> pd dat1
> pd dat2
> pd dat3
On 17 July 2017 at 16:42, chris burke wrote:
>> Should this behave this way?
>
> No, it really should not. However, the line pattern calculation is based on
> numbers of points, so it will shrink the step size as the number of points
> increases, see linepattern in
> jsoftware.com/websvn/wsvn/publ
On 17 July 2017 at 16:42, Tom Arneson wrote:
> To get just 4 colors, redefine STDCLR
>
> STDCLR_jzplot_=: 4{. STDCLR_jzplot_
Say I do not know in advance how many graphs will be there.
(I know I can always count them, but...)
Say the number of plotted lines in the 1st and 2nd group (see below)
> Do you have an example where colors are not reused?
I mean reuse = restart, i.e. not necessarily cycle (though possibly also).
Example:
-
load 'plot'
pd 'reset'
pd 'type line'
pd i.3
NB.
pd 3+i.3
pd 'show'
-
The question is: what should I write at the place, so that
the sec
> Can I do that easily?
I tried to add:
pd 'itemcolor STDCLR_jwplot_'
at the place where I want to start over with colours,
but it doesn't help.
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.
Hello,
when plotting, the colours are by default taken from the STDCLR
list.
After plotting a few lines of a figure, I want to reuse the colours
from that list,
starting again from its beginning.
Can I do that easily?
Thanks
Ruda
-
Hello,
changing penstyle in a plot, I found it does not do the expected:
---
load 'plot numeric'
nsteps =. 50
xs =. steps _2 2, nsteps
pd 'reset'
pd 'type line'
pd 'penstyle 0'
pd xs
pd 'penstyle 1'
pd -xs
pd 'show'
---
If nsteps is 5, you can see the second line is d
On 14 July 2017 at 20:55, Björn Helgason wrote:
> I am only guessing.
> jd3 might help you.
What is jd3?
Can't find any mention of it.
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
It seems that in order to create an eps file from a plot, it's
best to just
pd 'eps fig.eps 234 176'
(the sizes are then in 1/72 in.)
However, this way I currently loose unicode characters.
How do you remedy this?
Thanks a lot
Ruda
---
On 14 July 2017 at 09:46, Lippu Esa wrote:
> load 'plot numeric'
> p1=.''conew'jwplot'
> pd__p1 steps _1 1 10
> pd__p1'title plot 1;show'
> p2=.''conew'jwplot'
> pd__p2 steps 4 12 10
> pd__p2'title plot 2;show'
>
> NB. cleanup later
> destroy__p1 ''
> destroy__p2 ''
Thanks, this seems to work.
Ju
On 14 July 2017 at 12:09, Ric Sherlock wrote:
> I suppose this depends on what "reset" means exactly.
> You can run the following command to get rid of existing name definitions
> in the base locale
> clear ''
> But it is certainly not the same as a new J session.
> It might be useful to explain w
Hello,
I'd like to plot two graphs with plot in two different windows.
I expected this to do the work:
load 'plot numeric'
pd 'reset'
pd steps _1 1 10
pd 'new'
pd steps 4 12 10
pd 'show'
However, it just shows the second plot...
Can anybody help?
Thanks
Ruda
Hello,
Is there any way to 'reset a jqt session' other then closing and
starting over jqt?
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
Hello,
I want to create a plot with the Plot package. The best would be to get an eps.
However when I use
pd 'eps ...
I somehow loose all unicode characters (and the sizes of fonts seems
wrong, too).
So I output to a png using
pd 'save ...
Then, however, the default resolution is too low, 480x36
> put =: (42"_)`[`]}
I once again thank all who both answered and supplied
extra information on my question.
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
> put =: 4 : '42 (x)}y'
> verb is defined as 3, meaning a monadic verb, but a dyadic verb is needed.
Aha!
I see.
Thanks
Ruda
--
For information about J forums see http://www.jsoftware.com/forums.htm
Hello,
I want to set x'th element of y to 42.
I tried quite a few variations of
put := verb : '42 x}y'
but I am still getting
1 put 1 2 3
|domain error: put
Can you tell me what is wrong, and tell me how to do it right?
Thanks
Ruda
-
On 15 June 2017 at 14:14, Brian Schott wrote:
> Rudolf,
>
> Have you seen the following comments which attempt to alter that Essay?
I haven't, I did not know about it. I will read it. Thanks!
Anyhow, I still believe the original essay should be improved (if I am
not completely
wrong with my unde
Hello,
I found a code to produce a histogram at
http://code.jsoftware.com/wiki/Essays/Histogram.
However, both the description and the function seem odd.
The code reads
histogram=: <: @ (#/.~) @ (i.@#@[ , I.)
1)
They say: ---The left argument is a list of interval *start* points.---,
which I t
On 26 May 2017 at 12:53, bill lam wrote:
> J depends on OS to locate the shared library. I think your
> ldconfig cache did not include /usr/lib64/liblapack.so.3
> or you may set LD_LIBRARY_PATH
>
> This is strange, if you had installed it from distro, ldconfig
> should automatically run to add it
On 26 May 2017 at 11:51, bill lam wrote:
> the following is from J user manual,
>
>
> cder'' returns information about a cd domain error:
> 0 0 - no error
> 1 0 - file not found
> 2 0 - procedure not found
> 3 0 - too many DLLs loaded (max 20)
> 4 0 - too many or too few parameters
> 5 x - declara
On 26 May 2017 at 10:43, bill lam wrote:
> lapack addons requires lapack binary installed on your computer.
> check manifest.ijs for instructions.
Thanks.
But I have liblapack.so on my system...
Can I somehow check J sees it?
Or what else can go wrong? (64 vs 32 bit?)
Ruda
--
Hello,
I wanted to use lapack to calculate eigenvalues of a (square) matrix,
but I see an error:
(Important is just the second part, hh is a square matrix.)
h=.(-i.6) |."0 _ (0 1 0 0 0 1)
hh=.<.?(10*h)
hh=.hh + (|: hh)
load 'math/lapack'
load 'math/lapack/geev'
geev_jlapack_ hh
|domain error: cd
86 matches
Mail list logo