Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread Don Kelly
check out 'Libre Office' which is free and from what i see, can run on Linux. I prefer it to Microsoft Office although I rarely use ther Excel equivalent. Don Kelly On 2021-01-05 7:40 a.m., Justin Paston-Cooper wrote: Hello, I don't know much Excel, and I know some J. The dataflow aspect of

Re: [Jprogramming] String to Rational

2021-01-06 Thread Raul Miller
[second attempt at sending -- i had sent this earlier, but apparently it never made it out.] Here's a quicky which handles arbitrary decimal fractions as rationals. It will have problems if you try it on numbers which include letters already in their representation. It may have other issues, since

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread jph . butler
Sorry, I have only enountered batch mode requirements using closed Excel files. ssconvert does have a --recalc option though, so it might work with a file opened with LibreOffice. De : Justin Paston-Cooper À : Programming forum Sujet : Re: [Jprogramming] J and Spreadsheets Date : 06/01/2021 2

Re: [Jprogramming] String to Rational

2021-01-06 Thread Justin Paston-Cooper
Thanks. That should do the job. On Wed, 6 Jan 2021 at 21:04, Devon McCormick wrote: > > I suspect you are messing around with meaningless precision if these > numbers are coming from a spreadsheet since they are already in floating > point format there but this may do what you need: > > stringToR

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread Justin Paston-Cooper
Is communication between J and Excel automatic? This is important to me. I am wondering how you would make sure that Excel stops updating before sending over to J, and take the next message from J only when Excel has finished updating. On Wed, 6 Jan 2021 at 23:38, wrote: > > Justin, > > > > On a

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread jph . butler
Justin, On a very pragmatic level, I just use CSV as the interchange format. Not ideal but it works. Excel -> CSV -> J    + step1 (Linux) : ssconvert -S   ssconvert ships with gnumeric, works pretty well and is low hassle    + step 2 (Linux): Jd J -> CSV -> Excel    + step 1 (Linux)

Re: [Jprogramming] String to Rational

2021-01-06 Thread Devon McCormick
I suspect you are messing around with meaningless precision if these numbers are coming from a spreadsheet since they are already in floating point format there but this may do what you need: stringToRational=: 3 : 0 if. 1=#tmp=. <;._1 '.',y do. tmp=. tmp,<,'0' end. ".(;tmp),'r1','0'$~#;1{tm

Re: [Jprogramming] String to Rational

2021-01-06 Thread Henry Rich
For domain errors, Look at the Dissect tool. Henry Rich On 1/6/2021 3:40 AM, Justin Paston-Cooper wrote: I should add how it works: On the right, 10^(The position of '.' in the number minus 1) On the left, remove '.' and parse as number In the middle, apply x: to both sides and divide. Also,

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread Don Guinn
It was called ADRS - A Departmental Reporting System On Wed, Jan 6, 2021 at 3:34 AM Justin Paston-Cooper wrote: > I am not sure what kind of interfaces were available in the old days. > I have never really used spreadsheets, but for me there would be a > strict increase in utility in being able

Re: [Jprogramming] String to Rational

2021-01-06 Thread Ric Sherlock
I don't see what you mean by "doesn't give the number you suggest". I think I am missing something. 3/50 is equal to 666.66. 333/50 is equal to 6.66. This is what I expected. Sounds like this is just a typo or copy/paste error then. Above you suggested: stringToRational '666.66' should give 3

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread Justin Paston-Cooper
I am not sure what kind of interfaces were available in the old days. I have never really used spreadsheets, but for me there would be a strict increase in utility in being able to edit and display data in a spreadsheet as opposed to keeping track of various variables and manually figuring out whic

Re: [Jprogramming] J and Spreadsheets

2021-01-06 Thread Scott Locklin
Two alternatives: there's R methods for dealing with OpenOffice, and a J package for calling R methods. Probably not the experience you're looking for. There's also a couple of QT demos which have a spreadsheet like interface if you just want the experience of seeing the data laid out in graphical

Re: [Jprogramming] String to Rational

2021-01-06 Thread Raul Miller
The x: mechanism does first convert to floats, and then to rationals. As long as your values are not too large, the result should be exact. I imagine that it would be nice if dyadic ". or a workalike could support direct interpretation as rational numbers. FYI, -- Raul On Wed, Jan 6, 2021 at

Re: [Jprogramming] String to Rational

2021-01-06 Thread Justin Paston-Cooper
I realise that '1234.00' is not being parsed correctly. Will need to account for all zero after the decimal point. It is also wrong for numbers without a point. On Wed, 6 Jan 2021 at 12:29, Raul Miller wrote: > > I would not combine those ideas. > > Either should work alone, just fine (though you

Re: [Jprogramming] String to Rational

2021-01-06 Thread Justin Paston-Cooper
Thanks. Seems to be working now, even with a parenthesis removed from each end. I wasn't getting a syntax error. Weird. I don't see what you mean by "doesn't give the number you suggest". I think I am missing something. 3/50 is equal to 666.66. 333/50 is equal to 6.66. This is what I expected.

Re: [Jprogramming] String to Rational

2021-01-06 Thread Raul Miller
I would not combine those ideas. Either should work alone, just fine (though you need to be careful that you've always got .00 for the ones that need it, if you are removing the decimal point). FYI, -- Raul On Wed, Jan 6, 2021 at 2:20 AM Justin Paston-Cooper wrote: > > Thanks for the suggesti

Re: [Jprogramming] String to Rational

2021-01-06 Thread Ric Sherlock
Hi Justin, I'm not entirely clear what your desired behaviour/use case is, however if you add another closing parenthesis then your definition above does not give a (syntax) error, but doesn't give the number you suggest. stringToRational =: ((_&".)@(-.&'.') %&:x: 10&^@(<:@# - (i.&'.'))) stringTo

Re: [Jprogramming] String to Rational

2021-01-06 Thread Justin Paston-Cooper
I should add how it works: On the right, 10^(The position of '.' in the number minus 1) On the left, remove '.' and parse as number In the middle, apply x: to both sides and divide. Also, how can I go about actually debugging domain errors? Both sides seem to be zero-dimensional. On Wed, 6 Jan 2