Self-describing numbers: Difference between revisions
Added Quackery.
(Added Quackery.) |
|||
Line 2,398:
[5, 2, 1, 0, 0, 1, 0, 0, 0]
[6, 2, 1, 0, 0, 0, 1, 0, 0, 0] </pre>
=={{header|Quackery}}==
<lang Quackery> [ tuck over peek
1+ unrot poke ] is item++ ( n [ --> [ )
[ [] 10 times [ 0 join ]
swap
[ 10 /mod rot item++
swap dup 0 = until ]
drop ] is digitcount ( n --> [ )
[ 0 swap witheach + ] is sum ( [ --> n )
[ 0 swap
witheach
[ swap 10 * + ] ] is digits->n ( [ --> n )
[ dup digitcount
dup sum split drop
digits->n = ] is self-desc ( n --> b )
4000000 times
[ i^ self-desc if
[ i^ echo cr ] ]</lang>
{{out}}
<pre>1210
2020
21200
3211000
</pre>
=={{header|Racket}}==
|