Re: [Jprogramming] Applying a cyclic gerund

2023-02-25 Thread neitzel
Martin Neitzel -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] J Leaderboard for Advent-of-Code 2022

2022-12-01 Thread neitzel
The https://adventofcode.com/2022 fun started today. The shared leaderboard for J enthusiasts is the same as every year. If you are new: Log into your AOC account, go to https://adventofcode.com/2022/leaderboard/private and join with the code: 50810-78161bf8 As always: we

Re: [Jprogramming] Plot a Squircle in J

2022-08-16 Thread neitzel
, square ,: squircle) i: 1p1 j. 200 Martin Neitzel PS: That * in cos j.&* sin is Sign, bulging out the circle to the full 1 _1 (square) borders. Have some thoughts on what actually happens when the Sign * acts o

Re: [Jprogramming] calling linux command and dealing with streams

2022-06-24 Thread neitzel
Pawel Jakubas asked: > > What is your recommended way to call linux command/invoke program > from J and capture result? Let's say I want to invoke > *dd if=/dev/urandom bs=100 count=1* NB. 2!:0 returns stdout, stderr goes to the console s =. 2!:0 'dd if=/dev/urandom bs=100 count=1' 1+0

Re: [Jprogramming] How to convert list of phrases to list of boxed phrases?

2020-05-17 Thread neitzel
;/ -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Help, please, understanding request for x 0!:n y (Pascal or others)

