Re: [Jprogramming] Boxing

2017-11-26 Thread Raul Miller
Or <@,."1]2 comb 6 Thanks, -- Raul On Sun, Nov 26, 2017 at 10:56 PM, Joey K Tuttle wrote: > Or - > >,.&.> <"1 ] 2 comb 6 > > >> On 2017Nov 26, at 19:30, Brian Schott wrote: >> >> 2 <@:|:@:,:"1@:comb 6 >> >> On Sun, Nov 26, 2017 at 10:21 PM, 'Skip Cave' via Programming < >> programm...

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

2017-11-26 Thread Raul Miller
hostcmd_j_ solves it by putting the argument in parenthesis before handing it off to the shell interpreter. Those parenthesis mean that their contents are handled in another process. So the redirects that J engine adds to the command line happen in the parent process and the redirects introduced b

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

2017-11-26 Thread bill lam
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://github.com/jsoftware/jsource/blob/master/jsrc/xh.c note the command passed to 2!:0 is appended with redirection for a t

Re: [Jprogramming] Subset Permutations

2017-11-26 Thread Linda Alvord
It took me a while, but here is an explicit version of your solution: sper=:>@(#~(-: ~.)@>)@,@{@($ <@i.) sper2=: 13 :'>((-: ~.)@>,{x$mailto:programming-boun...@forums.jsoftware.com] On Behalf Of robert therriault Sent: Monday, November 20, 2017 3:23 AM To: programm...@jsoftware.com Subject: Re

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

2017-11-26 Thread J. Patrick Harrington
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 exprssion of the form 2!:0 'foo.exe outfile' should work on some machines and fail on others, when both are running the same version of J? I'm afr

Re: [Jprogramming] Boxing

2017-11-26 Thread Joey K Tuttle
Or - ,.&.> <"1 ] 2 comb 6 > On 2017Nov 26, at 19:30, Brian Schott wrote: > > 2 <@:|:@:,:"1@:comb 6 > > On Sun, Nov 26, 2017 at 10:21 PM, 'Skip Cave' via Programming < > programm...@jsoftware.com> wrote: > >> Combination of 6 items taken 2 at a time: >> >> comb=: ((= +/"1) |.@:I.@# ]) #:@

Re: [Jprogramming] Boxing

2017-11-26 Thread Brian Schott
2 <@:|:@:,:"1@:comb 6 On Sun, Nov 26, 2017 at 10:21 PM, 'Skip Cave' via Programming < programm...@jsoftware.com> wrote: > Combination of 6 items taken 2 at a time: > > comb=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) > > |: 2 comb 6 > > 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 > > 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 >

[Jprogramming] Boxing

2017-11-26 Thread 'Skip Cave' via Programming
Combination of 6 items taken 2 at a time: comb=: ((= +/"1) |.@:I.@# ]) #:@i.@(2&^) |: 2 comb 6 0 0 0 0 0 1 1 1 1 2 2 2 3 3 4 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 How can I box each column with the vertical pair of numbers in each box? Skip

Re: [Jprogramming] Nullary function?

2017-11-26 Thread Raul Miller
You don't really mean that. ;) A function is a relationship between argument and result where there's each argument has exactly one result. So a function of no arguments would have no result. Or, if we are being generous, we could declare that it has a constant argument (and, thus, a constant resu

Re: [Jprogramming] Nullary function?

2017-11-26 Thread Henry Rich
Nope, functions must have an argument.  The normal idiom when calling a niladic function is to use '' (empty string) as the argument, since it's easy to type and doesn't require surrounding spaces. Henry Rich On 11/26/2017 12:42 PM, Andrew Dabrowski wrote: Is it possible to define a nullary fu

[Jprogramming] Nullary function?

2017-11-26 Thread Andrew Dabrowski
Is it possible to define a nullary function in J?  In other languages they're sometimes convenient, for example a function that returns a random element.  It's a bit awkward to have to use a dummy argument, like randdie =: 1 + ? @: 6: which must be called like randdie 0 and when used in a ta

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

2017-11-26 Thread bill lam
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: > Sorry, I meant "returning with no screen output' > I am now running the full program with hostcmd_j_ for 2!:0. > It's ch