Re: [Jprogramming] Sequence generation

2017-09-29 Thread Raul Miller
Henry Rich wrote: > It could just be that the poster wanted to see a recursive version ... Recursive functions have some inherent complexities - to properly understand them, you need to think about the base case and the recursive case, but you also have to see how that connects to the idea as a wh

Re: [Jprogramming] Sequence generation

2017-09-29 Thread Henry Rich
It could just be that the poster wanted to see a recursive version of this problem (and one using ^:) so that he could learn how to apply those methods to other problems that really needed them. Henry Rich On 9/29/2017 11:01 PM, Don Kelly wrote: So it is a game- fair enough- it shows that in J

Re: [Jprogramming] print an array

2017-09-29 Thread Jimmy Gauvin
Is a two-step process too ugly? ​ a​ =:6 7$ 0 0 0 0 0 0 1 2 3 4 5 6 7 8 9 1011 ​ ​ 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 0 0 0 0 0 ​ (a='_')}' ',:~a=: ":(a=0)}_,:~a​ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 3

Re: [Jprogramming] Sequence generation

2017-09-29 Thread Don Kelly
So it is a game- fair enough- it shows that in J there are more ways than one to skin a cat. BUT does it really bring out the reason for a language like J or APL? Does it bring out the power of J to make so many things simpler and more elegant for the user? You have used APL and so have I -and

Re: [Jprogramming] zmq - big step for J socket services

