more simplification

main
Inga 🏳‍🌈 1 year ago
parent 827d301949
commit f6617f0521
  1. 9
      day01-easy/main.scm

@ -33,6 +33,13 @@
(define (sum numbers) (reduce numbers + 0))
(define
(repeat value number)
(if
(= number 0)
'()
(cons value (repeat value (- number 1)))))
(define (is-numeric-char char) (if (char-numeric? char) #t #f))
(define (first-last list predicate)
@ -43,7 +50,7 @@
(cons
(if
(predicate (car list))
(cons (car list) (cons (car list) '()))
(repeat (car list) 2)
'())
(first-last (cdr list) predicate))
(lambda (current rest)

Loading…
Cancel
Save