mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 18:57:48 +01:00
almost working something
This commit is contained in:
21
clitests/coffee.psil
Normal file
21
clitests/coffee.psil
Normal file
@@ -0,0 +1,21 @@
|
||||
(define (getmax a b)
|
||||
(if (> a b) a b)
|
||||
)
|
||||
|
||||
(define (coffee-shop-impl times last cur max)
|
||||
(if (= times (nil))
|
||||
(getmax cur max)
|
||||
(if (= last (car times))
|
||||
(coffee-shop-impl (cdr times) last (+ cur 1) max)
|
||||
(coffee-shop-impl (cdr times) (car times) 1 (getmax cur max))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define (coffee-shop times)
|
||||
(coffee-shop-impl times (nil) 0 0)
|
||||
)
|
||||
|
||||
(coffee-shop (nil))
|
||||
(coffee-shop (quote( (8 0) (8 10) (8 10) (8 45) )))
|
||||
(coffee-shop (quote( (8 12) (10 11) (10 11) (15 15) (15 15) (15 15) (22 22) (22 22) (22 59) )))
|
||||
3
clitests/coffee.res
Normal file
3
clitests/coffee.res
Normal file
@@ -0,0 +1,3 @@
|
||||
0
|
||||
2
|
||||
3
|
||||
@@ -20,6 +20,7 @@ for FILE in *.psil; do
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "$FILE OK"
|
||||
rm $FILE.res
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user