Re: (pack (intern "NIL")) bug?

2009-04-22 Thread Alexander Burger
On Wed, Apr 22, 2009 at 08:11:04AM +0200, Alexander Burger wrote: > The question is: What is the "correct" way? > > The same problem applies to other symbols as well, when they have > names with special characters. For example: > >: (intern "123") >-> 123 >: (+ @ 7) >123 --

Re: collect and db difference?

2009-04-22 Thread Tomas Hlavaty
Hi Alex, > 'collect' has a different syntax. Following 'usr' and '+Pat', it expects > a "from" and a "till" value (the "till" is optional), and then a chain > of 'get' arguments to retrieve subsequent values from the results. > > For example (in the "app/" demo): > >: (collect 'nr '+Item NIL T

Re: (pack (intern "NIL")) bug?

2009-04-22 Thread Tomas Hlavaty
Hi Alex, >> This behaviour seems a bit strange to me. I would expect (pack >> (intern "NIL")) to return NIL... > > You are right. This is a bug in 'intern'. Ok. > 'NIL', however, is a special symbol which is recognized by the > reader. In 32bit PicoLisp, there is no symbol with a name "NIL" >

Re: collect and db difference?

2009-04-22 Thread Alexander Burger
Hi Tomas, On Wed, Apr 22, 2009 at 09:59:07AM +0100, Tomas Hlavaty wrote: > >: (filter '((This) (= *D (: doc))) (collect 'usr '+Pat *U)) > > Yes, that's what I wanted. I thought it was possible to avoid > collecting the whole list constraining the search space before > collecting the values.

Re: (pack (intern "NIL")) bug?

2009-04-22 Thread Alexander Burger
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...@softwar

Re: (pack (intern "NIL")) bug?

2009-04-22 Thread Tomas Hlavaty
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 thoug

'chain' and atom argument

2009-04-22 Thread Tomas Hlavaty
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

Re: 'chain' and atom argument

2009-04-22 Thread Alexander Burger
Hi Tomas, > : (make (link 1) (chain (cons 2 3))) > -> (1 2 . 3) > ... > I would expect: > > : (make (link 1) (chain 2)) > -> (1 . 2) Right, this would take on the same philosophy as 'append' or 'conc': : (append (1) 2) -> (1 . 2) But here, too, it only works for the last element, and in

Re: 'chain' and atom argument

2009-04-22 Thread Tomas Hlavaty
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 beh

Re: 'chain' and atom argument

2009-04-22 Thread Alexander Burger
On Wed, Apr 22, 2009 at 02:07:29PM +0100, Tomas Hlavaty wrote: > > Should I keep that change? > > Yes please;-) OK, it is now in the testing release (together with the check for "NIL" in 'intern'). Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Re: collect and db difference?

2009-04-22 Thread Tomas Hlavaty
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-