diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-06-15 23:07:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 23:07:12 +0200 |
| commit | 3033d5b7390456db9c1293dd42e20023f329719b (patch) | |
| tree | ef7c7d2f72a212b9b11d15e4edd652acbd5bad34 | |
| parent | 9a425a2eb3507dabdb22036c1bbb4ba7025d9e22 (diff) | |
| download | perlweeklychallenge-club-3033d5b7390456db9c1293dd42e20023f329719b.tar.gz perlweeklychallenge-club-3033d5b7390456db9c1293dd42e20023f329719b.tar.bz2 perlweeklychallenge-club-3033d5b7390456db9c1293dd42e20023f329719b.zip | |
Create 325_p2.l
Added Picolisp
| -rw-r--r-- | challenge-325/hvukman/picolisp/325_p2.l | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/challenge-325/hvukman/picolisp/325_p2.l b/challenge-325/hvukman/picolisp/325_p2.l new file mode 100644 index 0000000000..2413aa2c9c --- /dev/null +++ b/challenge-325/hvukman/picolisp/325_p2.l @@ -0,0 +1,42 @@ + + + +(de rebates (XX) +(for (I . X) prices + (let (curr X pos (+ I 1) rebate) + (prinl "current: " curr) + (while (and + (= rebate NIL) + (<= pos (size prices)) + ) + #(println "pos " pos) + (cond + ( (<= (get prices pos) curr) + + (prinl "price with rebate: ") + (println (- curr (get prices pos))) + (setq rebate T) + ) + (T + (setq pos (inc pos)) + #(prinl 'no_rebate) + #(println pos) + ) + ) + ) + (if (= rebate NIL) + (prinl "no rebate; price: " curr) + ) + ) + ) +) + +(prinl "example one" ) +(set 'prices '(8 4 6 2 3)) +(rebates 'prices) +(prinl "example two" ) +(set 'prices '(1 2 3 4 5)) +(rebates 'prices) +(prinl "example three" ) +(set 'prices '(7 1 1 5)) +(rebates 'prices) |
