lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list implementation


From: Valeriy E. Ushakov
Subject: Re: list implementation
Date: Tue, 29 Jan 2002 09:32:11 +0300
User-agent: Mutt/1.3.25i

On Mon, Jan 28, 2002 at 18:47:00 +0100, H?ri Tam?s wrote:

> export @LI @PLS
> def @List
>     body @Body
> {
> 
>     def @PL { @Galley }
>     def @PLS { - @PL //1.2vx @PLS }
> 
>     def @LI into { @PL&&preceding }
>         right x
>     { x }
> 
>     @PLS              # <---- critical
>     @Body
> }
> 
> 
> The text to format was the following:
> 
> @List {
> @LI {foo}
> @LI {bar}
> }
> 
> However, in the final printed document nothing appeared.

Bear in mind that Lout is "lazy" in the functional programming sense
of the word.

I think the problem you see is because this version of @List is a
receptive symbol (b/c of @PL inside inside @PLS inside @List), but
it's suspended unless something tries to attach to it.  Since the @LI
galleys are in the body of the suspended symbol itself, they don't
trigger the manifestation of @List.  So you 1) don't get @List
manifested and 2) don't get warnings about unattached @LI.

If you are familiar with Java, this is like creating a Thread object
whose run() method is only called by its subordinate Runnable's run()
method. [hmm, this probably sounds even more confusing, but that's the
best analogy I can come up with at the moment].


> Finally I've removed the invocation of symbol "@PLS" from
> the definition of "@List" (right before the invocation of
> @Body), and inserted "@PLS" before ythe first use of
> "@LI";

This turns @List into an "ordinary" non-receptive symbol.


You can "kick-start" original @List by making its body look like

       @PL
    // @LI { @Null }
    // @PLS
    // @Body

since @PL // @LI { @Null } will, incidentally, force manifestation of
@List, but that's a kludge and shouldn't be used as a "solution" for
this problem.


PS: The white space in lout is an implicit *paragraph* concatenation.
So you really want // in your code most of the time, unless you know
what you are doing.

SY, Uwe
-- 
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen


reply via email to

[Prev in Thread] Current Thread [Next in Thread]