Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Loops-Nested/Qi/loops-nested.qi
Normal file
15
Task/Loops-Nested/Qi/loops-nested.qi
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(define random-list
|
||||
0 -> []
|
||||
M -> [(1+ (RANDOM 20)) | (random-list (1- M))])
|
||||
|
||||
(define random-array
|
||||
0 _ -> []
|
||||
N M -> [(random-list M) | (random-array (1- N) M)])
|
||||
|
||||
(define array->list
|
||||
_ [] -> [] \ "end outer loop" \
|
||||
Stop [[] | Ra] -> (array->list Stop Ra) \ "outer loop" \
|
||||
Stop [[Stop | _ ] | _ ] -> [] \ "break out from inner loop" \
|
||||
Stop [[X | Rl] | Ra] -> [X | (array->list Stop [Rl | Ra])]) \ "inner loop" \
|
||||
|
||||
(array->list 20 (random-array 10 10))
|
||||
Loading…
Add table
Add a link
Reference in a new issue