improved performance

main
Inga 🏳‍🌈 10 months ago
parent a96161a5ae
commit 2a75e9eaa9
  1. 4
      day01-hard/main.scm

@ -59,7 +59,7 @@
'(1 2 3) '(1 2 3)
((first is-not-empty) '(() (1 2 3)))) ((first is-not-empty) '(() (1 2 3))))
(define (coalesce-not-empty default) (lambda (value) ((first is-not-empty) (list value default)))) (define (coalesce-not-empty default-lazy) (lambda (value) (if (null? value) (default-lazy) value)))
(define (truthy-chaining f) (lambda (value) (if value (f value) #f))) (define (truthy-chaining f) (lambda (value) (if value (f value) #f)))
@ -116,7 +116,7 @@
(null? values) (null? values)
'(()) '(())
((compose (list ((compose (list
(coalesce-not-empty (f (cdr values))) (coalesce-not-empty (lambda () (f (cdr values))))
flat flat
(filter id) (filter id)
(map (map

Loading…
Cancel
Save