Progress, 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 <[email protected]> wrote:

> I'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 <[email protected]> wrote:
>
>> My fake-page macros are working well, but don't quite do the trick.
>>
>> If I take the reader through the first part of development of page 1,
>> then I have many revisions of a document fake-page page 1. That works fine.
>> Each revision has a different effective namespace and it's own section
>> numbering and so on.
>>
>> I then need to take the reader through development of the next part of
>> page 1. These are further revisions of document 1 page 1, but showing
>> further parts.
>>
>> Thus the first revision of the next part of page 1 is the SAME revision
>> as the previous fake page 1, and will inherit all the labels and numbering
>> and so on.
>>
>> However when I show the next revision of the second part of page 1 it is
>> a new revision and inherits nothing! Aggh!
>>
>> If I made it the same revision then it would inherit not only the last
>> revision of the first part, but also the first revision of the second part.
>>
>> So clearly I need closures, so that in any revision I can extract a
>> closure which allows further pages to continue from that point at which the
>> closure was made. More than once, without conflict.
>>
>>
>> I'm guessing that I would need a scheme function to create the closure.
>> It would need to be a closure that accepted either any number of arguments
>> or a tuple, and effectively invoked "compound". Or maybe even just took one
>> argument which it eval's and returned, like "identity" but in a closure.
>>
>> I'm not asking if I'm nuts, but I'm asking how to do this. As I search my
>> lisp memory I can think of "curry" and stuff like that but things are
>> complicated with the macro layer as well.
>>
>> I shall post here as I develop the idea but if anyone can "do my
>> homework" for me or give me a clue I would be very grateful
>>
>> Sam
>>
>
>
_______________________________________________
Texmacs-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to