mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Peval: Fold `thunk?' in more cases.
* module/language/tree-il/peval.scm (peval): Better folding of the `thunk?' predicate.
This commit is contained in:
parent
40553c2016
commit
0f676d8725
1 changed files with 13 additions and 7 deletions
|
@ -1251,13 +1251,19 @@ top-level bindings from ENV and return the resulting expression."
|
|||
(make-primcall src name args))))))
|
||||
|
||||
(($ <primcall> src 'thunk? (proc))
|
||||
(match (for-value proc)
|
||||
(($ <lambda> _ _ ($ <lambda-case> _ req))
|
||||
(for-tail (make-const src (null? req))))
|
||||
(proc
|
||||
(case ctx
|
||||
((effect) (make-void src))
|
||||
(else (make-primcall src 'thunk? (list proc)))))))
|
||||
(case ctx
|
||||
((effect)
|
||||
(for-tail (make-seq src proc (make-void src))))
|
||||
(else
|
||||
(match (for-value proc)
|
||||
(($ <lambda> _ _ ($ <lambda-case> _ req))
|
||||
(for-tail (make-const src (null? req))))
|
||||
(proc
|
||||
(match (find-definition proc 2)
|
||||
(($ <lambda> _ _ ($ <lambda-case> _ req))
|
||||
(for-tail (make-const src (null? req))))
|
||||
(_
|
||||
(make-primcall src 'thunk? (list proc)))))))))
|
||||
|
||||
(($ <primcall> src (? accessor-primitive? name) args)
|
||||
(match (cons name (map for-value args))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue