Re: pdf generator

2009-05-07 Thread Alexander Burger
Hi Tomas, > >> Alex, I need to call 'lseek' function. How could I get hold of the Hmm, I deliberately omitted 'lseek' from the standard system, as I think it is useful only for very special cases. For the PicoLisp I/O system it does not make much sense, as reading and writing is buffered, so th

Re: Forgot the code again!

2009-05-07 Thread Alexander Burger
Hi Tomas, > In the long-term, wouldn't it be better to put the glyph > related stuff into @lib/glyph.l and keep access to the full glyph <-> > codepoint mapping? I see, you are thinking of the PDF generator. At the moment, though, this involves only a few lines of code, and I don't want to blow u

'idx' and balancing (was: Forgot the code again!)

2009-05-07 Thread Alexander Burger
Hi Tomas, > Why does inserting and removing using 'idx' require manual rebalancing Well, as always in PicoLisp, this is under the control of the programmer. 'idx' is deliberately designed in this way. It does only the basic, straight-forward binary tree operations. This can be quite fast, becaus

Re: Forgot the code again!

2009-05-07 Thread Tomas Hlavaty
Hi Alex, > I would suggest to keep a separate version for other purposes. Is > this acceptable? yes, no problem;-) Thank you, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Re: pdf generator

2009-05-07 Thread Tomas Hlavaty
Hi Alex, > I think it is wiser and much easier to write a separate C library > for specialized I/O. you convinced me:-) Thanks, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Re: 'idx' and balancing

2009-05-07 Thread Tomas Hlavaty
Hi Alex, > 'idx' is deliberately designed in this way. It does only the basic, > straight-forward binary tree operations. This can be quite fast, > because balancing operations (or using self-balancing trees like > splay trees) introduce additional overhead. And - except for > pathological situati

Re: 'idx' and balancing

2009-05-07 Thread Alexander Burger
Hi Tomas, > So 'idx' is usually used with data that don't change? How does Not necessarily. It is just recommended that data are not inserted in sequential order. This is usually not the case, otherwise you might find a way to avoid it, or write a separate Lisp function (e.g. splay) that rebalan

