mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
remove @apply memoizer
* libguile/memoize.c (memoize): Recognize a primcall to 'apply as SCM_M_APPLY. (@apply): Remove @apply memoizer. (unmemoize): Unmemoize using "apply", not "@apply". * libguile/memoize.h: * libguile/expand.c (scm_sym_atapply): Remove. * module/ice-9/boot-9.scm (apply): Re-implement using apply primcall. Use case-lambda, so as to give an appropriate minimum arity. * module/language/tree-il/compile-glil.scm (flatten-lambda-case): Compile a primcall of "apply" specially, not "@apply". * module/language/tree-il/peval.scm (peval): Match primcalls to "apply", not "@apply". Residualize "apply" primcalls. * module/language/tree-il/primitives.scm (*interesting-primitive-names*): (*multiply-valued-primitives*): Remove @apply, and apply primitive expander. * test-suite/tests/peval.test: * test-suite/tests/tree-il.test: Update tests to expect residualized "apply". * test-suite/tests/procprop.test ("procedure-arity"): Update test for better apply arity. * test-suite/tests/strings.test ("string"): Update expected error.
This commit is contained in:
parent
1773bc7dd5
commit
39caffe79b
11 changed files with 46 additions and 79 deletions
|
@ -192,7 +192,7 @@ If there is no handler at all, Guile prints an error and then exits."
|
|||
;;;
|
||||
|
||||
;; These are are the procedural wrappers around the primitives of
|
||||
;; Guile's language: @apply, @call-with-current-continuation, etc.
|
||||
;; Guile's language: apply, call-with-current-continuation, etc.
|
||||
;;
|
||||
;; Usually, a call to a primitive is compiled specially. The compiler
|
||||
;; knows about all these kinds of expressions. But the primitives may
|
||||
|
@ -200,8 +200,18 @@ If there is no handler at all, Guile prints an error and then exits."
|
|||
;; stub procedures are the "values" of apply, dynamic-wind, and other
|
||||
;; such primitives.
|
||||
;;
|
||||
(define (apply fun . args)
|
||||
(@apply fun (apply:nconc2last args)))
|
||||
(define apply
|
||||
(case-lambda
|
||||
((fun args)
|
||||
((@@ primitive apply) fun args))
|
||||
((fun arg1 . args)
|
||||
(letrec ((append* (lambda (tail)
|
||||
(let ((tail (car tail))
|
||||
(tail* (cdr tail)))
|
||||
(if (null? tail*)
|
||||
tail
|
||||
(cons tail (append* tail*)))))))
|
||||
(apply fun (cons arg1 (append* args)))))))
|
||||
(define (call-with-current-continuation proc)
|
||||
(@call-with-current-continuation proc))
|
||||
(define (call-with-values producer consumer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue