Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
require'general/misc/prompt'
|
||||
sel=: {{ u#[ }}
|
||||
|
||||
quicksort=: {{
|
||||
if. 1 >: #y do. y
|
||||
else.
|
||||
(u quicksort y u sel e),(y =sel e),u quicksort y u~ sel e=.y{~?#y
|
||||
end.
|
||||
}}
|
||||
|
||||
ptc=: {{
|
||||
t=. (+. +./ .*.~)^:_ y=1
|
||||
j=. I.,t+.|:t
|
||||
($y)$(j{,t) j} ,y
|
||||
}}
|
||||
|
||||
askless=: {{
|
||||
coord=. x ,&(items&i.) y
|
||||
lt=. LT {~<coord
|
||||
if. 1<lt do.
|
||||
lt=. 'y' e. tolower prompt 'Is ',(":;x),' less than ',(":;y),'? '
|
||||
LT=: ptc (lt,-.lt) (coord;|.coord)} LT
|
||||
end.
|
||||
lt
|
||||
}}"0
|
||||
|
||||
asksort=: {{
|
||||
items=: ~.y
|
||||
LT=: <:%=i.#items
|
||||
askless quicksort y
|
||||
}}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
asksort&.;:' violet red green indigo blue yellow orange'
|
||||
Is indigo less than violet? yes
|
||||
Is indigo less than red? no
|
||||
Is indigo less than green? no
|
||||
Is indigo less than blue? no
|
||||
Is indigo less than yellow? no
|
||||
Is indigo less than orange? no
|
||||
Is yellow less than red? no
|
||||
Is yellow less than green? yes
|
||||
Is yellow less than blue? yes
|
||||
Is yellow less than orange? no
|
||||
Is green less than blue? yes
|
||||
Is red less than orange? yes
|
||||
red orange yellow green blue indigo violet
|
||||
Loading…
Add table
Add a link
Reference in a new issue