scm: Add compose.
* module/mes/scm.mes (compose): New function. * tests/scm.test ("compose"): New test.
This commit is contained in:
parent
22880ac831
commit
58dfe0b7bd
|
@ -183,6 +183,11 @@
|
|||
(define (delq x lst)
|
||||
(filter (lambda (e) (not (eq? e x))) lst))
|
||||
|
||||
(define (compose proc . rest)
|
||||
(if (null? rest) proc
|
||||
(lambda args
|
||||
(proc (apply (apply compose rest) args)))))
|
||||
|
||||
|
||||
;; Vector
|
||||
(define (vector . rest) (list->vector rest))
|
||||
|
|
|
@ -9,7 +9,7 @@ exit $?
|
|||
;;; -*-scheme-*-
|
||||
|
||||
;;; Mes --- Maxwell Equations of Software
|
||||
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
;;; Copyright © 2016,2017 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of Mes.
|
||||
;;;
|
||||
|
@ -136,4 +136,6 @@ exit $?
|
|||
(pass-if "char-alphabetic?" (seq? (char-alphabetic? #\a) #t))
|
||||
(pass-if "char-alphabetic? 2" (seq? (char-alphabetic? #\[) #f))
|
||||
|
||||
(pass-if-equal "compose" 1 ((compose car cdr car) '((0 1 2))))
|
||||
|
||||
(result 'report)
|
||||
|
|
Loading…
Reference in a new issue