Subscribe

2009-05-05 Thread Kriangkrai Soatthiyanont

'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: 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: '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 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 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 "#'&qu

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: 'call' function disables echoing input

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Alex, Many thanks! Now it works, though it would be much better to have 'call' working correctly. (de shell* (S) # run shell command with interactive input (let Raw (raw) (unless Raw (raw T)) (let Opts '(icrnl icanon iexten echo echoe echok echoctl echoke) #! use (call "stty

Re: Block comment and unescape string

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Alex, > (let (Clr "#EEE" Cls "xxx") >(fill > '(html > (body (style "background-color:" Clr) > (div (class Cls)) ) ) > '(Clr Cls) ) ) One problem with 'fill' is that the expressions to fill cannot be anonymous (it must be the result of a variable), e.g. to f

Re: Block comment and unescape string

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Alex, Thanks for making it nestable. I like your code. ;-) Best regards, KS On 5/8/09, Alexander Burger wrote: > On Fri, May 08, 2009 at 09:48:05AM +0200, Alexander Burger wrote: >> Because: If the commented text contains the pattern "#{" or "}#" in a >> context where it is not relevant as a

Re: Block comment and unescape string

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Henrik, My purpose of block comment is not to comment out multiple lines, for that I would use single line comments too. I would use block comment to comment out small part in a line, e.g. (list 1 2 #{3 4}# 5) or to comment within context, e.g. (de f (A #{...}# B #{...}#)

Re: Block comment and unescape string

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Henrik, You may call me KS. It's NOT my intention to fork Pico Lisp! I just need some features. If I can do them myself, I implement and share them back. If I do not know how, I request them or ask for an alternative solution. It's OK for my contribution to not be included in standard Pico Lis

Re: Block comment and unescape string

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Alex and Henrik, > Is Kriangkrai acceptable, too? Sure. Kriangkrai is my first name. KS is from K for Kriangkrai (my first name) and S for Soatthiyanont (my surname). > Kriangkrai Soatthiyanont sounds Thai Yes, I'm Thai. Sawadee Krub :-) Best regards, KS -- UNSUBSCRIBE: m

Questions

2009-05-08 Thread Kriangkrai Soatthiyanont
Hi Alex, 1. What is the purpose of calling (wait) after (server 8080 "...")? It will "wait" for what? What is the differences if (wait) is not called? 2. Could you explain how does "ht:" magic work? : ht:Prin -> NIL : (ht:Prin "xxx") xxx-> T : (ht:abc) ht:abc -- /usr/local/picoL

Re: Questions

2009-05-09 Thread Kriangkrai Soatthiyanont
Hi Alex, >> 1. What is the purpose of calling (wait) after (server 8080 "...")? It >> will "wait" for what? What is the differences if (wait) is not called? > > In this case (when called without any arguments), 'wait' will wait for > an infinite time (see also "doc/refW.html#wait"). The purpose is

Re: Questions

2009-05-10 Thread Kriangkrai Soatthiyanont
Hi Alex, >> OK. Can the "Undefined error handling" be defined/extended/overridden >> at Lisp (not C) level? Something like Ruby's const_missing() and >> method_missing()? > > You can achieve something similar by catching the error, and then > defining the function on the fly. For example > >(p

Re: Questions

2009-05-11 Thread Kriangkrai Soatthiyanont
Hi Alex, > As I said, not without modification of the low-level error handler. > Execution is not continued after the error is caught, as the 'catch' is > in 'mydefs' and not on the lowest level. > > Why would you need that? It will enable code like this: (with-xml ( Also, floating poin

Re: Questions

2009-05-11 Thread Kriangkrai Soatthiyanont
Hi Tomas, >> =A0 =A0(with-xml >> =A0 =A0 =A0 (> =A0 =A0 =A0 =A0 =A0"text" >> =A0 =A0 =A0 =A0 =A0(> =A0 =A0 =A0 =A0 =A0"text" )) > > If you go this route, why not something like: > > (with-xml > =A0 ( =A0 =A0 =A0"text" > =A0 =A0 =A0( =A0 =A0 =A0"text" ) ) Because with (@ attr1 val1 ...), you can r

Re: Questions

2009-05-11 Thread Kriangkrai Soatthiyanont
Hi Alex, > Please take a look in "src/ext.c". There is, for example, 'ext:Sin', > that interfaces to scaled integers: > > =A0 : (ext:Sin 314159 10) > =A0 -> 0 > =A0 : (ext:Cos 314159 10) > =A0 -> -10 Ah, Thanks. Could you please explain how a "double" value is encoded in "cell"? I cou

Re: Vim syntax

2009-05-13 Thread Kriangkrai Soatthiyanont
Hi Alex, What are the features of PicoLisp 3? Anything radically changed? Best regards, KS On Wed, May 13, 2009 at 12:10 PM, Alexander Burger wrote: > Hi Jared, > >> Alex, I would like to see the picolisp 3 so far :D > > Please wait just a little more ;-) > > The current schedule is (if everyt

Re: Questions

2009-05-13 Thread Kriangkrai Soatthiyanont
Hi Alex, More questions ;-) 1. In FFI, it seems that 'boxCnt()' (not 'box()') must be used to return a correct value, why? When 'box()' should be used instead to return a value? (I see many places in C source that use box() when returning a value.) Which one should be used to return a pointer/add

Re: Questions

2009-05-13 Thread Kriangkrai Soatthiyanont
Hi Tomas, > you can find a prototype ffi generator at > http://logand.com/mplisp/src/mod/ It should be fairly straitforward to > understand how different types get converted between picolisp and C, > e.g. =A0http://logand.com/mplisp/src/mod/ffi.l is the ffi generator and > http://logand.com/mplisp

Re: Vim syntax

2009-05-13 Thread Kriangkrai Soatthiyanont
Hi Alex > Just that it has an extended internal architecture ("doc/structures"), > and is written in a generic assembly language, which in turn is written > in PicoLisp. Therefore, it has nuch cleaner internal structures and > algorithms. Can it interface with C libraries? Best regards, KS -- U

Re: Questions

2009-05-14 Thread Kriangkrai Soatthiyanont
Hi Alex, > Only when an object is accessed (value, property list etc.), it is > automatically loaded into the Lisp heap as an "external" symbol. And once loaded, they can be garbage collected when needed, right? > The current database files are in a binary format (called "PLIO" for > PicoLisp I/

FFI

2009-05-14 Thread Kriangkrai Soatthiyanont
Hi All, This is my attemp on FFI (Foreign Function Interface). It is based on Tomas's work and Alex's answers. Thanks you both! It should work on standard PicoLisp. I hope that it would be useful as a starting point for people new to PicoLisp wanting to interface with C libraries. Best regards, K