aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormryouse2023-06-04 02:47:06 +0000
committermryouse2023-06-04 02:47:06 +0000
commitcffc6bff847120d71b25d9cb424b27704000aec5 (patch)
treed3701b2cb4b310e0735c1eeb80c392b10f623fd1
parent7b7bf727da3250907284368b98b0083a4b4e2386 (diff)
fixes
-rw-r--r--rosetta/lev.neb15
-rw-r--r--rosetta/palindrome.neb1
2 files changed, 10 insertions, 6 deletions
diff --git a/rosetta/lev.neb b/rosetta/lev.neb
index 6797c41..03db260 100644
--- a/rosetta/lev.neb
+++ b/rosetta/lev.neb
@@ -1,9 +1,12 @@
-(func min (lst :{:int})
- (def val (first lst))
- (for-each (rest lst)
- (if (< _item_ val)
- (redef val _item_)))
- val)
+; this should be in the stdlib
+(func min (lst)
+ (reduce
+ (lambda (acc x)
+ (if (< x acc)
+ x
+ acc))
+ (rest lst)
+ (first lst)))
(func lev (s t)
(branch
diff --git a/rosetta/palindrome.neb b/rosetta/palindrome.neb
index 198456d..3f8bf8d 100644
--- a/rosetta/palindrome.neb
+++ b/rosetta/palindrome.neb
@@ -1,3 +1,4 @@
+; the answer in p99/p06 is better
(func palindrome? (str)
(branch
((<= (length str) 1) #true)