2019-08-23 Thread neitzel
Henry Rich wrote: > > There is a request outstanding for a change to 0!:n, giving an optional > left argument. The justification is to allow a verb to find the name of > the script it was loaded in. I don't see why the current 4!:3 and 4!:4 > aren't adequate. Can someone explain why > > (4!:3'

Re: [Jprogramming] Adding leading zeros

2019-02-03 Thread neitzel
on your numeric list: _4&({.!.'0')@":"0 a 0001 0002 0003 0004 0005 0010 0020 0030 [...] The new way, avalailable since J Release 6.01, 2006: 'r<0>4.0' 8!:2 ,. a Martin Neitzel --

Re: [Jprogramming] Tacit form: How to handle intermediate result..?

2018-09-04 Thread neitzel
code composed out of useful little parts. Martin Neitzel PS: There's little reason not to use auxiliary functions. One objection could be: "In A =. %: @ (s2 * */@(s2 - ])), the half perimeter is needlessly computed

Re: [Jprogramming] Tacit form: Where to put the start value..?

2018-08-07 Thread neitzel
Hi Martin! >(+:^:(]`(%~))) 5 >32 >(+:^:(]`*)) 5 >32 The good old Constant function 1: will give you the benefits of less circumlocution, better results for non-positive arguments, and coverage of array arguments: +:^:(]`1:) (,: -) 0 1 2 5 1 24 32 1

Re: [Jprogramming] What's happening here?

2018-07-31 Thread neitzel
> I am running a much older J and the output is the same : > #(#~ ((-:~.)*(-:\:~))"1)":,.p:1200+i.10 >1 I am running a much older J and the output is not the same: #(#~ ((-:~.)*(-:\:~))"1)":,.p:1200+i.10 value error Here, p: is not a primitive but a "given name", a user-(un)defined name whi

Re: [Jprogramming] Tacit equivalent of t=: 1 : '%:@:(u/) y'

2018-07-31 Thread neitzel
Piet Google wrote: > t=: 1 : '%:@:(u/) y' Note that u/ has unbounded rank anyway, so you can reduce the colonitis a little bit: t =: / (%:@) Martin -- For information about J f

Re: [Jprogramming] Does anyone use negative level? (change proposal)

2018-07-27 Thread neitzel
HHR> I think negative level is wrongly defined. Just a few weeks ago, i dug down into L./L:/S:/{:: level counting myself, incl. negative levels specs. (Raul's wonderful "convert/json" add-on made me do it. I blogged a few notes in https://www.gaertner.de/~neitzel/nb/a

Re: [Jprogramming] Catalogue

2018-07-22 Thread neitzel
Henry Rich wrote: > As I read Ye Dic, ({ i. 2 4) should give the same result as > ({ <"1 i. 2 3). I never thought I'd have to say this to *you* but: note that Catalogue { has rank 1. Hence there should not be any interaction between the colors in { 'black' ,: 'green' nor in the low / high ve

Re: [Jprogramming] Fwd: Convention to stop loading a script

2018-05-09 Thread neitzel
Ian Clark wrote: > >Can I propose we agree to alter the stdlib verb: (load) to provide a way to >stop loading a given script? > > @@NB. stop loading at this line > >certainly does that, but generates an unwelcome "syntax error". This can >interfere with calling processes. I'd be wary of establis

Re: [Jprogramming] trivial value passing issue

2018-03-03 Thread neitzel
raoul schorer wrote: > > > NB. Column index of data y by name x > colIdxByName =: 4 : 'I. (0 { y) = > NB. Select a column in data y by index x > colByIdx =: 4 : '}.x{|:y' > > But if I try: > > colByName =: 4 : 0 > idx =. x colIdxByName y > res =. idx colByIdx y > ) Your approach is

Re: [Jprogramming] self documentation

2018-02-28 Thread neitzel
David Lambert: > > Dyad=: [: : > add=: +&:([ 'x add y yields the sum x + y'"_) Dyad Unlike +, the "add" has ranks _ _ which will be noticable with enough context: 1 <@add i. 4 +---+ |1 2 3 4| +---+ 1 <@+ i. 4 +-+-+-+-+ |1|2|3|4| +-+-+-+-+ Given that that you are ditching the mona

Re: [Jprogramming] Strange behavior of 0x1

2017-12-16 Thread neitzel
0x1 2.71828 9!:14'' j806/j32/raspberry/beta/commercial/www.jsoftware.com/2017-09-18T01:24:43 -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Call for Wiki work: standard library

2017-10-31 Thread neitzel
We have had "scriptdoc" for ages. It provides for both individual verb/whatnot documentation and for overall script/bundle documentation. Make its use mandatory for all add-on contributors. Extract the initial script comment as "add-on abstract" automatically. Make that abstract viewable Both f

Re: [Jprogramming] Jx 1.1 Release

2017-10-13 Thread neitzel
BL> The printed book documentation for J. The company was still called ISI at BL> that time, early 90's. BL> https://i.imgur.com/cvzzJNk.jpg Yepp, those "green ones" were J Rel. 2 (the first commercial release, introducing the Windows IDE und "WD" gui programming), 1994. The Rel. 3 documents (199

Re: [Jprogramming] Jx 1.1 Release

2017-10-13 Thread neitzel
bill lam wrote: BL> Please note that some of rules for bident and trident are specific to the BL> ancient J. Current J only supports verb trains (fork and hook) and NVV as a BL> fork, That's not entirely correct. We still have the V0 C1 N0 C1 C0 V1 C0 N1

Re: [Jprogramming] Jx 1.1 Release

2017-10-13 Thread neitzel
bill lam wrote: > > As mentioned earlier, ancient J had a more complete set of > rules for tridents and bidents. This is what availbale in > J circa 1994 (23 years ago) > > https://i.imgur.com/OtBZZq1.jpg No need for scans and jpegs: http://juggle.gaertner.de/ref/dictionary/dictf.htm Tha

Re: [Jprogramming] Newbie frustration

2017-04-02 Thread neitzel
Michael Goodrich wrote: > Was going fine until I wrote the first control loop: always get > 'spelling error' even if i copy one from the books. Many of "the books" are old and have not been updated to current language rules. Most prominently, you'll find dotted placeholders x. y. u. v. m. n. in

Re: [Jprogramming] Displaying boxed tables

2016-03-31 Thread neitzel
wrap what's there. I find the 'max line length' default of 256 characters too restricting: I don't like to have i. 100 nicely wrapped but ellipsed after the 88. So I put a 9!:37 ] 0 _ _ _ into some startup file quite quickly.

Re: [Jprogramming] Remove trailing zeros

2016-03-30 Thread neitzel
ht suggest a bit of refactoring: fill =: 3 : '{. 1 {. 0 {. y' delete_padding =: ($:~ fill) : (+./\.@:~: # ]) delete_padding 1 2 0 0 1 2 '!' ,~ delete_padding 'foo bar ' foo bar! '.' delete_padding

Re: [Jprogramming] Unbox request for requests

2016-03-19 Thread neitzel
w far do you have to go back to find an old system which does *not* allow the AA bi-dent?" > 7 didn't allow it, did it? J Version 7 allowed it: neitzel 422 > j7 J7 Copyright (c) 1990-1993, Iverson Software Inc. All Rights Reserved. 0!:0 'uname -a'

Re: [Jprogramming] Adverbial Tacit Jym

2016-03-14 Thread neitzel
Pascal Jasmin wrote: > a0 =: > a1 =: You are confusing the Jym with the Spoilarium, I'm afraid. Martin Neitzel -- For information about J forums see http://www.js

Re: [Jprogramming] Feedback on beginner's code

2016-03-14 Thread neitzel
agrams"). They are certainly easier to test/verify. It also makes reasoning about the ranks of the components easier. In consequence, it becomes easier to make an educated selection between @ vs @: or & vs &: -- much better tha

Re: [Jprogramming] Am I understanding m/y ?

2016-02-22 Thread neitzel
DoJ>m/y inserts successive verbs from the gerund m between items of y, DoJ>extending m cyclically as required. Thus, +`*/i.6 is 0+1*2+3*4+5 RM> From the description, I would expect +`*/3 4 5 to give the result 3*4+5 I certainly read "successive verbs from the gerund", as "starting at

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-12 Thread neitzel
Matthew Baulch wrote: > > You're probably right that an ASCII name of its own would be better. > Not many primitive names available, it seems. Oh well. Infinitely many J primitive names are available. From , [emphasis mine]: A primitive or

Re: [Jprogramming] "Gluing" rows together

2016-01-05 Thread neitzel
>z=. (((a0 ,: a1) , a2) , a3) , a4NB. "glue" rows together z=.a0 , a1 , a2 , a3 ,: a4NB. effects the same -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] 'Tis the Season...

2015-12-11 Thread neitzel
LAA> S=: ')()))(' LAA> f=: 13 :'(+/''(''=y)-+/'')''=y' LAA> f S LAA>_6 This is coming near the solution I like best: +/ ('('&= - =&')') S _6 Why do like this? (a) It is robust against any additional dirt characters, say, linebreaks in S. (Unlike the ').('&i. -

Re: [Jprogramming] jconsole linux platform: delete / insert keys

2015-09-19 Thread neitzel
BL> Yes, ctrl-d only terminates a session at the begining of a line. BL> But ctrl-d in the middle of a line does not delete any BL> character in debian. It certainly does that for me (debian, too). Of course ctrl-d will do nothing if the cursor is at the end of the line and there is no charact

Re: [Jprogramming] jconsole linux platform: delete / insert keys

2015-09-19 Thread neitzel
BL> Did you mean ctrl-h? No, meant ctrl-d. ctrl-h = "backspace" deletes the character to the left of the cursor. Martin wants the Delete key to nuke the character to the right of ("under" the cursor, in particular if you are using a "block" cursor). Ctrl-d will do that. BL> ctrl-d is for exi

Re: [Jprogramming] jconsole linux platform: delete / insert keys

2015-09-19 Thread neitzel
MK> On my Debian box in JConsole v7.01a (32-bit) MK> when I press the [Delete] or [Insert] key on my keyboard MK> I get a tilde [~] as output [] The ~ you are seeing is most likely what remains after the initial part of the emitted character sequences ("\e[3~", "\e[2~") got interpr

Re: [Jprogramming] linear boxed representation : A new representation format for mixed type words

2015-03-09 Thread neitzel
Pascal Jasmin wrote: PJ> PJ> if you want to pass a gerund (or boxed noun) to a function, it must PJ> either be all verbs (with single adverbs as strings permitted), or all PJ> nouns. So this is possible. PJ> '`a b c' =. '/';+`- PJ> but it fails for an adverb phrase. PJ> '`a b c' =. '/\';+`-

Re: [Jprogramming] speaking of amend...

2014-07-16 Thread neitzel
'Pascal Jasmin' asked: >what verb v (or I guess adverb is ok) could I use to get > >    i.2 3 2 > 0 1 > 2 3 > 4 5 > > 6 7 > 8 9 >10 11 > >0 1 1 v i. 2 3 2 >0  1 >8  9 >10 11 So you want some bastard item merged out from the original ones. This is exactly what monadic } will do, the

