Re: [Jprogramming] Progressive insertion into a string

2021-02-03 Thread Hauke Rehr
I wanted to do it without looping. But my solution was incorrect. The error just didn’t show with the examples given. Maybe I’ll find a better way. Or at least refactor it a bit. For now, this is at least correct: i =: 0 -.~ (* i.@#) s =: 2 : 0 a =. i m=y n a} y ) NB. ugly, repetitive junk solu

Re: [Jprogramming] Progressive insertion into a string

2021-02-03 Thread Ben Gorte
Think I've got it: data1 =: 'THEEQUICKBROWFFOX' data2 =: 'THEEQUICKBROWFOOX' {{ ((+where&<)#y) {. ({.&y ,'X', }.&y) where =. >: +: 1 i.~ _2 =/\ y,'XX',(2|#y){.'X' }}^:_ data1 THEXEQUICKBROWFXFOX {{ ((+where&<)#y) {. ({.&y ,'X', }.&y) where =. >: +: 1 i.~ _2 =/\ y,'XX',(2|#y){.'X' }}^:_ data2

Re: [Jprogramming] 903-beta-d

2021-02-03 Thread Don Kelly
I have the same problem but  it is listed as beta-d commercial /2021-02-03T11:16:21 Don Kelly On 2021-02-03 3:44 p.m., Julian Fondren wrote: Are you sure you upgraded? I discovered that loading nonexistent files breaks beta-c just minutes before the beta-d release (because I wasn't subscribed

Re: [Jprogramming] Progressive insertion into a string

2021-02-03 Thread Hauke Rehr
I show this only as a different way to deal with it. There’s much space for improvement. It works correctly with the two examples you gave. data1 =: 'THEEQUICKBROWFFOX' data2 =: 'THEEQUICKBROWFOOX' res1 =: 'THEXEQUICKBROWFXFOX' res2 =: 'THEXEQUICKBROWFOOX' s =: 2 : 0 a =. 0 -.~ (* i.@#) m=y n a

Re: [Jprogramming] Progressive insertion into a string

2021-02-03 Thread Raul Miller
I would be tempted to go with dedouble=: #!.'X'~ 1 j. #{.}.=}: But I do not understand why the double O in your second example does not get an X inserted. So maybe I am missing something. I hope this helps, -- Raul On Wed, Feb 3, 2021 at 11:02 PM Ric Sherlock wrote: > > I need to separate an

Re: [Jprogramming] cube roots of negative numbers

2021-02-03 Thread Roger Hui
In the history of APL, _8^%3 (for example) once gave _2 as a result. When complex numbers were introduced, the definition of x^y was changed to the more general *y*^.x, and _8^%3 no longer gave the _2 result but produced the principal cube root of _8: ^ (%3) * ^. _8 1j1.73205 ^. _8 2.07944

[Jprogramming] cube roots of negative numbers

2021-02-03 Thread J. Patrick Harrington
I was wondering about the rational for the choice of the cube root returned for a negative number. I expected the real root to be returned, e.g., (_8)^(%3) --> _2  but J gives 1j1.73205. This is the case in other languages as well, so no doubt there is a mathematical justification for this. In

[Jprogramming] Progressive insertion into a string

2021-02-03 Thread Ric Sherlock
I need to separate any digraphs in a string, that consist of 2 letters the same, by inserting an 'X' between them. _2 ]\ 'THEEQUICKBROWFFOX' TH EE QU IC KB RO WF FO X 'EE' is a digraph that needs an 'X' inserted. Doing so will result in: TH EX EQ UI CK BR OW FF OX So now we also need to separ

Re: [Jprogramming] 903-beta-d

2021-02-03 Thread Julian Fondren
Are you sure you upgraded? I discovered that loading nonexistent files breaks beta-c just minutes before the beta-d release (because I wasn't subscribed to the beta list and missed the discussion), so this is the first thing I checked after release. JVERSION should include Beta-d: commercial/2021

Re: [Jprogramming] 903-beta-d

2021-02-03 Thread 'Michael Day' via Programming
Thanks. I've updated to beta-d. Having had a bit of trouble with crashing on loading errors,  I find that    load'noname'    NB. just after firing up JQt correctly reports 'not found: /noname' on the first attempt, but crashes J903 beta-d on the second attempt. OK in J902. This is in Win

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread bill lam
J source doesn't include openssl as submodule. Only a minimal subset for supporting sha is included. No big number. On Thu, Feb 4, 2021, 6:56 AM 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > GMP has the same decimal export/import functions as openssl. It has > rational s

Re: [Jprogramming] duplicate jd table in current db

2021-02-03 Thread Raoul Schorer
Thanks Julian, "works" is all I need! Cheers, Raoul On Wed, Feb 3, 2021 at 11:53 PM Julian Fondren wrote: > I don't know if this is ideal, but it works: > >jd'read /table newts * from ts' > > On 2021-02-03 16:41, Raoul Schorer wrote: > > Dear all, > > > > I'd like to duplicate the 'ts' tabl

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread 'Pascal Jasmin' via Programming
GMP has the same decimal export/import functions as openssl.  It has rational support that behaves the same as J (gcd reduce after each operation).  It has "fancier" multiplication algorithms.  I'm not aware of it having hashing or cryptographic functions though. I don't know if the openssl alr

Re: [Jprogramming] duplicate jd table in current db

2021-02-03 Thread Julian Fondren
I don't know if this is ideal, but it works: jd'read /table newts * from ts' On 2021-02-03 16:41, Raoul Schorer wrote: Dear all, I'd like to duplicate the 'ts' table in my 'db' database. The documentation and tutorial shows how to do this between two databases, but when I try: jd'tableco

[Jprogramming] duplicate jd table in current db

2021-02-03 Thread Raoul Schorer
Dear all, I'd like to duplicate the 'ts' table in my 'db' database. The documentation and tutorial shows how to do this between two databases, but when I try: jd'tablecopy newts ts db' |Jd error: srcdb same as snkdb: op:tablecopy db:db user:u : jd_jd_ | 13!:8&3 t So, obviously it's not design

[Jprogramming] 903-beta-d

2021-02-03 Thread Eric Iverson
903-beta-d is available for windows/linux/macos. If you already run J903-beta, then upgrade is easy: load'pacman' 'upgrade'jpkg'' NB. ensure base library and addons are current 'upgrade'jpkg'jengine' If you have not yet installed J903-beta, time to get started! https://code.jsoftware.

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Roger Hui
Sorry, I was wrong. In fact: >3 : '6!:2 ''p*q'' [ p=: ?10x^y [ q=: ?10x^y' "0 ]100 200 400 800 > 1.35285e_5 3.40545e_5 0.000132952 0.000496822 2 %~/\ 1.35285e_5 3.40545e_5 0.000132952 0.000496822 2.51724 3.90409 3.73685 Doubling the number of digits more than doubles the time: quadratic

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Henry Rich
There will be no new 3!:0 type! Compatibility with 3!:1 is not vital.  The library needs to support 32- and 64-bit systems. Henry Rich On 2/3/2021 4:30 PM, 'Pascal Jasmin' via Programming wrote: Yes it is base 1, sorry. The big decisions on the changes are: 32 or 64bit base? change the 3

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Henry Rich
But Roger, that's showing time proportional to the product of the number of digits, while FFT should be proportional to (n log n) of the size of the larger.  I don't see the FFT in the source - I'm looking at vx.c:113. Henry Rich On 2/3/2021 3:52 PM, Roger Hui wrote: The multiplication algori

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread 'Pascal Jasmin' via Programming
Yes it is base 1, sorry.   The big decisions on the changes are: 32 or 64bit base? change the 3!:1 storage format? rationals are just a pair of large integers? openssl is good enough? I did create an interface to openssl big integer library   https://github.com/Pascal-J/BN-openssl-bindings-f

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Skip Cave
All, Then there is also John Gustafson's Unums & Posits, which are specifically designed to extend the floating-point range on binary computers: The End of (Numeric) Error - John L. Gustafson The

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Roger Hui
> The multiplication algorithm is brute-force. FFT methods are orders of > magnitude faster for large numbers. J extended precision multiplication is not brute force, as the following benchmark demonstrates: 3 : '6!:2 ''p*q'' [ p=: ?10x^y [ q=: ?10x^y' "0 ]100 200 400 800 1.35285e_5 3.40545e_5

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Henry Rich
The multiplication algorithm is brute-force. FFT methods are orders of magnitude faster for large numbers. Numbers are actually stored in base 1 IIRC. Extended arithmetic is not a mainstream use, but if we support it we might as well do it as well as we can. Henry Rich On 2/3/2021 3:05

Re: [Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread 'Pascal Jasmin' via Programming
The core performance bottleneck with extended precision numbers in J is that they are stored in base 10.  That decision does come with a performance advantage of its own:  input and display.  I'd favour the move to 32/64 bit storage even if it "broke" the 3!:1 format (although 3!:1 could convert

[Jprogramming] JE contributions WAS: J903-beta-c

2021-02-03 Thread Henry Rich
IF you want to get yourself in shape to make JE changes, I have a starter project for you: replace the extended-integer and rational support with GMP (or some other equally-good library).  The current code is serviceable but sized for 32-bit machines, and lacks fast multiplication. The code re