summaryrefslogtreecommitdiff
path: root/module/language/tree-il.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-12-26 20:51:31 +0100
committerAndy Wingo <wingo@pobox.com>2017-12-27 15:46:31 +0100
commit140b69dfc653c27b59570c9050e8b0909fd296b9 (patch)
tree630ac917e30dbcc46c2b3421e676446f54b152e1 /module/language/tree-il.scm
parent7dbc571db15933176cb8f8c2f8ecdeb0d7f505dd (diff)
downloadguile-140b69dfc653c27b59570c9050e8b0909fd296b9.tar.gz
Refactor list->seq to make return arity apparent
* module/language/tree-il.scm (list->seq): Change to let tail of seq indicate number of values.
Diffstat (limited to 'module/language/tree-il.scm')
-rw-r--r--module/language/tree-il.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/module/language/tree-il.scm b/module/language/tree-il.scm
index 5fb0ce05f..88e943b75 100644
--- a/module/language/tree-il.scm
+++ b/module/language/tree-il.scm
@@ -139,9 +139,12 @@
;; A helper.
(define (list->seq loc exps)
- (if (null? (cdr exps))
- (car exps)
- (make-seq loc (car exps) (list->seq #f (cdr exps)))))
+ (match exps
+ ((exp . exps)
+ (let lp ((head exp) (tail exps))
+ (match tail
+ (() head)
+ ((exp . tail) (lp (make-seq loc head exp) tail)))))))