Re: [Jprogramming] Question about foreign 2!:0

2017-11-27 Thread Raul Miller
Note that you can manipulate this. Include stderr in returned result: hostcmd_j_ 'example 2>&1' or hostcmd_j_ 'exec 2>&1; example' return only stderr and echo stdout in jconsole: hostcmd_j_ 'exec 3>&1; exec 1>&2; exec 2>&3; example' Thanks, -- Raul On Mon, Nov 27, 2017 at 9:58 PM, b

Re: [Jprogramming] Question about foreign 2!:0

2017-11-27 Thread bill lam
Oh, I might be wrong, stderr (not stdout) is echoed in jconsole. On Sun, Nov 26, 2017 at 4:45 PM, bill lam wrote: > When using jqt, there is no standard screen output on J session term. But > should be there if running under jconsole. > > > On Nov 26, 2017 4:06 AM, "J. Patrick Harrington" wrote:

Re: [Jprogramming] Question about foreign 2!:0

2017-11-27 Thread bill lam
I think if you modify the code from 2!:0 'cmd output' to one that just read result using J output fwrite~ 2!:0 'cmd ... wrote: > Many thanks. The expression > hostcmd_j_ =: [: 2!:0 '(' , ,&' || true)' solves the problem I had with > just 2!:0. But is there an explination > why an exprssi

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Joey K Tuttle
Second that! A lot of really good work that shows a real payback. I'm encouraged to revisit my own stuff to make it fit new paradigms better. The under the covers stuff, like memory management, caused a 2x performance improvement in the benchmark I've used in APL then J for 50 years. That's a g

Re: [Jprogramming] Nullary function?

2017-11-27 Thread robert therriault
Well then, nice work as a 'slinger' of code. The JE improvements were substantial and appreciated (as was the rest of the update). Cheers, bob > On Nov 27, 2017, at 4:14 PM, Henry Rich wrote: > > Thanks, but I'm certainly not the leader - I just sling code for the JE. > There's a lot more t

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Henry Rich
Thanks, but I'm certainly not the leader - I just sling code for the JE.  There's a lot more to the system than that. Henry Rich On 11/27/2017 6:24 PM, robert therriault wrote: Henry, You (and the rest of the team, because there is always a team when there is a leader) did a great job on tha

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> On Nov 27, 2017, at 2:19 PM, Andrew Dabrowski wrote: > > Perhaps, but rank seems to be one aspect of J that other languages have > avoided. The word “avoided” suggests the decision was conscious. > APL/J have been very influential, rank may have been a dead end. Disagree with both. :) By t

Re: [Jprogramming] Nullary function?

2017-11-27 Thread robert therriault
Henry, You (and the rest of the team, because there is always a team when there is a leader) did a great job on that update! For more of the improvements with J8.06 see: http://code.jsoftware.com/wiki/System/ReleaseNotes/J806 Cheers, bob > On Nov 27, 2017, at 2:43 PM, Henry Rich wrote: > >

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Henry Rich
Mathematica also has a way of specifying at what level a function should be applied, but specification is relative to the top of the array rather than the bottom, and that seems to work better. Rank can be negative. Henry Rich --- This email has been checked for viruses by AVG. http://www.a

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Henry Rich
Starting in 8.06 all you need is ?@6 . Henry Rich On 11/27/2017 4:46 PM, Raul Miller wrote: It's different, though - the explicit is not a part of the result: ? bind 6 ?@(6"_) But bind has been around for as long as I can remember. Also, it's mentioned here: http://www.jsoftware.com/help

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Raul Miller
It's different, though - the explicit is not a part of the result: ? bind 6 ?@(6"_) But bind has been around for as long as I can remember. Also, it's mentioned here: http://www.jsoftware.com/help/user/lib_stdlib.htm (The wayback machine says that that particular page has been around only si

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
I was reading Stokes' Learning J, but bind is not in the index. Was it a recent addition to J? Incidentally, bind =: 2 : x@(y"_), so that solution is just a variant of mine.  Someone else seems to have perceived the same lack that I did. On 11/27/2017 01:54 PM, Raul Miller wrote: I think

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
On 11/27/2017 01:00 PM, Daniel Lyons wrote: I’m sure after we master J, having to program without rank is going to make all other programming languages seem like much bigger kludges. Perhaps, but rank seems to be one aspect of J that other languages have avoided.  APL/J have been very influenti

Re: [Jprogramming] Question about foreign 2!:0

2017-11-27 Thread Raul Miller
That would require a buffering mechanism, which the file system already provides. Thanks, -- Raul On Mon, Nov 27, 2017 at 3:29 PM, Xiao-Yong Jin wrote: > Looks like you ought to call popen for collecting outputs. > >> On Nov 26, 2017, at 11:51 PM, bill lam wrote: >> >> In j805 2!:0 always fa

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread Raul Miller
Oh, oops. I think you are right. Sorry about that, I'm really getting careless... Let's go with the process specified by Erling Hellenäs: require'stats' perm=: A.~ i.@!@# sper=: ,/@:(perm"1)@comb Thanks, -- Raul On Mon, Nov 27, 2017 at 3:47 PM, Andrew Dabrowski wrote: > This is the correct

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread Andrew Dabrowski
This is the correct solution to a different problem.  Isn't k sper n supposed to return lists without repetitions? On 11/27/2017 11:36 AM, Raul Miller wrote: http://code.jsoftware.com/wiki/Essays/Odometer sper=: ] #.^:_1 i.@^~ Thanks, --

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> On Nov 27, 2017, at 1:43 PM, Don Guinn wrote: > > So it's not a nilladic function in the sense it requires an argument list > that's empty. Standard ML, OCaml and F# also have the limitation that you can’t really have a niladic function, so they instead have this special value called “unit”

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Don Guinn
So it's not a nilladic function in the sense it requires an argument list that's empty. I thought that you wanted a nilladic function that had only a name. On Nov 27, 2017 1:12 PM, "Daniel Lyons" wrote: > > > > On Nov 27, 2017, at 1:02 PM, Erling Hellenäs > wrote: > > > > Hi all ! > > > > In F#

Re: [Jprogramming] Question about foreign 2!:0

2017-11-27 Thread Xiao-Yong Jin
Looks like you ought to call popen for collecting outputs. > On Nov 26, 2017, at 11:51 PM, bill lam wrote: > > In j805 2!:0 always failed for this both on linux and mac, On j806, > change had been made on the linux branch but not on mac. The code > starts from line 42 of > the file xh.c > https:

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> > On Nov 27, 2017, at 1:02 PM, Erling Hellenäs wrote: > > Hi all ! > > In F# there is a unit type, corresponding to void in many other languages. To > execute a function without arguments you have to give it a unit argument. > Execute the function f: > f () > A function could also return uni

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Erling Hellenäs
Hi all ! In F# there is a unit type, corresponding to void in many other languages. To execute a function without arguments you have to give it a unit argument. Execute the function f: f () A function could also return unit: Here is a function with a unit argument returning unit: let f () =   

Re: [Jprogramming] Jd update available

2017-11-27 Thread Ron Petersen
When will NuVoc be updates? On Mon, Nov 27, 2017 at 8:35 AM, Eric Iverson wrote: > A Jd update available. Main additions are upsert (new data inserted or > updated to table as appropriate based on key) and support of keys in delete > and update. > > See release notes at: > http://code.jsoftware.

Re: [Jprogramming] Boxing

2017-11-27 Thread Erling Hellenäs
Yes, I think this is the shape tail alignment:    alignr=: 1 : 'u&.|: '    (i.2 3)    +alignr 10 20 30 10 21 32 13 24 35 /Erling On 2017-11-27 10:55, Marshall Lochbaum wrote: There is a way: you transpose the argument array, apply the desired operation, then possibly transpose the result (as Bri

Re: [Jprogramming] Boxing

2017-11-27 Thread Raul Miller
Sure, similarly (i.2 3)+" 10 20 30 |syntax error | (i.2 3)+"10 20 30 Do you see why that's an error? Thanks, -- Raul On Mon, Nov 27, 2017 at 12:54 PM, Erling Hellenäs wrote: >align=:2 :0 NB. like x u"n y but coercing cell shapes > : >x u/@,:"n y > ) >(i.2 5) + align 1

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Raul Miller
I think I'd work through the books and the labs to find out more about provided functions that are not yet detailed in the wiki. (The wiki is an ongoing project.) http://code.jsoftware.com/wiki/Books/Beginners http://code.jsoftware.com/wiki/Books http://www.jsoftware.com/help/dictionary/vocabul.ht

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Don Guinn
The event handlers for buttons and other things in a form are explicit. As are interval timer event handlers. Look at the source for Help/QT Demos/Form Styles. Notice all the handlers for events at the bottom are explicit definitions. Almost every form has a handler to close the form. Form Styles h

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Henry Rich
A niladic function would make hook/fork impossible, right?  If I can say randlist and have it execute the verb randlist to produce a noun, it follows that rand =: +: randlist would also execute the two verbs to produce a noun.  (f g) and (f g h) would cease to be hook/fork and would just exec

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Marshall Lochbaum
The reason J has no nullary (niladic, in APL terminology) functions is that the syntax doesn't support it very well. How do you know when to evaluate a niladic function? If f is a regular (monadic or dyadic, depending on context) functions and nil is niladic, is (f@:nil) the same as ([: f nil)? Ul

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> On Nov 27, 2017, at 11:07 AM, Don Guinn wrote: > > The wd callbacks are all explicit. Can you elaborate on this? I’m not sure what you mean. -- Daniel Lyons -- For information about J forums see http://www.jsoftware.co

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Don Guinn
Nothing wrong with using explicit definitions to force reevaluation on each call. The wd callbacks are all explicit. On Nov 27, 2017 11:00 AM, "Daniel Lyons" wrote: > > > On Nov 27, 2017, at 10:50 AM, Andrew Dabrowski > wrote: > > > > I didn't say it was a big problem, it's just a slight proble

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> On Nov 27, 2017, at 10:50 AM, Andrew Dabrowski wrote: > > I didn't say it was a big problem, it's just a slight problem but one that > came up when I was trying to do something very simple. That's what worries > me: I can't write even simple programs without using what seem like kludges > a

Re: [Jprogramming] Boxing

2017-11-27 Thread Erling Hellenäs
   align=:2 :0   NB. like x u"n y but coercing cell shapes :    x u/@,:"n y )    (i.2 5) + align 1 i.2 3 0  2  4 3 4 8 10 12 8 9    (i. 2 3)+align 10 20 30 |syntax error |   (i.2 3)+align 10 20 30 /Erling On 2017-11-27 10:51, Raul Miller wrote: (i.2 5) + align 1 i.2 3 ---

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
Yes, J has a the function "prompt" that when called with the same argument can return different values.  So J is not a pure functional programming language like Haskell.  That's why I thought it might allow nullary functions. I didn't say it was a big problem, it's just a slight problem but on

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
I used randel =: (? @: #) { ] Your definition rand =: randel bind l does indeed work.  I didn't know there was another bind op besides &, which I now note is actually "bond". How can I learn more about functions like bind that aren't on NuVoc? On 11/27/2017 12:09 PM, Raul Miller wrote: I

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Daniel Lyons
> On Nov 27, 2017, at 10:03 AM, Andrew Dabrowski wrote: > > Is J supposed to be a pure functional language, like Haskell? Outside of that > narrow category functions like this are common, and hard to get around for io > - input functions are like this. > I thought I’d look into this specific

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Raul Miller
It's all about tradeoffs. Also, you did not provide a definition nor any examples for randel, but I suspect that (rand =: randel bind l) will do what you are asking for. Good luck, -- Raul On Mon, Nov 27, 2017 at 12:03 PM, Andrew Dabrowski wrote: > On 11/26/2017 01:27 PM, Raul Miller wrote: >

Re: [Jprogramming] Nullary function?

2017-11-27 Thread Andrew Dabrowski
On 11/26/2017 01:27 PM, Raul Miller wrote: You don't really mean that. ;) I do. A function is a relationship between argument and result where there's each argument has exactly one result. That's the mathematical definition.  I'm talking about programming. So a function of no arguments would

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread robert therriault
Nice, Perhaps I should more time reading and less time at quick hacks. ;-) Cheers, bob > On Nov 27, 2017, at 8:36 AM, Raul Miller wrote: > > http://code.jsoftware.com/wiki/Essays/Odometer > > sper=: ] #.^:_1 i.@^~ > > Thanks, > > -- > Raul > > > On Mon, Nov 20, 2017 at 2:49 AM, 'Skip

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread Raul Miller
http://code.jsoftware.com/wiki/Essays/Odometer sper=: ] #.^:_1 i.@^~ Thanks, -- Raul On Mon, Nov 20, 2017 at 2:49 AM, 'Skip Cave' via Programming wrote: > How to find the permutations of y objects taken x at a time? > > 3 sper 4 > > 0 1 2 > > 0 1 3 > > 0 2 1 > > 0 2 3 > > 0 3 1 > > 0

