mes: Add const.
* module/mes/scm.mes (const): New function. * tests/scm.test ("const"): Test it.
This commit is contained in:
parent
c4abd50a53
commit
479a5ef7f1
|
@ -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)))
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue