Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Four-is-magic/Q/four-is-magic-1.q
Normal file
16
Task/Four-is-magic/Q/four-is-magic-1.q
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
C:``one`two`three`four`five`six`seven`eight`nine`ten,
|
||||
`eleven`twelve`thirteen`fourteen`fifteen`sixteen`seventeen`eighteen`nineteen / cardinal numbers <20
|
||||
|
||||
T:``ten`twenty`thirty`forty`fifty`sixty`seventy`eighty`ninety / tens
|
||||
M:``thousand`million`billion`trillion`quadrillion`quintillion`sextillion`septillion / magnitudes
|
||||
|
||||
st:{ / stringify <1000
|
||||
$[x<20; C x;
|
||||
x<100; (T;C)@'10 vs x;
|
||||
{C[y],`hundred,$[z=0;`;x z]}[.z.s] . 100 vs x] }
|
||||
|
||||
s:{$[x=0; "zero"; {" "sv string except[;`]raze x{$[x~`;x;x,y]}'M reverse til count x} st each 1000 vs x]} / stringify
|
||||
|
||||
fim:{@[;0;upper],[;"four is magic.\n"] raze 1_{y," is ",x,", "}prior s each(count s@)\[x]} / four is magic
|
||||
|
||||
1 raze fim each 0 4 8 16 25 89 365 2586 25865 369854 40000000001; / tests
|
||||
6
Task/Four-is-magic/Q/four-is-magic-2.q
Normal file
6
Task/Four-is-magic/Q/four-is-magic-2.q
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
q)show sl:count each string C / string lengths
|
||||
0 3 3 5 4 4 3 5 5 4 3 6 6 8 8 7 7 9 8 8
|
||||
q)sl\[18]
|
||||
18 8 5 4
|
||||
q)sl\[19]
|
||||
19 8 5 4
|
||||
Loading…
Add table
Add a link
Reference in a new issue