Re: closures

2008-10-26 Thread Alexander Burger
Hi Tomas, > When you work on the 64 bit version, you obviously implemented > miniPicoLisp "prototype" and now building it in assembler. How and The two implementations have almost nothing in common. Just that 'mini' compiles also on 64 bits, because its model is independent of the machine's word

Re: closures

2008-10-26 Thread Tomas Hlavaty
Hi Alex, >> Have you measured and/or noticed impact on performance of these >> micro-optimizations? I mean, are they really worth it? > > Very probably not ... it is similar to the situation with 'do' ;-) When you work on the 64 bit version, you obviously implemented miniPicoLisp "prototype" and

Re: 'pre?', 'sub?' and 'length'

2008-10-26 Thread Tomas Hlavaty
> This would make sense. That functionality is covered by 'head', though. Oops, I did not notice this... must read ref more carefully:-o > because 'T' has the meaning of "infinite" in comparisons. Nice interpretation. I will assume my case is too application specific. > I'm very glad about thi

Re: 'do'

2008-10-26 Thread Tomas Hlavaty
> Do you really think you would need such a feature often? It would be useful sometimes, when debuging for example, I would not have to change the code much, just stick I and print... >(let I 0 (do 5 (print (inc 'I)) "finished")) With this I would have to add parens and inc etc. Not somethi

Re: 'pre?', 'sub?' and 'length'

2008-10-26 Thread Alexander Burger
Hi Tomas, > : (pre '(1 2) '(1 2 3 4)) > -> T > : (pre '(1 2) '(1 5 2 3 4)) > -> NIL This would make sense. That functionality is covered by 'head', though. > 'length' returns T for circular lists currently, which is not great. > It could return the real length too (as the number of 'car' elemen

Re: closures

2008-10-26 Thread Alexander Burger
Hi Tomas, > ... (zero A) ... > .. > Have you measured and/or noticed impact on performance of these > micro-optimizations? I mean, are they really worth it? Very probably not ... it is similar to the situation with 'do' ;-) Still I think it is good to have certain convenience functions that don

Re: 'do'

2008-10-26 Thread Alexander Burger
Hi Tomas, > I see that you take big pain to optimize things a lot. I would Not intentionally ;-) I don't really mind so much about the actual performance, but more about the underlying principles. And I feel that it is not the "right thing" to waste a cell at each primitive iteration through a

'pre?', 'sub?' and 'length'

2008-10-26 Thread Tomas Hlavaty
Hi Alex, diving more into picoLisp utility functions I foud some functions that could be extended: For example 'pre?' and 'sub?' could understand lists: (de pre (P L) (let X T (while (and X P L) (if (and (pair P) (pair L) (= (car P) (car L))) (setq P (cdr P) L (cdr

Re: closures

2008-10-26 Thread Tomas Hlavaty
Hi Alex, >(let @S '((I . 0)) > (def 'count (curry (@S) () (job '@S (inc 'I > (def 'reset (curry (@S) () (job '@S (zero I ) > >(let @S (list (cons 'I 0)) >(let I (cons 0) I like it this way, thanks. I also found that once the things inside the closures get complica

Re: 'do'

2008-10-26 Thread Tomas Hlavaty
Hi Alex, > The current implementation of 'do' is not well suited to grant access to > the internal counter to the application level. > > Because 32bit PicoLisp has no short numbers, incrementing a number > always results in the allocation of a new cell (turning the old cell > into garbage). To avo