mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-21 03:00:19 +02:00
optimize (apply foo 0 (list 1 2)) => (foo 0 1 2)
* module/language/tree-il/peval.scm (peval): Inline applications where we know the contents of the tail. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
This commit is contained in:
parent
c0cfa9ef07
commit
3d2bcd2c35
2 changed files with 20 additions and 1 deletions
|
@ -1055,4 +1055,12 @@
|
|||
(apply (toplevel baz) (toplevel x))
|
||||
(apply (lexical failure _)))))
|
||||
(apply (lexical failure _)))
|
||||
(apply (lexical failure _))))))
|
||||
(apply (lexical failure _)))))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
(apply (lambda (x y) (cons x y)) '(1 2))
|
||||
(apply (primitive cons) (const 1) (const 2)))
|
||||
|
||||
(pass-if-peval resolve-primitives
|
||||
(apply (lambda (x y) (cons x y)) (list 1 2))
|
||||
(apply (primitive cons) (const 1) (const 2))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue