Roger Hui wrote:
> A recursive version:
>
> ps=: 3 : 'if. 0=#y do. ,a: else. (<(,0){y) (] , ,&.>) ps }.y end.'
>
Thanks, that's very instructive. I made some tries in that direction,
but I think I have to see something like this to get a clear picture of
this.
Very helpful1

>    ts 't=: ps i.16'
> 0.236343 8.8887e6
>    ts 't=: powerset i.16'
> 0.234749 1.55797e7
>    7!:5 <'t'
> 7959744
>
> The last sentence indicates that ps does not use
> much space in excess of that needed for the result.  
> However, it is in the nature of powersets that the 
> space (and time) grows exponentially as #y .
Time consumed was the factor that bothered me. So inspired by
how this is done in Haskell I tried to translate that in J.


Thanks again for all the replies.

@@i=Arie

p.s.
Ok I show you how far my tries reached.
didn't work of course ;c(

ps=: 3 : 0
if. 1< #y do.
h=: {. y
y ; ;/ h ,. (ps }. y)
else.
; y
end.
)

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to