deriv is still not terminating for some reason. need to investigate.
This commit is contained in:
parent
6dff02d606
commit
3c2917f0c5
|
@ -865,7 +865,7 @@
|
||||||
(ModuleVariable-module-name op-knowledge))
|
(ModuleVariable-module-name op-knowledge))
|
||||||
'#%kernel)
|
'#%kernel)
|
||||||
(let ([op (ModuleVariable-name op-knowledge)])
|
(let ([op (ModuleVariable-name op-knowledge)])
|
||||||
(cond [(KernelPrimitiveName? op)
|
(cond [(KernelPrimitiveName/Inline? op)
|
||||||
(compile-kernel-primitive-application
|
(compile-kernel-primitive-application
|
||||||
op
|
op
|
||||||
exp cenv target linkage)]
|
exp cenv target linkage)]
|
||||||
|
@ -929,7 +929,7 @@
|
||||||
|
|
||||||
|
|
||||||
(: compile-kernel-primitive-application
|
(: compile-kernel-primitive-application
|
||||||
(KernelPrimitiveName App CompileTimeEnvironment Target Linkage -> InstructionSequence))
|
(KernelPrimitiveName/Inline App CompileTimeEnvironment Target Linkage -> InstructionSequence))
|
||||||
;; This is a special case of application, where the operator is statically
|
;; This is a special case of application, where the operator is statically
|
||||||
;; known to be in the set of hardcoded primitives.
|
;; known to be in the set of hardcoded primitives.
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
'eq?))
|
'eq?))
|
||||||
|
|
||||||
|
|
||||||
|
(define-predicate KernelPrimitiveName/Inline? KernelPrimitiveName/Inline)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(: kernel-primitive-expected-operand-types (KernelPrimitiveName/Inline Natural -> (Listof OperandDomain)))
|
(: kernel-primitive-expected-operand-types (KernelPrimitiveName/Inline Natural -> (Listof OperandDomain)))
|
||||||
|
|
|
@ -337,6 +337,55 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(test '(letrec ([even? (lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
#t
|
||||||
|
(odd? (sub1 x))))]
|
||||||
|
[odd? (lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
#f
|
||||||
|
(even? (sub1 x))))])
|
||||||
|
(list (even? 1024)
|
||||||
|
(even? 1023)
|
||||||
|
(even? 2172)
|
||||||
|
(even? 2171)))
|
||||||
|
(list #t #f #t #f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(test '(letrec-values ([(even? odd?)
|
||||||
|
(values
|
||||||
|
(lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
#t
|
||||||
|
(odd? (sub1 x))))
|
||||||
|
(lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
#f
|
||||||
|
(even? (sub1 x)))))])
|
||||||
|
(list (even? 1024)
|
||||||
|
(even? 1023)
|
||||||
|
(even? 2172)
|
||||||
|
(even? 2171)))
|
||||||
|
(list #t #f #t #f))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(test '(letrec ([fact (lambda (x)
|
||||||
|
(if (= x 0)
|
||||||
|
1
|
||||||
|
(* x (fact (sub1 x)))))])
|
||||||
|
(list (fact 3) (fact 4) (fact 5)))
|
||||||
|
'(6 24 120))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; deriv
|
;; deriv
|
||||||
(test '(let ()
|
(test '(let ()
|
||||||
(define (deriv-aux a) (list '/ (deriv a) a))
|
(define (deriv-aux a) (list '/ (deriv a) a))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user