2017-09-29 Thread 'Pascal Jasmin' via Programming
A solid accidental fix comes from changing echo: echo_z_ =: (0 0 $1!:2&2)`(wd bind 'msgs' ] 0 0 $ 1!:2&2)@.IFQT the liberal amount of wd 'msgs' in qrun, seems to let the system (perhaps down to zmq) catch up to the state it thinks it should be in. From: 'Pasca

Re: [Jprogramming] zmq - big step for J socket services

2017-09-29 Thread 'Pascal Jasmin' via Programming
changing the kill verb to: kill=: 3 : 0 access=: su runa'exit 0' killp PORT NB. new line. destroy'' i.0 0 ) helps with the sockets command consistently returning empty, and in general lengthens the test lifetime but qrun 11 11 will still fail within 3 "reruns" (qrun modified to use e

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Erling Hellenäs
An additional comment. see below. /Erling On 2017-09-29 04:45, Henry Rich wrote: Taking your last sentence first, you would have to supply some evidence to make me believe that tacit forms have any intrinsic performance penalty. It is dawning on me that you want fast function definition, but

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Erling Hellenäs
Confirmed. Great !    ts=: 6!:2 , 7!:2@]    v=.v?v=.1000    #v 1000    10 {. v 5890540 3044422 4300710 5970936 7393626 1716018 5963044 1177509 5150028 3714108    ts'([:-[:-[:-[:-]) v' 0.119559 1.3422e8    ts'(-@:-@:-@:-@:]) v' 0.120559 1.3422e8    ts'(-@:(-@:(-@:(-@:] v' 0.121043 1.

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Henry Rich
Running J8.06 64-bit, I find that your first 3 cases all use 1.3e8 bytes (which is the size of v). Version 8.05 and later does much less copying of data than previous versions. Henry Rich On 9/29/2017 10:41 AM, Erling Hellenäs wrote: Hi all ! Hopefully better examples this time.    v=.v?v

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Raul Miller
Ah, never mind, I see that you do include the sources in with the binaries. That's good enough. Thanks, -- Raul On Fri, Sep 29, 2017 at 10:49 AM, roger stokes wrote: > Raul: Can't I'm afraid. All I have to offer are these sources after > editing to avoid compilation errors with the variou

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Raul Miller
@ and @: have different meanings, in the general case. For common specific cases where they do not have different meanings, it's reasonable for special code to be used to speed up @ Specifically: u@v where u's ranks do not exceed v's ranks and where v's result shape is depends strictly on its arg

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread roger stokes
Raul: Can't I'm afraid. All I have to offer are these sources after editing to avoid compilation errors with the various compilers available at the time. This was many years ago and originals are long gone. On Sep 29, 2017 2:13 PM, "Raul Miller" wrote: > Can you point at those source files t

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Erling Hellenäs
Hi all ! Hopefully better examples this time.    v=.v?v=.1000    #v 1000    10 {. v 9257364 5642952 2724566 7608992 7025081 5624810 5911207 1606397 5366536 5408278 As we can see here, there is a space penalty for using @: compared to [: f ]. This space penalty is removed with proper

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Erling Hellenäs
Sorry, these were stupid examples. I'll come back. /Erling On 2017-09-29 15:53, Erling Hellenäs wrote: Hi all! From these simple examples it does not seem to be any difference in time and space requirements between the [:+] syntax and the +@:] syntax. Not even if we insert more brackets.   

Re: [Jprogramming] zmq - big step for J socket services

2017-09-29 Thread Eric Iverson
When you get a server error, lse__c gives you the J error message. I think this is covered in the lab and in the help. kill and related things depend on host services and that code is still a bit rough and naive. It will be cleaned bup with experience or more rigorous study. Problems in this area

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Erling Hellenäs
Hi all! From these simple examples it does not seem to be any difference in time and space requirements between the [:+] syntax and the +@:] syntax. Not even if we insert more brackets. ts'(i.v) ([:+[:+[:+[:+]) i.v=.100' 0.00936323 1.67808e7 ts'(i.v) (+@:+@:+@:+@:]) i.v=.100'

Re: [Jprogramming] Sequence generation

2017-09-29 Thread Don Guinn
Actually this can be done without loss of precision. I cheat a lot of times when asked to generate a function that matches a series. If the series is a polynomial simply solve for the coefficients. z=.4 9 15 22 30 39 49 60 72 85 z%.(i.#z)^/i.6x 4 9r2 1r2 0 0 0 ---

Re: [Jprogramming] Sequence generation

2017-09-29 Thread 'Mike Day' via Programming
Yes - nice - it's related to the result: ti = 4i + i(i-1)%2 , discussed in my message, with t0 = 0, although you're doing the equivalent of ti = 4(i+1) + i(i+1)%2, with t0 = 4, here. Beware loss of precision on long sequences, though, as the default datatype is floating, and given all the

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread Raul Miller
Can you point at those source files themselves (for the benefit of people not using windows nor linux)? Thanks, -- Raul On Fri, Sep 29, 2017 at 7:44 AM, roger stokes wrote: > oops sorry - should have said www.learningj.com/W0.zip > > On Sep 29, 2017 11:37 AM, "roger stokes" wrote: > >> J wi

Re: [Jprogramming] Sequence generation

2017-09-29 Thread Don Guinn
Here is another way: 4 4.5 0.5 p. i.10 4 9 15 22 30 39 49 60 72 85 On Fri, Sep 29, 2017 at 3:32 AM, 'Mike Day' via Programming < programm...@jsoftware.com> wrote: > Linda offers: > f=: 13 :'+/"1(>:/~i.y)*(y#x)+/i.y' NB. (msgsbelow) > > My best f , with an [: for Linda's sake: >f =: ([:+/

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread roger stokes
oops sorry - should have said www.learningj.com/W0.zip On Sep 29, 2017 11:37 AM, "roger stokes" wrote: > J with the original parsing rules which Henry and Bill mention is still > available today. > > For Windows, www.learning.com/W0.zip > > For Linux,www.learningj.com/L0.zip > > These are

Re: [Jprogramming] Tacit Expressions with Explicit J Syntax

2017-09-29 Thread roger stokes
J with the original parsing rules which Henry and Bill mention is still available today. For Windows, www.learning.com/W0.zip For Linux,www.learningj.com/L0.zip These are recompilations (by me) of the source files released by ISI in about 1993, documented in Roger Hui's "An Implementation

Re: [Jprogramming] Sequence generation

2017-09-29 Thread 'Mike Day' via Programming
Linda offers: f=: 13 :'+/"1(>:/~i.y)*(y#x)+/i.y' NB. (msgsbelow) My best f ,  with an [: for Linda's sake:    f =: ([:+/\ (+i.))    4 f 7 4 9 15 22 30 39 49 HOWEVER, although Skip initially asked for a way to render 4, (4+5), (4+5+6),  ... recursively, we may consider that the (i+1)th term may b