'call' function disables echoing input

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi, The 'call' function seems to disable echo. Also, The Enter key does not end an input line, Ctrl-J must be used instead. When I run: (call 'sh "-c" "echo -n 'name: '; read name; echo $name") It outputs "name :" and waits for input. I type something (e.g. "abc") but nothing echo. I press the En

Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, I have a patch to add block comment (#{}#) and unescape string ({$.$}) syntax. Do you think that the syntax will affect old code? Should it be added to the standard distribution? Best regards, KS io.c.patch Description: Binary data

Re: 'call' function disables echoing input

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > When I run: (call 'sh "-c" "echo -n 'name: '; read name; echo $name") > It outputs "name :" and waits for input. I type something (e.g. "abc") > but nothing echo. I press the Enter key, nothing happens. I press > Ctrl-J, then it prints "abc". Hmm, I cannot reproduce it in the sam

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > I have a patch to add block comment (#{}#) and unescape string > ({$.$}) syntax. I think the block comments are a great idea. Such a feature was missing, and I like the above syntax. But I'm a bit reluctant about the unescaped strings. Why do you think they might be neede

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, With unescaped string, we don't need to worry escaping (e.g. "\"" "\^"), well except ensuring that there is no "$}" in the string. With that, we can generate files easily, e.g. (out "t.html" (prin {$.$})) Best regards, KS On Thu, May 7, 2009 at 7:45 PM, Alexander Burger wrote:

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > "\^"), well except ensuring that there is no "$}" in the string. With > that, we can generate files easily, e.g. > > (out "t.html" (prin {$ style="background-color:#EEE">... class="xxx">..$})) I see your point, but it seems a little overkill to me for such cases. BTW, I thi

Re: 'call' function disables echoing input

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, The reason is that I want to do scripting in PicoLisp (thank you so much for sharing it :-). Sometimes I need to call a shell script, which requires "interactive" input (and that I want it to still be "interactive"). Nothing occur when running: : (vi "file") -> NIL But using (call '

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, > BTW, I think using 'here' you can achieve something similar, but without > any danger of conflict: > > =A0 (out "t.html" (here)) > =A0 > =A0 > =A0 > =A0 But what if we want to mix it with expressions? (let (Clr "#EEE" Cls "xxx") (pack {$ $} )

Re: Block comment and unescape string

2009-05-07 Thread Tomas Hlavaty
Hi Kriangkrai, > that, we can generate files easily, e.g. > > (out "t.html" (prin {$ style="background-color:#EEE">... class="xxx">..$})) you can try @lib/html.l or @lib/xml.l to achieve that better: (out "t.html" ( NIL ( html ( body style "background-color:#EEE"

Re: Block comment and unescape string

2009-05-07 Thread Tomas Hlavaty
Hi Kriangkrai, > I have a patch to add block comment (#{}#) it would be nice to have block comments. I would actually prefer something which would not make me edit both ends of the commented out expression, e.g. Common Lisp #+NIL(...) is better in that sense as you can stay at the beginning

Re: 'call' function disables echoing input

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > The reason is that I want to do scripting in PicoLisp (thank you so > much for sharing it :-). Sometimes I need to call a shell script, You are welcome :-) > which requires "interactive" input (and that I want it to still be > "interactive"). OK, I understand. > Nothing occur

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > But what if we want to mix it with expressions? > >(let (Clr "#EEE" Cls "xxx") > (pack {$ > > > $} )) Then it gets indeed a bit clumsy, but you can use multiple 'here's and suitable delimiters: (let (Clr "#EEE" Cls "xxx") (here "<1>")

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Tomas, > something which would not make me edit both ends of the commented out > expression, e.g. Common Lisp #+NIL(...) is better in that sense as you > can stay at the beginning all the time when commenting or I personally find the token '#+NIL' a bit too long (a typical Common Lisp style).

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, Yes, it's ok to include only block comment :-) Best regards, KS On Fri, May 8, 2009 at 1:20 AM, Alexander Burger wrot= e: > Hi Kriangkrai, > >> But what if we want to mix it with expressions? >> >> =A0 =A0(let (Clr "#EEE" =A0Cls "xxx") >> =A0 =A0 =A0 (pack {$ >> =A0 =A0 =A0 =A0 =A0 >>

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex and Tomas, In PLT Scheme, you can comment out a single expression with "#'" (e.g. .. #'(+ 1 2) ...). It would be great to have such kind of comment too, but I don't know how to do it easily. :-( In fact, my #{...}# syntax is inspired by the #|...|# syntax in PLT Scheme (but in PLT, it can

Re: Block comment and unescape string

2009-05-07 Thread Tomas Hlavaty
Hi Alex, >> something which would not make me edit both ends of the commented out >> expression, e.g. Common Lisp #+NIL(...) is better in that sense as you >> can stay at the beginning all the time when commenting or > > I personally find the token '#+NIL' a bit too long (a typical Common > Lisp s

Re: Block comment and unescape string

2009-05-07 Thread Tomas Hlavaty
Hi Kriangkrai, >> But what if we want to mix it with expressions? >> >>(let (Clr "#EEE" Cls "xxx") >> (pack {$ >> >> >> $} )) I would suggest: (de style Lst (let S NIL (while Lst (let (K (pop 'Lst) V (eval (pop 'Lst) 1)) (whe

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Just to correct my mistake. It is "#;", not "#'", for single-expression comment in PLT Scheme. On Fri, May 8, 2009 at 1:53 AM, Kriangkrai Soatthiyanont wrote: > Hi Alex and Tomas, > > In PLT Scheme, you can comment out a single expression with "#'" (e.g. > ... #'(+ 1 2) ...). It would be great t

Re: Block comment and unescape string

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Tomas, Thanks for the code. But my intension for unescaped string is for "casual" template (most of text are static strings) and embedding files (without creating separate files). It would be great if PicoLisp have "quasi-quotation", so the code could be something like: (out "t.html" (sxml

Re: 'call' function disables echoing input

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi Alex, I've found a way to make it works, but only when I load the file in the PicoLisp prompt, not when the file is loaded from command-line argument. > /tmp/t.l (de shell* (S) # run shell command with interactive input # NB: use (call "stty") to see what options need to be toggled

Vim syntax

2009-05-07 Thread Kriangkrai Soatthiyanont
Hi PicoLisp's Vimers, As I could not find a PicoLisp syntax for Vim, so I created one myself (well, by looking at Lisp/Scheme syntax files). Just copy the contents of the attached file into your ~/.vimrc. And modify it if you don't like the result! ;-) Best regards, KS picolisp.vim Description

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Tomas, > well, #+NIL(...) seems a bit long, but it is actually a conditional > comment where the condition is NIL in this case. Ah, I see! Well, in PicoLisp there is also a kind of "conditional compilation" which I use quite frequently. It is the read macro operator '~' (tilde) in combination

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > Yes, it's ok to include only block comment :-) Great! Thanks for the contribution! I released it now in "picoLisp.tgz" and also "miniPicoLisp.tgz". Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Re: Block comment and unescape string

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > It would be great if PicoLisp have "quasi-quotation", so the code > could be something like: > > (out "t.html" >(sxml > (let (Clr "#EEE" Cls "xxx") > `(html > (body (@ style "background-color:" ,Clr) >(div (@ class ,Cls)) ) Ther

Re: 'call' function disables echoing input

2009-05-07 Thread Alexander Burger
Hi Kriangkrai, > I've found a way to make it works, but only when I load the file in > the PicoLisp prompt, not when the file is loaded from command-line > argument. > ... > Do you have more hint? So the difference must be whether the console was set to raw mode or not. When the PicoLisp command