Re: [Jprogramming] AOC Day 22 - was Re: Advent of Code Day 14

2022-01-06 Thread Eugene Nonko
Wait til you get to 24. That one was the most difficult for me. It's not really about programming, more like an old-fashioned logic puzzle. On Wed, Jan 5, 2022 at 4:08 PM 'Michael Day' via Programming < programm...@jsoftware.com> wrote: > I don't think there are any spoilers here. > > Well, I ha

Re: [Jprogramming] AOC Day 22 - was Re: Advent of Code Day 14

2022-01-10 Thread Eugene Nonko
er wrote: > > > > Personally, I have yet to solve 24. I'm still working on the second half > of 23. > > > > -- > > Raul > > > >> On Thu, Jan 6, 2022 at 1:30 PM Eugene Nonko wrote: > >> > >> Wait til you get to 24. That one wa

Re: [Jprogramming] Advent of Code Day 24

2022-01-13 Thread Eugene Nonko
> add digit13 7 NB. Y249=: Y248 add 7[ 8 thru 16 > mul Y249 X241 NB. Y250=: Y249 mul X241 [ 0 thru 16 > add Z246 Y250 NB. Z251=: Z246 add Y250 [ 0 thru 5520918016 > > I am currently working on some tree unification mechanisms (maximum

[Jprogramming] LCM performance

2019-03-10 Thread Eugene Nonko
I need to find the smallest number that divides all numbers from 1 to n. The solution, of course is this: *./ >: i. n What I don't understand is why this solution seems to scale so poorly: 6!:2 '*./ >: i.1x' 0.326128 6!:2 '*./ >: i.11000x' 1.00384 6!:2 '*./ >: i.12000x' 4.133 6!:

Re: [Jprogramming] LCM performance

2019-03-11 Thread Eugene Nonko
Haskell does not have any clever way to short-circuit evaluation of LCM for arbitrary precision Integer type. LCM is defined as follows: lcm _ 0 = 0 lcm 0 _ = 0 lcm x y = abs ((x `quot` (gcd x y)) * y) And GCD is implemented straightforwardly using Euclid algorithm: g

Re: [Jprogramming] LCM performance

2019-03-11 Thread Eugene Nonko
in J, and the fact that *. must manipulate these > extended precision integers more often than other verbs. > > > > Indeed, If you remove the 'x', it runs extremely fast. > > > > From: Programming on behalf > of Eugene Nonko > > S

[Jprogramming] 0 % 0

2019-05-27 Thread Eugene Nonko
Hello, Can someone please explain this: 0 % 0 0 Thanks, Eugene -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Converting if statement

2019-09-09 Thread Eugene Nonko
Hello, I have this recursive dyad defined to calculate modular matrix exponential by squaring: pow =: 4 : 0 if. y = 1 do. x else. (] ` (x & mul) @. (2 | y)) mul~ x pow <. -: y end. ) (mul verb can be defined to perform simple multiplication, then it will work for regu

[Jprogramming] A personal history of APL

2023-12-03 Thread Eugene Nonko
I think a lot of people here would enjoy that: https://ed-thelen.org/comp-hist/APL-hist.html -- Eugene -- For information about J forums see http://www.jsoftware.com/forums.htm