Hi Alex,

On 29. Sep, 2014, at 15:40, Alexander Burger <a...@software-lab.de> wrote:

> Hi Jon,
> 
>> I just noticed that doing the (prin "-> ") before the (eval Exe)
>> causes the arrow to be printed before the first printed line, e.g. when
>> entering an expression like (for N 3 (prinl N)). Instead, the arrow
>> should appear just before the final result.
>> I have now ended up with this:
>> 
>> (in NIL
>> (use Res
>>   (until (eof)
>>     (setq Res
>>       (let @ Res
>>         (eval (read)) ) )
>>     (prin "-> ")
>>     (println Res)
>>     (flush) ) ) )
> 
> Yes, right. That's better.
> 
> The (flush) at the end is actually not needed, because the end-of-line
> in 'println' flushes the output automatically. However 'prin' does not,
> so I would move the (flush) up:
> 
>   (prin "-> ")
>   (flush)
>   (println Res) ) ) )
> 
> This is critical only when printing the result takes a long time. You
> see that, for example, if you calculate a big number which takes time to
> convert upon output.
> 
>   : (** 10000 10000)
> 
> The "-> " appears immediately due to the (flush), but the digits 1000...
> only after a second or so.
> 
> ♪♫ Alex


Thanks. I tried moving (flush) up, but it didn’t work well in my websocketd 
setup. The effect was that the arrow and result didn’t appear until I entered a 
new command, so it seemed as if ‘println’ didn’t flush. I’ll keep my (flush) at 
the end. ;-)
I’m using 32-bit PicoLisp.

/Jon

Reply via email to