|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Invoke a lambda returned from scheme, was Re: Need closures in macrosI've seen this example:
<extern|(lambda (x) `(concat "Hallo " ,x))|Piet> And I've created this: <extern|(lambda () `(lambda (x) `(concat "Hallo " ,x)))>
which returns such a lambda, but I've not been able to invoke that macro <extern|<extern|(lambda () `(lambda (x) `(concat "Hallo " ,x)))>|hi> fails with: Wrong type to apply:
Is this because extern expects a string and not a list? I tried this: <extern|(lambda (x) `(eval x)|<extern|(lambda () `(lambda (x) `(concat "Hallo
" ,x)))>|jo> but still failure, so I remove the parameters of the name: <extern|(lambda (x) `(eval x)|<extern|(lambda () `(lambda () `("Hallo ")))>>
But even that failed. This one gives no error, only a black ? so it has most hope of being right: <assign|x|<extern|(lambda () `(lambda () `(concat "Hallo ")))>>
<extern|(lambda (x) `(eval x))|<value|x>> How should I invoke a lambda returned from scheme? Sam On Tue, May 22, 2012 at 8:09 AM, Sam Liddicott <sam@...> wrote: My fake-page macros are working well, but don't quite do the trick. _______________________________________________ Texmacs-dev mailing list Texmacs-dev@... https://lists.gnu.org/mailman/listinfo/texmacs-dev |
|
|
Re: Invoke a lambda returned from scheme, was Re: Need closures in macrosProgress, now I learned the scheme comma operator:
<assign|x|<extern|(lambda () `(lambda () `(concat "Hallo ")))>> <extern|(lambda (x) `(eval ,x))|<value|x>>
gives: compound lambda whatever that means In case texmacs macro level variables can't hold a lamba, I tried: <extern|(lambda () `(set! xx `(lambda () `(concat "Hallo "))))>
but the variable xx was not set or accessible from texmacs. Sam On Tue, May 22, 2012 at 9:13 AM, Sam Liddicott <sam@...> wrote: I've seen this example: _______________________________________________ Texmacs-dev mailing list Texmacs-dev@... https://lists.gnu.org/mailman/listinfo/texmacs-dev |
|
|
Re: Invoke a lambda returned from scheme, was Re: Need closures in macrosI realised that maybe I needed to have the scheme enclose the returned lamba in an extern before returning it:
As the "concat" trick produced get-label of "concat" I guess that I would try and insert the word extern.
I tried various forms; <assign|x|<extern|(lambda () (`extern `(lambda () `(concat "Hallo "))))>> <assign|x|<extern|(lambda () `(extern `(lambda () `(concat "Hallo "))))>>
<assign|x|<extern|(lambda () (extern `(lambda () `(concat "Hallo "))))>> But they all seemed to produce various scheme errors. I will try playing with tm-define next
On Tue, May 22, 2012 at 9:13 AM, Sam Liddicott <sam@...> wrote: I've seen this example: _______________________________________________ Texmacs-dev mailing list Texmacs-dev@... https://lists.gnu.org/mailman/listinfo/texmacs-dev |
| Free embeddable forum powered by Nabble | Forum Help |