Dear, happy guile-users
The scmutils package for SICM allows one to do things like apply arguments to
a vector which evaluates to a vector of results of applying the arguments to
each element in turn. It achieves this in MIT-scheme using this
kludgey-looking method. Here g:apply does the actual extended application. I
am not entirely sure about how the stack-frame methods work, but I guess it's
looking forward from the continuation of the top-level call to apply.
Has anyone done anything like this with guile using the evaluator trap options
or something?
I suppose an alternative would be to run a different REPL ... but maybe that
would be harder.
Any ideas gratefully accepted.
Best wishes
Ian
(define *enable-generic-apply* true)
(define inapplicable-object/operator
(condition-accessor condition-type:inapplicable-object 'DATUM))
(define (apply-extension-init)
(bind-default-condition-handler
(list condition-type:inapplicable-object)
(lambda (condition)
(if *enable-generic-apply*
((stack-frame->continuation
(stack-frame/next
(stack-frame/next
(stack-frame/next
(continuation->stack-frame
(condition/continuation condition))))))
(lambda args
(g:apply (inapplicable-object/operator condition) args)))))))
(define (once-only! thunk name)
(if (lexical-unbound? system-global-environment name)
(begin (thunk)
;; Create NAME in SGE
(eval `(define ,name #t) system-global-environment)
'done)
'already-done))
(once-only! apply-extension-init 'apply-extension-init)
_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user