User:RE Boss/Performance Records/Power Set

From J Wiki
Jump to navigation Jump to search

Verbs are taken from Power Set where also more information on this subject is to be found.

Collected Definitions

ps0 =: #:@i.@(2&^)@# <@#"1 _ ]

ps1a=: 3 : 'if. 0=#y do. ,<0#y else. (<{.y) (],,&.>) ps1a }.y end.'
ps1b=: ,@<@(0&#) ` (<@{. (],,&.>) $:@}.) @. (0<#)

ps2 =: , @ ((],,&.>)/) @ (<"_1 , <@(0&#))

ps3 =: (i.@>:@# comb&.> #) {&.> <@]

ps4=: 3 : '(}:,;&.>@{:) (}:, [:({.,<@(i.@#,.&.>])@}.)[:,&.>/\.>@{:)^:y(y$<i.0 0)<@,<i.1 0'
ps4a=: ([:ps4 #) {&.> <	NB. for nouns which are not an integer atom.

comb=: 4 : 0        NB. All size x combinations of i.y
 k=. i.>:d=.y-x
 z=. (d$<i.0 0),<i.1 0
 for. i.x do. z=. k ,.&.> ,&.>/\. >:&.> z end.
 ; z
)

Relative performance on i.20


Place rlprf rlt rls Verb Author
5 38.09 9.25 4.12 ps0 Roger Hui
3 19.48 8.03 2.43 ps1a Roger Hui
2 16.96 7.00 2.42 ps1b Roger Hui
4 21.56 8.89 2.42 ps2 Roger Hui
1 6.96 2.73 2.55 ps3 RE Boss
0 1.00 1.00 1.00 ps4@# RE Boss