Re: [Jprogramming] LCM performance

2019-03-10 Thread james faure
= 0 lcm x y = abs ((x `quot` (gcd x y)) * y) ________ From: Programming on behalf of james faure Sent: Sunday, March 10, 2019 11:42 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] LCM performance For reference, the haskell implementation doesn't ha

Re: [Jprogramming] LCM performance

2019-03-10 Thread james faure
For reference, the haskell implementation doesn't have any special magic to it, besides the lazy list handling: gcd :: (Integral a

Re: [Jprogramming] LCM performance

2019-03-10 Thread james faure
That, I suspect, can be blamed mostly on the abysmally slow extended precision integers 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: Programm

Re: [Jprogramming] getline

2018-06-19 Thread james faure
stdin is defined as 1!:1@3: also perhaps I should have mentionned I want it to work from within a script From: james faure Sent: Tuesday, June 19, 2018 11:05:14 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] getline Either way, it's no

Re: [Jprogramming] getline

2018-06-19 Thread james faure
t;0]1". Sent from my Verizon, Samsung Galaxy smartphone Original message From: Michal Wallace Date: 6/19/18 16:06 (GMT-05:00) To: programm...@jsoftware.com Subject: Re: [Jprogramming] getline readln =: [: (1!:01) 1: On Tue, Jun 19, 2018 at 2:45 PM james faure wrote:

[Jprogramming] getline

2018-06-19 Thread james faure
Hello, how can one read stdin one line at a time ? #! /usr/bin/j8 stdin'' is no good. -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] ncurses mvwaddch@newwin unexpected behaviour

2018-05-27 Thread james faure
my 64-bit debian libncurses.so.5 Сб, 26 мая 2018, james faure написал(а): > Allright, I came back to this today, and the macro theory doesn't hold for > wmove, which is definitely not a macro, but fails with the same symptoms: > > > stdscr_ncurses_ =: initscr'' >

Re: [Jprogramming] ncurses mvwaddch@newwin unexpected behaviour

2018-05-26 Thread james faure
I'm busy in other projects at the moment. You are welcome to provide patch for it. Чт, 17 мая 2018, james faure написал(а): > Indeed, almost all of the mv* functions are macros; > > The 'api/ncurses' script has redefined some of these for use in J, but hasn't > do

Re: [Jprogramming] Quora Problem

2018-05-19 Thread james faure
time, you still wouldn't get to a solution. A better strategy is to read about partitions and generating functions thereof. Henry Rich On 5/19/2018 5:58 PM, james faure wrote: > This is a good example of a very annoying limitation of the current > interpreter's eager eval

Re: [Jprogramming] Quora Problem

2018-05-19 Thread james faure
This is a good example of a very annoying limitation of the current interpreter's eager evaluation strategy, in this case one is forced to come up with some sort of non-idiomatic iterative 'hack' to get a result. Concretely, I guess you're forced to use an accumulator with ^: or an explicit loop

Re: [Jprogramming] Quora Problem

2018-05-19 Thread james faure
This is a good example of a really annoying limitation of the current interpreter's eager evaluation strategy, in this cases one is forced to come up with some sort of non idiomatic iterative 'hack' to get a result. Concretely, I guess you're forced to use an accumulator with ^: or an explicit l

Re: [Jprogramming] ncurses mvwaddch@newwin unexpected behaviour

2018-05-17 Thread james faure
mvwaddch@newwin unexpected behaviour some ncurses functions are implemented as macro. C compliers can expand them into real function call during compilation but J can't. I'll look if this is the reason why window functions failed. On Fri, May 18, 2018, 6:48 AM james faure wrote: > H

[Jprogramming] ncurses mvwaddch@newwin unexpected behaviour

2018-05-17 Thread james faure
Hello, Just wrote a classic snake game in ncurses, however I came across something inexplicable - The code below hangs for a sec, then exits. The problem is presumably with the mvwaddch function. mvwaddstr also fails. I was able to circumvent this by simply using the default screen returned by in