[REBOL] Searching for the Grail...
From: AJMartin::orcon::net::nz at: 27-Sep-2003 19:56
] subs0to5=: subsets 5
1 0 0 0 0 0
0 1 0 0 0 0
0 1 1 0 0 0
0 1 3 1 0 0
0 1 7 6 1 0
0 1 15 25 10 1
addelem=: 0: , (]+ 1:|. (]* i.@#)) NB. modification of subsets
subs0to5-: addelem^:(i. 1+ 5) 1
1
] perm0to5=: ! i. 1+ 5
1 1 2 6 24 120
subs0to5(+/ .*) perm0to5
1 1 3 13 75 541
subs0to5(+/ .*) 1 NB. By the way
1 1 2 5 15 52
bell"0 i. 1+ 5
1 1 2 5 15 52
NB. addhorse, modification of addelem, processes partitions themselves
def_z_ =: :
each_z_ =: &.>
every_z_=: &>
empty_z_=: (i.0 0)"_
leaf_z_ =: L:0
rnf =: 1 def',&.:(<"m.)' NB. ravel n-frame
cutin=: (<0)&,
joins=: (=@i.@#) (4 def'x.}y.'"1 _) (,: 0&,each) NB. joins <"0 i.5 5
NB. or =@i.@{:@$}@(,: 0&,each)@(# # ,:)
NB. or 0&,each (<0 1)&|:@i.@$@]} (# # ,:)
addhorse=: (<@empty, cutin"1(each),each 1:|. ,/@:(joins"1)each)@(>:leaf)
addhorse^:(i.4) <i.1 0 NB. requires correctly shaped empty seed
Nope, not here.
::Puts mat back on top of J.::
Andrew J Martin
Grail Jedi...
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/