Re: [Jprogramming] Programming question

2022-01-23 Thread Raul Miller
If you are working with a limited range, you can use I. to conduct the search. For example, ones1=: (1,1&<,1&=,])@{. +/@:* (0:`$:@.(0<#),(10^#),(1+10#.]),#*10^#-1:)@}. ones=: 10 ones1@:(#.inv)"0 ] senO=: ] I.~ [: +/\1+/"1@:=10 #.inv [: i. +:@]^:(> ones)^:_~ Here, I used a golfed version of Hauk

Re: [Jprogramming] Programming question

2022-01-23 Thread Jan-Pieter Jacobs
Hi Skip, When using n (or v) as names in a direct definition, it assumes you're defining a conjunction: F=.{{{.n#~y=+/\c1 n=.>:i.100}} F 19 F(19) type <'F' ┌───┐ │conjunction│ └───┘ FF=:{{{.nn#~y+/\c1 nn=.>:i.100}} type<'FF' ┌┐ │verb│ └┘ or you can explici

Re: [Jprogramming] Programming question

2022-01-23 Thread Hauke Rehr
ones1 reads better than the original. factoring out {. and }. really helps. even though it means pairs of factors are “distributed” and one doesn’t immediately see which one is corresponding. if it hadn’t been for having it fit on one line, I had kept the recursive call separate, though. Am 23.01

Re: [Jprogramming] Programming question

2022-01-23 Thread Raul Miller
Yeah, but I was just waking up and did not read Cliff's message carefully enough. Here's what I think he was after: c1=: {{+/1=10#.^:_1]y}}"0 F=: {{{.N#~y=+/\c1 N=.>:i.10>.5*y}} F 213 521 This uses his proposed components, achieves what he asked for, and eliminates the 'n' which would make F

Re: [Jprogramming] Programming question

2022-01-23 Thread Hauke Rehr
golfing a bit more, just for fun (but it may improve performance a tiny bit, too) ones1=: (1(,,<,=){.) +/@:* (0:`$:@.(0<#),X)@}. where XX…XX is either of (*10^<:)@#,(10^#),1+10#.] (,&1*10^(,~<:))@#,1+10#.] (,&1*10^_1 0&+)@#,1+10&#. I thought I would squeeze more than 1 s

Re: [Jprogramming] Advent of Code Day 23

2022-01-23 Thread 'Michael Day' via Programming
Chat really - sorry! An update on my progress on this so-far elusive problem for me, part2 at least. I _nearly_ got the right answer - tweaking the code resulted in being able to reach a termination of the tree-search - too high! - another tweak - too low! further tweaks - explosion of sear

Re: [Jprogramming] Advent of Code Day 23

2022-01-23 Thread Raul Miller
On Sun, Jan 23, 2022 at 2:03 PM 'Michael Day' via Programming wrote: > Then I noticed: NB. I MISSED THIS POINT! > NB. Once an amphipod stops moving in the hallway, it will stay in > NB. that spot until it can move into a room. (That is, once any > NB. amphipod starts moving, any other amphip

Re: [Jprogramming] Advent of Code Day 23

2022-01-23 Thread 'Mike Day' via Programming
So I’d missed the 2-moves restriction, too. That significantly reduces the possible number of states! Cheers, Mike Sent from my iPad > On 23 Jan 2022, at 19:10, Raul Miller wrote: > > On Sun, Jan 23, 2022 at 2:03 PM 'Michael Day' via Programming > wrote: >> Then I noticed: NB. I MISSED TH

[Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread 'robert therriault' via Programming
Hello everyone, I had an email from a listener to the podcast who was wondering if the new versions of J are useful for exploring OpenGL. It sounds like they had done experimenting with J604 and were wondering if there was a path forward with J903. Any information that you can provide about

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread Raul Miller
OpenGL has changed over the years (new versions, obsolescence of old versions), and the J's interface to OpenGL has changed over the years. It's still possible to find and use a variety of older versions. And, because documentation takes quite some effort to put together, it can be advantageous, w

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread bill lam
(Resent. Sorry if duplicated) Opengl 4.1 is supported on all Mac in the past decade but it had been frozen and no newer version will be supported. https://support.apple.com/en-us/HT202823 However Qt default to pick Opengl 2.1 (or 1.2?), wd command supported a version parameter to set it to 4.1 bu

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread Elijah Stone
On Sun, 23 Jan 2022, Raul Miller wrote: But that demo does not work on my OSX (Mojave) machine (which has OpenGL 1.2). For whatever reasons (possibly including availability of good documentation), Apple has been slow to adopt newer versions of OpenGL Huh ... AFAIK apple stopped at opengl 4.2

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread Raul Miller
On Sun, Jan 23, 2022 at 9:14 PM Elijah Stone wrote: > On Sun, 23 Jan 2022, Raul Miller wrote: > > But that demo does not work on my OSX (Mojave) machine (which has OpenGL > > 1.2). For whatever reasons (possibly including availability of good > > documentation), Apple has been slow to adopt newer

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread bill lam
Another reference https://www.khronos.org/opengl/wiki/Programming_OpenGL_on_macOS you can try edit the file shader.ijs in addons/demos/qtdemo around line 11 from minwh 300 300;cc g opengl flush; to minwh 300 300;cc g opengl version 4.1 flush; the version of GLSL is different from the version of

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread Raul Miller
That's an improvement. After changing the minwh line to specify opengl version 4.1, I get text (keys... scale... angle... matrix...) on the opengl screen (previously it was just black). And, the text is updating - if I recall correctly, though, I believe I should also be seeing a rotating cube. An

Re: [Jprogramming] How well does OpenGL work with J903?

2022-01-23 Thread bill lam
Thank you for this report. I also encountered the same issue on apple m1. Norman Drinkwater reported that it worked in vm (a rotating cube) but not on physical machine. I'll investigate further. On Mon, Jan 24, 2022, 11:47 AM Raul Miller wrote: > That's an improvement. > > After changing the m

[Jprogramming] Rank, transpose

2022-01-23 Thread Elijah Stone
Suppose I would like to normalise a vector. Easy: %+/&.:*:. Nice and pretty, gotta love under. What if I've got an array of vectors, and I want to normalise all of them? There are two ways, corresponding to two different representations: %+/&.:*:"1 and %"_1 _ +/&.:*:. The former corresponds

Re: [Jprogramming] Rank, transpose

2022-01-23 Thread Hauke Rehr
Asked for thoughts, so here they go: How many operations can be optimized to not actually bring it to the front? (special combinations wrt the t. family) Not that many, I think. So it’s better to actually 1. prepare your data layout and =: the result 2. apply an easily understood algorithm to it

Re: [Jprogramming] Rank, transpose

2022-01-23 Thread Elijah Stone
On Sun, 23 Jan 2022, Elijah Stone wrote: %"_1 1 can be written as %&.(0&|:`a:) oops, %"_1 _ t. t: t.. t:: Maybe redundant but still worthwhile expansion: u t. 1 2 3 should use axes 1, 2, and 3 for the monadic, dyadic left, and dyadic right cases, respectively, as rank. u t. (1 2;a:;3)

Re: [Jprogramming] Rank, transpose

2022-01-23 Thread Elijah Stone
On Mon, 24 Jan 2022, Hauke Rehr wrote: How many operations can be optimized to not actually bring it to the front? (special combinations wrt the t. family) I expect that most verbs which currently have IRS (integrated rank support) could be easily extended with integrated transpose support.

Re: [Jprogramming] Rank, transpose

2022-01-23 Thread Hauke Rehr
In that case: I stand corrected. Am 24.01.22 um 06:06 schrieb Elijah Stone: When I said 'harder to implement performantly', I was thinking of virtual nouns for verbs _without_ IRS/ITS.  But it occurs to me that it is not actually significantly more work, though you do need a new array repres