Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Population-count/Factor/population-count.factor
Normal file
10
Task/Population-count/Factor/population-count.factor
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
USING: formatting kernel lists lists.lazy math math.bitwise
|
||||
math.functions namespaces prettyprint.config sequences ;
|
||||
|
||||
: 3^n ( obj -- obj' ) [ 3 swap ^ bit-count ] lmap-lazy ;
|
||||
: evil ( obj -- obj' ) [ bit-count even? ] lfilter ;
|
||||
: odious ( obj -- obj' ) [ bit-count odd? ] lfilter ;
|
||||
|
||||
100 margin set 0 lfrom [ 3^n ] [ evil ] [ odious ] tri
|
||||
[ 30 swap ltake list>array ] tri@
|
||||
"3^n: %u\nEvil: %u\nOdious: %u\n" printf
|
||||
Loading…
Add table
Add a link
Reference in a new issue