[Jprogramming] Jd update available

2017-11-27 Thread Eric Iverson
A Jd update available. Main additions are upsert (new data inserted or updated to table as appropriate based on key) and support of keys in delete and update. See release notes at: http://code.jsoftware.com/wiki/Jd/Index -- For in

Re: [Jprogramming] Subset Permutations

2017-11-27 Thread 'Bo Jacoby' via Programming
   sper=:>@(#~(-: ~.)@>)@,@{@($ <@i.) 10#.1+2 sper 4 12 13 14 21 23 24 31 32 34 41 42 43 10#.1+3 sper 4 123 124 132 134 142 143 213 214 231 234 241 243 312 314 321 324 341 342 412 413  421 423 431 432 Den 6:22 mandag den 27. november 2017 skrev Linda Alvord : It took me a while, but h

Re: [Jprogramming] Boxing

2017-11-27 Thread Marshall Lochbaum
There is a way: you transpose the argument array, apply the desired operation, then possibly transpose the result (as Brian's answer indicates). An efficient implementation would do this under the covers anyway for nearly all of the column-wise operations that can't be implemented using rank. The

Re: [Jprogramming] Boxing

2017-11-27 Thread Raul Miller
Rank uses a "first dimension(s)" simplifying assumption, and and columns are the last dimensions here. You can use transpose to rearrange dimensions (though that's unnecessary for this result). Or, you can use indexing (though that's also unnecessary here). That said, you can rather simply define

Re: [Jprogramming] Boxing

2017-11-27 Thread Erling Hellenäs
Well, and since Box is not a scalar verb alignment does not help us out in this case. /Erling Den 2017-11-27 kl. 10:12, skrev Erling Hellenäs: Hi all! It might seem strange that you can't easily address the columns with Rank. Alignment has a similar irregularity:    10 20 +i. 2 3 10 11 12

Re: [Jprogramming] Boxing

2017-11-27 Thread Erling Hellenäs
Hi all! It might seem strange that you can't easily address the columns with Rank. Alignment has a similar irregularity:    10 20 +i. 2 3 10 11 12 23 24 25    (i. 2 3)+10 20 30 |length error |   (i.2 3)    +10 20 30    (i. 2 3)+10 20 10 11 12 23 24 25 Common first parts of the argument shapes