From 05cae56813de9a90653fd1c72c678477782815f9 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 2 Apr 2017 08:05:55 +0200 Subject: [PATCH] core: Remove append. * lib.c (append): Remove. * scaffold/mini-mes.c (append): Remove. * module/mes/base-0.mes (append): New function. * module/mes/read-0.mo: Regenerate. * module/mes/read-0-32.mo: Regenerate. --- lib.c | 8 -------- module/mes/base-0.mes | 9 +++++++-- scaffold/mini-mes.c | 8 -------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/lib.c b/lib.c index 5d33bb87..b7a636c9 100644 --- a/lib.c +++ b/lib.c @@ -170,14 +170,6 @@ exit_ (SCM x) ///((name . "exit")) exit (VALUE (x)); } -SCM -append (SCM x) ///((arity . n)) -{ - if (x == cell_nil) return cell_nil; - if (cdr (x) == cell_nil) return car (x); - return append2 (car (x), append (cdr (x))); -} - //MINI_MES // char const* // string_to_cstring (SCM s) diff --git a/module/mes/base-0.mes b/module/mes/base-0.mes index 11359fc2..eab39910 100644 --- a/module/mes/base-0.mes +++ b/module/mes/base-0.mes @@ -110,6 +110,11 @@ (define-macro (include-from-path file) (list 'load (list string-append "module/" file))) +(define (append . rest) + (if (null? rest) '() + (if (null? (cdr rest)) (car rest) + (append2 (car rest) (apply append (cdr rest)))))) + (include "module/mes/type-0.mes") (define (memq x lst) @@ -129,8 +134,8 @@ (define (mes-load-module-env module a) (push! *input-ports* (current-input-port)) (set-current-input-port (open-input-file (string-append *mes-prefix* (module->file module)))) - (let ((x (core:eval (append (cons 'begin (read-input-file-env a)) - '((current-module))) + (let ((x (core:eval (append2 (cons 'begin (read-input-file-env a)) + '((current-module))) a))) (set-current-input-port (pop! *input-ports*)) x)) diff --git a/scaffold/mini-mes.c b/scaffold/mini-mes.c index 5d500975..a67277a5 100644 --- a/scaffold/mini-mes.c +++ b/scaffold/mini-mes.c @@ -1441,14 +1441,6 @@ exit_ (SCM x) ///((name . "exit")) exit (VALUE (x)); } -SCM -append (SCM x) ///((arity . n)) -{ - if (x == cell_nil) return cell_nil; - if (cdr (x) == cell_nil) return car (x); - return append2 (car (x), append (cdr (x))); -} - SCM xassq (SCM x, SCM a) ///for speed in core only {