From 7288e28b8179b4e9e96bff50e31b88b8cab2edc9 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 1 Nov 2022 22:50:45 +0100 Subject: list-ref-default: fix logic --- mew.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mew.scm b/mew.scm index 02d0dd5..a623b74 100644 --- a/mew.scm +++ b/mew.scm @@ -212,11 +212,11 @@ (while (not cond) body ...)))) (define (list-ref-default l i default) - (if (zero? i) - (if (null? l) - default - (car l)) - (list-ref-default (cdr l) (- i 1) default))) + (if (null? l) + default + (if (zero? i) + (car l) + (list-ref-default (cdr l) (- i 1) default)))) (define (vector-ref-default v i default) (if (< i (vector-length v)) -- cgit 1.4.1