mes: Add const.

* module/mes/scm.mes (const): New function.
* tests/scm.test ("const"): Test it.
This commit is contained in:
Jan Nieuwenhuizen 2018-05-20 13:18:36 +02:00
parent c4abd50a53
commit 479a5ef7f1
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 7 additions and 0 deletions

View file

@ -351,3 +351,7 @@
(define (negate proc) (define (negate proc)
(lambda args (lambda args
(not (apply proc args)))) (not (apply proc args))))
(define (const . rest)
(lambda (. _)
(car rest)))

View file

@ -159,4 +159,7 @@ exit $?
(pass-if-equal "octal" 65 #o101) (pass-if-equal "octal" 65 #o101)
(pass-if-equal "hex" 257 #x101) (pass-if-equal "hex" 257 #x101)
(pass-if-equal "negate" #t ((negate eq?) 0 1))
(pass-if-equal "const" 42 ((const 42) 1 2 3 4))
(result 'report) (result 'report)