Re: [Factor-talk] What exactly is the retain stack?

2014-05-16 Thread Björn Lindqvist
2014-05-16 0:29 GMT+02:00 Jon Purdy evincarofaut...@gmail.com: Is that it's only use? Then why? dip can easily be formulated using non-retain stack using primitives: For example: a b c [ append ] dip - a b c -rot append swap That implementation assumes the quotation takes two operands and

Re: [Factor-talk] What exactly is the retain stack?

2014-05-16 Thread Rupert Swarbrick
Björn Lindqvist bjou...@gmail.com writes: Hi! Is that it's only use? Then why? dip can easily be formulated using non-retain stack using primitives: For example: a b c [ append ] dip - a b c -rot append swap What if the contents of the quotation use more than one item from the stack? How

Re: [Factor-talk] What exactly is the retain stack?

2014-05-16 Thread Joe Groff
On Fri, May 16, 2014 at 7:38 AM, Björn Lindqvist bjou...@gmail.com wrote: 2014-05-16 0:29 GMT+02:00 Jon Purdy evincarofaut...@gmail.com: Is that it's only use? Then why? dip can easily be formulated using non-retain stack using primitives: For example: a b c [ append ] dip - a b c -rot

Re: [Factor-talk] What exactly is the retain stack?

2014-05-15 Thread Slava Pestov
Hi Bjorn, The retain stack is used to implement the 'dip' combinator. Slava On Thu, May 15, 2014 at 1:46 PM, Björn Lindqvist bjou...@gmail.com wrote: Hi everyone, I've been walking around in Factors VM for a while and there is a lot of usages and references to the retain stack. But I

Re: [Factor-talk] What exactly is the retain stack?

2014-05-15 Thread Jon Purdy
So the retain stack is useless? Freeing up a whole register sounds like it should be great for performance, at least on 32 bit x86. You can make a complete stack-based concatenative language with only one stack. But some combinators are implemented more efficiently when you have scratch space

Re: [Factor-talk] What exactly is the retain stack?

2014-05-15 Thread Björn Lindqvist
Hi! Is that it's only use? Then why? dip can easily be formulated using non-retain stack using primitives: For example: a b c [ append ] dip - a b c -rot append swap 2014-05-15 22:49 GMT+02:00 Slava Pestov sl...@factorcode.org: Hi Bjorn, The retain stack is used to implement the 'dip'

Re: [Factor-talk] What exactly is the retain stack?

2014-05-15 Thread Jon Purdy
Is that it's only use? Then why? dip can easily be formulated using non-retain stack using primitives: For example: a b c [ append ] dip - a b c -rot append swap That implementation assumes the quotation takes two operands and produces one result, which is not always the case. More

Re: [Factor-talk] What exactly is the retain stack?

2014-05-15 Thread Jon Purdy
In the current state of Kitten: Oop, correction: this is not Kitten syntax. I had been writing in Kitten but decided against it, then forgot to update the text. Current Kitten would be: def dip {.r, .s, a}(.r a (.r - .s) - .s a): … But this is a Factor mailing list. ;)