[Jprogramming] modifiers

2020-02-26 Thread Hauke Rehr
Hello again, I’m still confused about modifiers. Please tell me where to find more information that might aid in understanding how this works: I have an adverb A and a verb V but sometimes x and y for the derived verb for A are known prior to the verb, so I want to write a modifier something

Re: [Jprogramming] modifiers

2020-02-27 Thread Hauke Rehr
be equivalent to ([ u~ V) On Wednesday, February 26, 2020, 06:20:45 p.m. EST, Hauke Rehr wrote: Hello again, I’m still confused about modifiers. Please tell me where to find more information that might aid in understanding how this works: I have an adverb A and a verb V but sometimes x and y

Re: [Jprogramming] ^:

2020-03-04 Thread Hauke Rehr
talking about copying: I don’t remember having read about whether J is copy-on-write or when copying will take place is there a defined set of verbs that does copying or does that take place at a different level? Am 04.03.20 um 15:29 schrieb Raul Miller: Yes. The general case, implementated in

Re: [Jprogramming] modifiers

2020-02-28 Thread Hauke Rehr
, ' u~ ' , ": m V n) ) On Thursday, February 27, 2020, 03:04:57 a.m. EST, Hauke Rehr wrote: What I want is rather something (C here) callable like noun1 C noun2 resulting in the adverb noun1 u~ What you say I knew except if the evaluation rules changed in j9 and this is new

Re: [Jprogramming] modifiers

2020-02-27 Thread Hauke Rehr
: The description of : in NuVoc gives the most detail I know of. Have you read it? Henry Rich On 2/26/2020 6:20 PM, Hauke Rehr wrote: Hello again, I’m still confused about modifiers. Please tell me where to find more information that might aid in understanding how this works: I have an adverb

Re: [Jprogramming] constant substitution

2020-02-16 Thread Hauke Rehr
nts that are usefully changed prior to load is to have an init_verb called at the end of the script that reassigns (tacit) verbs based on constant values. On Sunday, February 16, 2020, 09:02:47 a.m. EST, Hauke Rehr wrote: I don’t have any concrete example that’s actually expensive in ter

Re: [Jprogramming] constant substitution

2020-02-16 Thread Hauke Rehr
:22 schrieb bill lam: Why do you think there will be major savings of computational resources? Can you give a concrete example? Sun, 16 Feb 2020, Hauke Rehr написал(а): Hello everybody, I recently stumbled upon some at least for me counterintuitive (read: puzzling) behaviour: In a verb like (&

[Jprogramming] constant substitution

2020-02-16 Thread Hauke Rehr
avings of computational resources so I’d have expected J to do this. could anyone tell me why this is different from verbs? kind regards, Hauke Rehr (Jena, Germany) -- -- mail written using NEO neo-layo

Re: [Jprogramming] constant substitution

2020-02-16 Thread Hauke Rehr
- an expression would be required 3. J doesn't know about named constants; it knows only nouns.  m and n could be megabytes in size.  Installing them into a sentence would be inefficient. Henry Rich On 2/16/2020 3:05 AM, Hauke Rehr wrote: Hello everybody, I recently stumbled upon some at least for me

Re: [Jprogramming] Origin of definitions (was Programming

2020-03-08 Thread Hauke Rehr
That’s true for the most simple cases only. That way one gets a display of a value rather than of a definition. Consider these definitions and “definition query” (as I said, it’s simply a display of value): adv =: 1 : 'm&+' v =: 5 adv v 5&+ In more complicated situations you would

Re: [Jprogramming] Different result of mean for row and column vectors

2020-04-15 Thread Hauke Rehr
In other words, there is no such thing as a “column vector.” It’s a matrix with “dimension“ 2. A better way to phrase this is “has 2 axes” or, in J lingo, as Don Guinn said, it’s about ranks. You said rvec =: 1 2 3 rather than rvec =: 1 3 $ 1 2 3 but with cvec you told j to build a matrix aka

Re: [Jprogramming] Partitioning

2020-04-07 Thread Hauke Rehr
Where is L:. documented? I can’t find it in the Vocabulary. Am 07.04.20 um 22:59 schrieb Skip Cave: That's it! I wanted a combination of partitioning and indexing, and L: does the job. I'll have to do some studying to understand L:. r 9 8 6 1 2 2 2 6 8 7 5 4 8 4 2 7 9 1 4 1 4 3 3 7 7 0 6 7

Re: [Jprogramming] Partitioning

2020-04-07 Thread Hauke Rehr
at 4:02 PM Hauke Rehr wrote: Where is L:. documented? I can’t find it in the Vocabulary. Am 07.04.20 um 22:59 schrieb Skip Cave: That's it! I wanted a combination of partitioning and indexing, and L: does the job. I'll have to do some studying to understand L:. r 9 8 6 1 2 2 2 6 8 7 5 4 8 4 2

[Jprogramming] old problem, new solution

2020-04-07 Thread Hauke Rehr
Hi all, I just started reading https://code.jsoftware.com/wiki/Doc/Articles/Play202 and tried to make up a solution rehrperm =: 3 : 'if.1>:y do.,:y$0 else.,/ (i.y) ,"0 1 (rehrperm <:y) {"2 1 (-."1 0)~ i.y end.' I didn’t use if.do.end. nor did I care for calls with y < 1 but changed this

Re: [Jprogramming] Trouble running JQT on Linux

2020-04-19 Thread Hauke Rehr
You say you’re using Ubuntu; the next LTS release is due on Thursday. Maybe wait for the release upgrade and try again? Am 19.04.20 um 23:15 schrieb Phil Hanna: I have installed J901 on my Linux Ubuntu 18.04 machine. The J console works OK, but I can't get JQT to run. saspeh@u25nv:~$ sudo

Re: [Jprogramming] Trouble running JQT on Linux

2020-04-19 Thread Hauke Rehr
release prematurely for my whole machine just to see if there was a bug with the old one. On Sun, Apr 19, 2020 at 5:27 PM Hauke Rehr wrote: You say you’re using Ubuntu; the next LTS release is due on Thursday. Maybe wait for the release upgrade and try again? Am 19.04.20 um 23:15 schrieb Phil

Re: [Jprogramming] Trouble running JQT on Linux

2020-04-19 Thread Hauke Rehr
I just looked up what it looks like on my machine: ~/j64-807$ ll bin/ -rwxrwxr-x 1 […] 2,7M […] libjqt.so obviously not a symlink don’t know if things have changed for v9.01 though Am 19.04.20 um 23:15 schrieb Phil Hanna: I have installed J901 on my Linux Ubuntu 18.04 machine. The J console

Re: [Jprogramming] Trouble running JQT on Linux

2020-04-19 Thread Hauke Rehr
You’re right, I should stop posting unrelated/unhelpful messages. Thanks Am 20.04.20 um 00:16 schrieb Raul Miller: (1) Which release are you running? (2) This thread belongs on the general forum, not on the programming forum (which I have bcc'd in case you forgot to subscribe to the general

Re: [Jprogramming] Iteration

2020-03-13 Thread Hauke Rehr
In my opinion, “do” and “undo” is not the idea/concept of &. and doesn’t get across what it actually does. &. is very helpful in a plethora of use cases it is like transform, work in transformed space, transform back (like working with conjugate matrices or in fourier space, e.g.) From my

Re: [Jprogramming] Iteration

2020-03-13 Thread Hauke Rehr
If that’s what was intended, I’d rather write ;/6 (? $~) 55 (adhering to the DRY principle). Am 13.03.20 um 16:22 schrieb Raul Miller: Here's another approach: ;/6?255#55 Here, I decided that "extended fifty times" really meant that you wanted another 50 copies of that expression

Re: [Jprogramming] Iteration

2020-03-25 Thread Hauke Rehr
That’s what ;/6 (? $~) 55 (amoung others) does. We wondered mainly how many repetitions you actually wanted to get. There were 5 in your example and you wanted something extended 50 times. None knew what it was you wanted extended and if it was to be counted. Did you intend to get • 50 • 51 •

Re: [Jprogramming] stock data programming how-to #4

2020-04-02 Thread Hauke Rehr
When the values are nonnegative, their ratios are, too. There must be something different happening if there are negative values. Am 03.04.20 um 03:29 schrieb HH PackRat: On 4/2/20, Raul Miller wrote: One other thing -- after sleeping on this, I realized I had two conflicting views about

Re: [Jprogramming] Generating "music" in J (or otherwise)

2020-03-29 Thread Hauke Rehr
could one as easily have a lilypond file created instead? since converting from MusicXML usually doesn’t work that well else I’d rather re-implement the music generation in scheme (guile) in order to use it in lilypond directly Am 29.03.20 um 05:14 schrieb Thomas McGuire: I have a couple of

Re: [Jprogramming] generate integers from a to be with a step

2020-03-29 Thread Hauke Rehr
as for the trailing 5s: i: needs to fill with trailing 0s so you intermediately get _2 _1 0 1 2 _2 0 2 0 0 adding 5 leads to your result I once wrote this (here adjusted to Ruda’s example) in case stepping is used really frequently throughout the code — but there is too much (two

Re: [Jprogramming] generate integers from a to be with a step

2020-04-01 Thread Hauke Rehr
the step is calculated rather than given you’d need to preprocess the argument(s) Am 02.04.20 um 01:26 schrieb Fraser Jackson: No one has mentioned the simple function load 'stats/base' steps 5 19 14 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 steps 5 9 8 5 5.5 6 6.5 7 7.5 8 8.5 9 steps _3 10 13 _3

Re: [Jprogramming] Bug in new vocabulary &: page

2020-04-01 Thread Hauke Rehr
Actually, I’m a little bit confused as well: I thought I understood it but obviously didn’t so I tried redoing the diagram but with one set of arrows altered. Am I right these should be different or do I misinterprete the way atop is meant to work? thanks Am 29.03.20 um 03:36 schrieb ethiejiesa

Re: [Jprogramming] Bug in new vocabulary &: page

2020-04-02 Thread Hauke Rehr
, Hauke Rehr wrote: Actually, I’m a little bit confused as well: I thought I understood it but obviously didn’t so I tried redoing the diagram but with one set of arrows altered. Am I right these should be different or do I misinterprete the way atop is meant to work? thanks Am 29.03.20 um 03:36

Re: [Jprogramming] Factoring

2020-04-24 Thread Hauke Rehr
   5 p: ] or   5: the "totient" Not what Skip is looking for,  though? On 24/04/2020 20:14, Hauke Rehr wrote: does counting suffice? then that would be φ which I’m sure someone must have written code for already Am 24.04.20 um 21:09 schrieb Skip Cave: I have used

Re: [Jprogramming] Factoring

2020-04-24 Thread Hauke Rehr
using builtin q: I get correct results using /:~ ~.@, ((*/)@#"1~ #:@:i.@(2&^)@#) 1,q: 4711 1 7 673 4711 /:~ ~.@, ((*/)@#"1~ #:@:i.@(2&^)@#) 1,q: 42 1 2 3 6 7 14 21 42 less brute force but it’s just a first attempt Am 24.04.20 um 20:28 schrieb Skip Cave: I want to find all the integer

Re: [Jprogramming] Factoring

2020-04-24 Thread Hauke Rehr
I now have an answer for the number of results: */ >: +/"1 (=/~ ~.) q: 4711 4 */ >: +/"1 (=/~ ~.) q: 42 8 I hesitate using =/~ (it’s actually deprecated) but I wouldn’t know a better way in this case Am 24.04.20 um 21:09 schrieb Skip Cave: I have used the wrong terminology. I want to

Re: [Jprogramming] Factoring

2020-04-24 Thread Hauke Rehr
does counting suffice? then that would be φ which I’m sure someone must have written code for already Am 24.04.20 um 21:09 schrieb Skip Cave: I have used the wrong terminology. I want to find all the positive integer *divisors* of an integer n (not just primes) which includes 1 and the integer.

Re: [Jprogramming] Mac question

2020-04-23 Thread Hauke Rehr
in my opinion, this is the way to do this properly • you won’t have to repeat too much in the future (upgrades) • you won’t have copies which is always a bad idea after all, that’s one of the use cases profile scripts are meant for Am 23.04.20 um 13:17 schrieb chris burke: In addition to Ian's

Re: [Jprogramming] Dyadic "cut" with Boolean left argument

2020-04-24 Thread Hauke Rehr
but in that case a boolean left argument will give a partition with at most two elements in general you need n different values for partitioning into n sets this way Am 24.04.20 um 23:45 schrieb Devon McCormick: I must have been thinking of "key", e.g. 1 0 1 0 wrote: I seem to recall

Re: [Jprogramming] Please help

2020-05-13 Thread Hauke Rehr
Or, starting from your first approach, teaching where and why it failed: 1 2 7 ,/"1 0 ] 30 40 you want ,/ to work on a list on the left and individual atoms on the right " (rank) does that. It tells the verb (,/ in this case) to apply to lists (1) on the left and atoms (0) on the right. Thus

Re: [Jprogramming] Please help

2020-05-13 Thread Hauke Rehr
oking up ~ as well Am 13.05.20 um 10:35 schrieb Hauke Rehr: Or, starting from your first approach, teaching where and why it failed: 1 2 7 ,/"1 0 ] 30 40 you want ,/ to work on a list on the left and individual atoms on the right " (rank) does that. It tells the verb (,/ in this

Re: [Jprogramming] Finding Perfect Squares

2020-05-17 Thread Hauke Rehr
First, Skip already mentioned that. His posts are about J’s behaviour. Second, your reasoning is flawed. */ 3 ^ i.4 includes non-square factors and is a perfect square. Think about prime numbers and their distribution, and you’ll get a valid answer. Am 18.05.20 um 03:22 schrieb 'Pascal Jasmin'

Re: [Jprogramming] Finding Perfect Squares

2020-05-17 Thread Hauke Rehr
. On Sunday, May 17, 2020, 09:32:04 p.m. EDT, Hauke Rehr wrote: First, Skip already mentioned that. His posts are about J’s behaviour. Second, your reasoning is flawed. */ 3 ^ i.4 includes non-square factors and is a perfect square. Think about prime numbers and their distribution, and you’ll get

Re: [Jprogramming] no Bug, try to find your own error before accusing: +./4.57 4.34 4.44

2020-05-15 Thread Hauke Rehr
my 2¢ the result is absolutely correct; both Henry Rich and Devon McCormick showed why If you’re dealing with values with two decimal places everywhere, either apply rounding after each operation, or (better imho) work on 100-fold values and divide by 100 in the very last step of your

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-15 Thread Hauke Rehr
In case you are willing to accept labelling it a problem. As I mentioned by altering the thread’s subject, yes, this ain’t a bug. But there may be an opportunity for improvement without sacrifice. Or so do I think. Am 16.05.20 um 00:49 schrieb 'Michael Day' via Programming: Not a new "bug" -

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-15 Thread Hauke Rehr
oing on here... maybe a built in epsilon which is independent of comparison tolerance? Thanks, -- Raul On Fri, May 15, 2020 at 6:53 PM Hauke Rehr wrote: In case you are willing to accept labelling it a problem. As I mentioned by altering the thread’s subject, yes, this ain’t a bug. But there

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-15 Thread Hauke Rehr
The more I think about it, the more I think +. could actually be amoung those arithmetic primitives that would benefit from using 0&= without doing much harm if I don’t miss something. Still otoh: The decimal system is an arbitrary way of representing numbers. There’s no point in having 0.142

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-16 Thread Hauke Rehr
999758 0.01000655 4.3399 0.02000466 0.00999758 0.02000466 4.4404 I'm not quite sure what's going on here... maybe a built in epsilon which is independent of comparison tolerance? Thanks, -- Raul On Fri, May 15, 2020 at 6:53 PM Hauke Rehr wro

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-16 Thread Hauke Rehr
numbers as well without being given any kind of reference (or else you haven’t grasped the concept of gcd yet) Am 16.05.20 um 11:30 schrieb bill lam: Do you have any reference that gcd is applicable beyond the context of inregers? On Sat, May 16, 2020 at 5:19 PM Hauke Rehr wrote: wrong. first

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-16 Thread Hauke Rehr
_16 8.88178e_16 8.88178e_16 Thanks, -- Raul On Sat, May 16, 2020 at 5:51 AM Hauke Rehr wrote: sorry, I was not sufficiently precise about my example I meant to talk about atomic a only if $ a is empty, then +./ (, -) a will work Thanks for pointing out the lack of precision. Am 16.05.20 u

Re: [Jprogramming] Bug: +./4.57 4.34 4.44

2020-05-16 Thread Hauke Rehr
sorry, I was not sufficiently precise about my example I meant to talk about atomic a only if $ a is empty, then +./ (, -) a will work Thanks for pointing out the lack of precision. Am 16.05.20 um 11:46 schrieb Raul Miller: I was talking about the implementation. These are different results:

Re: [Jprogramming] .continue??

2020-05-21 Thread Hauke Rehr
I always thought the 'word.' control structures were meant to be c syntax lookalikes in order to tell you beware! you’re not writing idiomatic J here that’s why I thought they were chosen that way and if so, I’d agree Am 22.05.20 um 00:05 schrieb Henry Rich: Rejected.  I agree that 'continue'

[Jprogramming] jajh anyone?

2020-08-31 Thread Hauke Rehr
Hello all, some time ago I wrote three lines in reference to the Perlish JAPH meme; I’ve been unsatisfied with the approach taken so I never made it part of my email signature. Here it is: 'e t' =: '0$0';' 5@>? ,9:?30= 5 3,.60=' v =: (+/ - *:@{:) ,".@(']&'&,)@,._1 t <@(v&+&.(a.));._1

Re: [Jprogramming] Newton polynomial without using a loop?

2020-10-15 Thread Hauke Rehr
Hello Stefan, I guess by your name and email adress that you’re from austria so you could read and understand German. I took lecture notes last year in a Numerics course here at the university of Jena and implemented nearly all of the algorithms using J, with coloured J lines interspersed with

Re: [Jprogramming] computed shape

2020-08-21 Thread Hauke Rehr
Say u is your current processing and v tells what axes are meant to look like in the result. Then I think (v@$ $ u) data does the trick already. Looks like a simple conjunction to me. If otoh you don’t know v, J won’t either. Am 21.08.20 um 02:40 schrieb Henry Rich: I don't think it fits into

Re: [Jprogramming] Strange output.

2020-08-21 Thread Hauke Rehr
… and maybe you want to use rab2 =: -.&' ' Am 21.08.20 um 20:02 schrieb x...@xn--wxa.land: ]m=:<\ *: >: i.15 (sep @ ". @ (,&'x') @ rab @ ": @ ,)each m Appends a 'x' after each number string, so it will get interpreted as an extended number. Otherwise big numbers get converted to floats, e.g.

Re: [Jprogramming] Strange output.

2020-08-21 Thread Hauke Rehr
I’d start with something like <\ *: >:i.15 Am 21.08.20 um 19:46 schrieb Skip Cave: Also, is there a better way to generate increasing length sets of a vector? -- -- mail written using NEO neo-layout.org

Re: [Jprogramming] Strange output.

2020-08-21 Thread Hauke Rehr
I’d want to get rid of one @ in the chain at the expense of introducing rank <@( [: "."0 @ ; <@":"0)\ *: >: i. 15 Am 21.08.20 um 20:22 schrieb x...@xn--wxa.land: … and depending on what you want, there might be a better approach: parse the numbers, raze the strings, itemize the characters,

Re: [Jprogramming] Adverbs/conjunctions without uv updated in the new beta - please try it!

2020-08-15 Thread Hauke Rehr
I’ve been amoung that “distinguished list” as well until I guessed the way it worked but privately considered it bad style so I’m glad this change has been made Since it’s so simple a fix and in my opinion does improve consistency, I personally think this breaking change is more than justified.

Re: [Jprogramming] conditional application defined by bitmask

2020-08-17 Thread Hauke Rehr
dyadic m … first I thought I should learn this construct now I think I don’t need to any suggestions? is this considered an idiom that ought to be known and used? Am 17.08.20 um 16:20 schrieb Henry Rich: On the current implementation it is much preferable to use bitmask operator@]^:["0

Re: [Jprogramming] Given a depth vector, pretty print its tree

2020-08-17 Thread Hauke Rehr
… the last version (meant to be raul’s) doesn’t quite look right … can’t verify right now Am 17.08.20 um 16:49 schrieb 'Michael Day' via Programming: Late to the party - I had a look at the problem after the correspondence closed,  and have only just got home to my own wifi. I developed a few

Re: [Jprogramming] restricting permutations

2020-05-25 Thread Hauke Rehr
Sorry, 0 2 1 3 is obviously wrong, I meant to say 0 3 2 1 Am 25.05.20 um 14:01 schrieb Hauke Rehr: is this a more general task, or do you only ever have exactly four items to arrange that way? an easier way of doing what you did would be take any solution, the 0 2 1 3&{ of it, the |. of

Re: [Jprogramming] restricting permutations

2020-05-25 Thread Hauke Rehr
is this a more general task, or do you only ever have exactly four items to arrange that way? an easier way of doing what you did would be take any solution, the 0 2 1 3&{ of it, the |. of both, and apply (i.4) |."1 to all four. That sould get you all possible 16 solutions maybe someone else

Re: [Jprogramming] restricting permutations

2020-05-25 Thread Hauke Rehr
I sometimes don’t get the order of thoght and speech right. Sorry for shouting 16 prior to thinking well about it. For each first number, the third is fixed, so there are only two possible ways (permute the other 2). In total, that’s 8. Am 25.05.20 um 14:15 schrieb 'Mike Day' via Programming: I

Re: [Jprogramming] Condense a multidimensional array

2020-05-29 Thread Hauke Rehr
(;@;/ -: ,/) i. 12 2 4 1 Am 29.05.20 um 17:04 schrieb Thomas McGuire: I have a 3 dimensional array I want to squish it so the rows of the tables just stack on top of each other. i. 12 2 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 24 25 26 27 28 29 30 31 32 33 34

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
ally doing in J. Tom McGuire On May 29, 2020, at 11:19 AM, Henry Rich wrote: Right: (,/ y) is the idiom. Henry Rich On 5/29/2020 11:13 AM, Hauke Rehr wrote: (;@;/ -: ,/) i. 12 2 4 1 Am 29.05.20 um 17:04 schrieb Thomas McGuire: I have a 3 dimensional array I want to squish it so the rows of

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
iption or the input(s). Thanks, On Sat, May 30, 2020 at 3:27 AM Hauke Rehr wrote: [snip] My last use case was a boxed list consisting of a 1-d array and a set of transpositions I produced. I wrote (I bet there are better ways to do it) swap =: ] {~ ~.@[ C.@; <:@#@] and applied it on that b

Re: [Jprogramming] Condense a multidimensional array

2020-05-30 Thread Hauke Rehr
the verb would need to apply to L;P (in my current implementation since that’s what the mentioned iteration spits out) I don’t understand why the boxed pairs are boxed again in your last solution but I guess I’ll figure that one out I never learned ::, that might be the reason maybe I should

Re: [Jprogramming] tacit modifiers WAS: tacit

2020-06-01 Thread Hauke Rehr
a copy of the J4 Dictionary and study the parser as an exhibit of Ken mastery of computational forms.  Then fuggedaboutit.  Your onsub is fine. Henry Rich On 6/1/2020 10:30 PM, Hauke Rehr wrote: I usually do tacit programming with J, but what I mean by this is I don’t use x or y that is I can

[Jprogramming] tacit

2020-06-01 Thread Hauke Rehr
I usually do tacit programming with J, but what I mean by this is I don’t use x or y that is I can write tacit _verbs_ only. I know one can be tacit on modifier level etc but I didn’t ever learn how. 1. is there any good place to start learning? if not, would anyone mind putting together

Re: [Jprogramming] tacit

2020-06-02 Thread Hauke Rehr
helps, -- Raul On Mon, Jun 1, 2020 at 10:30 PM Hauke Rehr wrote: I usually do tacit programming with J, but what I mean by this is I don’t use x or y that is I can write tacit _verbs_ only. I know one can be tacit on modifier level etc but I didn’t ever learn how. 1. is there any good

Re: [Jprogramming] Programming Digest, Vol 176, Issue 17

2020-05-22 Thread Hauke Rehr
If you need to define your own grammar, use perl. Code is way more often read than written so it’s best not to have different flavours of language syntax floating around. You wouldn’t want to read alias definitions in order to be able to understand someone’s code nor would you want to refactor

Re: [Jprogramming] tacit

2020-06-02 Thread Hauke Rehr
need some rest and to write it down on paper before publishing too much incomplete/confusing stuff. Am 02.06.20 um 12:03 schrieb Hauke Rehr: sorry for the bad naming, I rewrote it too many times. whatshappeningalready is the same as v in my earlier post I had a working modifier mymod and wanted

Re: [Jprogramming] tacit

2020-06-02 Thread Hauke Rehr
mycurrentmod n y and without assigning its result. Am 02.06.20 um 11:53 schrieb Hauke Rehr: What you say is like (}. ;~ whatshappeningalready@{.)@u The problem is: whatshappeningalready uses [ and ] of the enclosing verb (ex- or implicitly) I could do (}. ;~ wha2)@([;];u) for some value of wha2

Re: [Jprogramming] tacit

2020-06-02 Thread Hauke Rehr
What you say is like (}. ;~ whatshappeningalready@{.)@u The problem is: whatshappeningalready uses [ and ] of the enclosing verb (ex- or implicitly) I could do (}. ;~ wha2)@([;];u) for some value of wha2 (an adjusted way of whatshappeningalready) but I thought maybe there’s a more elegant way of

Re: [Jprogramming] Adding constant to a specified element of a vector

2020-10-25 Thread Hauke Rehr
I’d expect it’s allocation and copying. And as you execute it in the repl, there’s no compiler involved. Rather, the JE “knows” it’s dealing with a single element only. Am 25.10.20 um 11:52 schrieb pietdion: > Ok. Thanks. > What explains the huge time difference? > Does the compiler somehow

[Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
I have an issue using ?. . ?. 2^y gives the same result for several y in a row. If I do ?. 2^y+i.x for the same successive values, the rng will iterate and values differ. I understand the difference between the two invocations and think it’s okay for them to give different results; but I

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
Yes, this is the way one should do it: set a custom random seed. Thanks Am 19.07.20 um 17:09 schrieb Julian Fondren: On 2020-07-19 09:36, Hauke Rehr wrote: If you don’t know about this and try to work with powers of two, switching to ?. someday since you want reproducible results, you might

Re: [Jprogramming] fixed pseudorandom ?. very pseudo on powers of 2

2020-07-19 Thread Hauke Rehr
much test code that depends on the exact behavior of ?. that we consider it untouchable. Henry Rich On 7/19/2020 8:33 AM, Hauke Rehr wrote: I have an issue using ?. .    ?. 2^y gives the same result for several y in a row. If I do    ?. 2^y+i.x for the same successive values, the rng will iterate

Re: [Jprogramming] Given a depth vector, pretty print its tree

2020-08-07 Thread Hauke Rehr
You could build a oneliner out of this multistage process: d =: 0 1 2 2 1 1 2 2 3 indent =: ' ' <@(#"0 1~) 0 >. <: +/ (i.@# /)"1 indent,.branch prefix =: '| ' <@#"0 1~ d - , -:@$@> infix ;"1 prefix ,. infix ,. <'o' which gives the desired result for d I didn’t test on

Re: [Jprogramming] Given a depth vector, pretty print its tree

2020-08-07 Thread Hauke Rehr
If the mountain graph suits you well, how about ,./ ((i.@#) ((' ' , ":@[) {~ =)"0 1 ]) d 0 1 2 2 1 1 2 2 3 ? Am 07.08.20 um 18:12 schrieb ethiejiesa via Programming: Thanks for the thoughts! not as pretty, but simpler and pretty enough? (":"0@i.@# (,~ #&'-')"1 0 ]) 0 1

Re: [Jprogramming] Given a depth vector, pretty print its tree

2020-08-07 Thread Hauke Rehr
O, I just wanted to write a follow-up to my cloumsy attempts but this one is obviously way better. Still, it depends on what you want to be able to see at first glance and how much of your 'terseness requirement' you are willing to sacrifice for it. Am 07.08.20 um 18:44 schrieb

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
my finiteinteger verb (quote: finiteinteger =: ((= <.) *. (~: <:)) keepfinint =: (#~ finiteinteger) endquote) does what you want in your simple case but still, big floats may be troublesome, just as Henry pointed out Am 02.08.20 um 15:00 schrieb Skip Cave: I see: (<.= >.) 1 2.5 __ 3 4.5 6

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
I was not surprised by the results. What concept of _ do you have in ^:_ if not one of an “integer?” Furthermore, (<: <: <.) *. (>: >: >.) is true for any numeric value. I think it’s obvious that _ is an identity to both (= <:) and (= >:) – and so both <. and >. must return _ as well (likewise

Re: [Jprogramming] Floor of infinity

2020-08-02 Thread Hauke Rehr
Sorry, not “_ is an identity to both (= <:) and (= >:)“ but “ _ and __ are identities to bot <: and >:” or “_ and __ are the only values satisfying both (= <:) and (= >:)” … except for NaN (_.), but that’s not exactly the topic here I think. Am 02.08.20 um 12:52 schr

Re: [Jprogramming] Floor of infinity

2020-08-03 Thread Hauke Rehr
… and maybe N/A or NaN or whatever you call _. . Am 03.08.20 um 09:04 schrieb Devon McCormick: You probably don't want negative infinity either: ([: (] #~ (= <.)) _ __ -.~ ]) 1 2.5 _ 3 4.5 6 __ 1 3 6 On Mon, Aug 3, 2020 at 3:01 AM Devon McCormick wrote: You could just remove the

[Jprogramming] tacit syntax again

2020-07-09 Thread Hauke Rehr
Hello everybody, I wonder if there’s a simple way to “@:/“ a sequence of steps: say I want to apply verbs a,b,c,d,e in turn, I could say sequence =: 3 : 0 e d c b a y ) turning sequence tacit sequence =: e@:d@:c@:b@:a or sequence =: [: e [: d [: c [: b a (this is 13:’s suggestion) I’d rather

Re: [Jprogramming] tacit syntax again

2020-07-09 Thread Hauke Rehr
juil. 2020 à 11:26, Hauke Rehr a écrit : Hello everybody, I wonder if there’s a simple way to “@:/“ a sequence of steps: say I want to apply verbs a,b,c,d,e in turn, I could say sequence =: 3 : 0 e d c b a y ) turning sequence tacit sequence =: e@:d@:c@:b@:a or sequence =: [: e [: d [: c

Re: [Jprogramming] tacit syntax again

2020-07-09 Thread Hauke Rehr
Thanks Julian, you described exactly the way I came up with this question. I’ve not been aware 13: is used other than as a hint on how to make a verb tacit. Seeing its use in J packages, I’ll no longer hesitate using it. I now find I thought manually crafted tacit verbs must be better in some

Re: [Jprogramming] Boxing Issues

2020-07-07 Thread Hauke Rehr
Hi Skip, this is how I would try to achieve what you’re after ] suits =: u: 9824 9827 9829 9830 ♠♣♥♦ ;/ values =: (3 2 $ ' J Q K') , ": >: i. 10 1 ┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐ │ J│ Q│ K│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│ 9│10│ └──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘ deck =: ,/

[Jprogramming] +. and binary patterns

2020-06-17 Thread Hauke Rehr
I have two binary patterns, e. g. a =. 0 1 0 [ b =. 0 0 1 0 0 with a <&$ b Here is a simple way to get what I want: a2 =. (a *&$ b) $ a [ b2 =. (a *&$ b) $ b NB. I need the whole (a *&$ b) patterns NB. for a and b are of relatively prime $s or1 =. a2 +. b2 with my example patterns that’s: a2:

Re: [Jprogramming] Generating multiple length vectors from a single vector

2020-06-23 Thread Hauke Rehr
But this does: tt =: 3 : 0 <\ y : (<: x) { <\ y ) tt >: i.6 ┌─┬───┬─┬───┬─┬───┐ │1│1 2│1 2 3│1 2 3 4│1 2 3 4 5│1 2 3 4 5 6│ └─┴───┴─┴───┴─┴───┘ 2 4 5 tt >: i.6 ┌───┬───┬─┐ │1 2│1 2 3 4│1 2 3 4 5│ └───┴───┴─┘ tt"1 n

Re: [Jprogramming] zip API

2020-06-25 Thread Hauke Rehr
As everyone tosses in their 2¢ on this, here are mine: Back in the days when I had to work with machines infested with that big fat virus called windows, I also used 7zip. Nowadays, I usually tar and untar everything that needs compression. Am 26.06.20 um 00:24 schrieb HH PackRat: On 6/25/20,

Re: [Jprogramming] Fwd: problem with math/uu

2020-06-28 Thread Hauke Rehr
I think the question was rather about 1e_6 = % *: 1e_3 0 Instead, 1e6 = % *: 1e_3 1 But I don’t know math/uu; is / supposed to denote %? Does uu '1 /(mm^2)' work? Am 28.06.20 um 18:15 schrieb Tom Arneson: Why? 1e6=*:1000 1 On June 27, 2020 at 7:31 AM Mario C wrote: There is an other

Re: [Jprogramming] tacit

2020-06-03 Thread Hauke Rehr
into a conjunction (introducing a v) and thus perform an arbitrary operation on more than the 'bodyrows'. I hope this helps, -- Raul On Mon, Jun 1, 2020 at 10:30 PM Hauke Rehr wrote: I usually do tacit programming with J, but what I mean by this is I don’t use x or y that is I can write tacit _

Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-08 Thread Hauke Rehr
Does this test2 actually “specify the rank on the test verb?” I think " takes the entire verb phrase to its left which imo is the result of the agenda, not the test only. Am 08.06.20 um 14:45 schrieb çağlar girit: Hello Henry, Yes I'm using J9.02. I saw your explanation in the NuVoc writeup

Re: [Jprogramming] tacit

2020-06-03 Thread Hauke Rehr
Judgement I should follow until I know the language much better myself. Thanks for all the responses. Am 03.06.20 um 15:40 schrieb Henry Rich: Write it using x and y, and assignment of intermediate results. Henry Rich On 6/3/2020 3:35 AM, Hauke Rehr wrote: Once again, starting with my example

Re: [Jprogramming] rank error for 0: ` 1: ` 2: @. (3&|) i.7

2020-06-07 Thread Hauke Rehr
test1 i.6 doesn’t work for me either but both test1"0 i.6 and test1"0 i.7 do work as expected Am 07.06.20 um 16:35 schrieb çağlar girit: Hi, Although I have read NuVoc entries for Agenda and Constant Function, I still don't understand why for "test1 =. 0: ` 1: ` 2: @. (3&|)", "test1 i. 6"

Re: [Jprogramming] J and Spreadsheets

2021-01-11 Thread Hauke Rehr
rically is not always useful. Picturing the orbit > of an electron was an obstacle to physicists trying to understand quantum > mechanics. Ordinal fraction arithmetic is very simple, and geometric > interpretations are in my experience unhelpful. So my advice is: understand > the arithme

Re: [Jprogramming] (i)jconsole and stdin

2021-01-12 Thread Hauke Rehr
t to ijconsole by name. Is this also not > possible? > > On Tue, 12 Jan 2021 at 16:01, Hauke Rehr wrote: >> >> Usually, languages designed to be as scripts from the command line >> check for the first line to be a shebang line* and ignore it. >> Not so with J, so the li

Re: [Jprogramming] (i)jconsole and stdin

2021-01-12 Thread Hauke Rehr
Usually, languages designed to be as scripts from the command line check for the first line to be a shebang line* and ignore it. Not so with J, so the line is executed just like all subsequent ones. I hope this is what you wanted to know. * some don’t need to since # is amoung their

Re: [Jprogramming] Trouble understanding the Fold family

2020-12-25 Thread Hauke Rehr
t; M e. V > > :-) > > On Sat Dec 26, 2020 at 1:18 AM CET, Thomas Bulka wrote: >> Hi Hauke, >> >> thank you very much. This works perfectly. Looks, like I’ve been >> thinking to complicated, again... >> >> Regards, >> >> Thomas >> >

Re: [Jprogramming] Trouble understanding the Fold family

2020-12-25 Thread Hauke Rehr
+/ M e."_ 0 V does the job Am 26.12.20 um 00:55 schrieb Thomas Bulka: > Hello forum, > > currently I try to make use of the Fold family of primitives to achieve > a rather simple (I think) task. However, I have not been able to reach > the desired goal. This is, what I want to do: > > Suppose,

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
Do I understand correctly that this algebra of data thing can essentially be represented as a tree (or wood)? Looks like one could easily represent this using the LEO editor, maybe even annotating each node and having a top level script that walks the tree according to the input. Am 07.01.21 um

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
Why only moderate? csv/tsv is amoung the best in scalability, way more reliable than spreadsheets (afaik) Of course, customized databases can be better. Am 07.01.21 um 23:07 schrieb Devon McCormick: > To be clear, I was expressing caution about spreadsheets with embedded > formulas and code.

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
On Thu, Jan 7, 2021 at 5:13 PM Hauke Rehr wrote: > >> Why only moderate? >> csv/tsv is amoung the best in scalability, >> way more reliable than spreadsheets >> (afaik) >> Of course, customized databases can be better. >> >> Am 07.01.21 um 23:07 schrieb De

  1   2   3   4   5   >