Re: (pack (intern NIL)) bug?
On Wed, Apr 22, 2009 at 10:07:54AM +0100, Tomas Hlavaty wrote: Are there other special symbols in the 32bit PicoLisp that behave like NIL? Not that I can think of any. Except for the mentioned example where symbols look like numbers. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: (pack (intern NIL)) bug?
Hi Alex, The question is: What is the correct way? I am writing my own sexp reader which is safe against malicious input, i.e. it does not call eval (the escape chars like ` are not understood). : (intern 123) - 123 : (+ @ 7) 123 -- Number expected I thought I could use (intern (till ^I^M^J()\ T)) to read in atoms but obviously it's not possible because intern does not understand numbers. 'any' seems to be using the picolisp reader so I cannot use that: : (intern 12`+453) - 12\`+453 : (any 12`+453) - 12 is not the same. Looks I need to make more effort and determine the type of the atom before feeding it to 'intern' or 'format'. In general, 'intern' should do what it is supposed to do, and intern a symbol. When the user chooses to intern a symbol with a strange name like 123 it is his choice. I suppose that's reasonable. Thank you, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
'chain' and atom argument
Hi Alex, (chain 'lst ..) - lst is there a reason 'chain' does not work with atoms? : (make (link 1)) - (1) : (make (link 1) (chain 2)) - (1) : (make (link 1) (chain (cons 2 3))) - (1 2 . 3) : (make (link 1) (chain 2) (chain (cons 3 4))) - (1 3 . 4) : (make (link 1) (chain 2) (chain (cons 3 4)) (chain (cons 5 6))) - (1 3 5 . 6) I would expect: : (make (link 1) (chain 2)) - (1 . 2) I guess this is not currently achievable using 'make'? Thank you, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: 'chain' and atom argument
Hi Alex, I would expect: : (make (link 1) (chain 2)) - (1 . 2) In this respect, 'chain' is analogous, it simply processes the cell arguments, and does not preserve any CDRs, as it cannot not know if later more elements will be added with 'link' or 'chain'. Yes, I think the behaviour above is quite simple, natural, logical, practical and efficient:-D I guess this is not currently achievable using 'make'? The following would do that : (make (link 1) (conc (made) 2)) - (1 . 2) but is rather inefficient because it traverses the whole (made) list to concatenate the '2'. I see. Thanks. I guess that destructively messing with the make environment in general breaks it, if it is not the last operation on it: : (make (link 1) (conc (made) 2) (chain (conc 3 4))) - (1 . 2) Anyway, this seems to be a useful feature. It basically just needs the exchange of two lines in 'doChain()' in src/subr.c: do { if (isCell(y = EVAL(car(x { *Env.make = y; do - do { *Env.make = y = EVAL(car(x)); if (isCell(y)) { do Should I keep that change? Yes please;-) Thank you, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: collect and db difference?
Hi Alex, 1. You could use the Pilog functions 'pilog' or 'solve' and 'select' 2. The most efficient way is to use an '+Aux' key. This generates a combined key in addition to the two indexes for 'usr' and 'doc'. Thank you for the examples, Tomas -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe