diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-10-26 22:10:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-26 22:10:18 +0100 |
| commit | 8b86e6c81baf0bd9e19fad2a90b2ce5c11deda31 (patch) | |
| tree | 5cb0b57eb24af3d9863ebc846541cc742567f58a | |
| parent | 2c0ca222d3d521b230234ce68182d8a23a5605d3 (diff) | |
| download | perlweeklychallenge-club-8b86e6c81baf0bd9e19fad2a90b2ce5c11deda31.tar.gz perlweeklychallenge-club-8b86e6c81baf0bd9e19fad2a90b2ce5c11deda31.tar.bz2 perlweeklychallenge-club-8b86e6c81baf0bd9e19fad2a90b2ce5c11deda31.zip | |
Create 344_p2.l
| -rw-r--r-- | challenge-344/hvukman/picolisp/344_p2.l | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/challenge-344/hvukman/picolisp/344_p2.l b/challenge-344/hvukman/picolisp/344_p2.l new file mode 100644 index 0000000000..fdc57466bc --- /dev/null +++ b/challenge-344/hvukman/picolisp/344_p2.l @@ -0,0 +1,35 @@ +# for permutations +(load "@lib/simul.l") + +(de flatten (Lst) + (fish atom Lst) +) + +# map get over flattened permutations +# see if target is member +(de arrayformation (X Y) + (if + (member X + (make + (for Y (mapcar flatten (permute Y)) + (link + (make (for Z (length Y) + (link (get Y Z)) + ) + ) + ) + ) + ) + ) + 'true + 'false + ) +) + +(arrayformation '(1 2 3 4) '( (2 3 ) (1) (4))) +(arrayformation '(1 2 3 4) '( (1 3 ) ( 2 4) )) +(arrayformation '(5 8 2 9 1) '( (9 1 ) ( 5 8 ) (2) )) +(arrayformation '(1 2 3) '( ( 1 ) (3 ) )) +(arrayformation '(7 4 6) '( ( 7 4 6 ) )) + + |