Re: [Jprogramming] J as a calculator

2014-03-19 Thread neitzel
> 1- %~/ +/ (100 5) * _2[\ (10 3 7.5 2) 1 - y anti-truism/probability/fraction is -. y Martin -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Rank related questions

2013-07-25 Thread neitzel
I learned something new in the last 90 minutes, this is a small summary. (I always tell people that one never stops learning J. Nevertheless I'm still always a bit surprised when this holds for me, too. :-) It dawns on me that I just re-answered the "when is v f. not v?" FAQ which I admittedly

Re: [Jprogramming] calling jj.dll

2013-06-20 Thread neitzel
Hi Raul, >The underlying mechanism only makes sense when mixing structure >elements which have different sizes. I fail to understand this, probably because I lost track of the original context. (I.e., what is Greg trying to do?) >Still, if you can find any examples, it would be great to hear ab

Re: [Jprogramming] calling jj.dll

2013-06-20 Thread neitzel
GREG> 2)Is there a formula for header size depending on rank? RAUL> So, expressed in C, it's (7+rank)*sizeof I There may also be some padding after the s[] shape elements and before the data values following the header in order to have the data values properly aligned. (Think of "doubles" req

Re: [Jprogramming] Rank Nesting

2013-06-20 Thread neitzel
Ric Sherlock wrote: > > Explicitly defined verbs and verbs that include trains have default rank of > _ _ _ , but that can be altered as part of the verb definition. Rick and everybody else still doing this: please stop this misleading wording! A verb's rank CANNOT be "altered". Its rank

Re: [Jprogramming] tcp/ip communication

2013-04-12 Thread neitzel
quot;toggle outbinary" at the telnet client. For auto-running a J as a service, just use inetd(8): On miles.marshlabs.gaertner.de (OLD FreeBSD 4.7, dual-stacked IPv4 & IPv6): neitzel 107 > grep -w ^j /etc/services j 5001/tcp #j language. neitzel 108 > grep -w ^j /et

[Jprogramming] J Workshop in Chemnitz, Germany, March 17th

2013-01-30 Thread neitzel
[Relax, this is kinda bilingual...] Das hier ist in erster Linie fuer die paar deuschsprachigen J-Anfaenger im Forum von Interesse -- Ich lade Sie herzlich ein zum: J Workshop (3h, Anfaenger-Intro) auf den Chemnitzer Linux-Tagen 2013 (17.+18.3. 2013, TU Chemnitz, Germany)

Re: [Jprogramming] Matrix Transformations based on local submatrices

2012-11-14 Thread neitzel
I wrote: > Solve the torus first: > > use |.to wiggle m up & down (and center), > use |."1 to wiggle those matrices left & right (and center) > > ending up with 9 matrices, the original one and eight shifted ones [...] |. will also accept a two element vector on the left side, sp

Re: [Jprogramming] Matrix Transformations based on local submatrices

2012-11-13 Thread neitzel
>OK, I'm trying to do some work with matrices that involves transformations >based on local properties of a matrix (neighbouring elements). As Henry Rich pointed out: the real solution will go via ;.3 tessalations. Have a look at those. Without those ;.3 cuts, the classic approach is this: