Re: [Factor-talk] Efficient way of adding a word in front of a quotation

2007-10-11 Thread Samuel Tardieu
> "Slava" == Slava Pestov <[EMAIL PROTECTED]> writes:

Slava> What are you coding?

Nothing particular yet, just playing.

  Sam
-- 
Samuel Tardieu -- [EMAIL PROTECTED] -- http://www.rfc1149.net/


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Efficient way of adding a word in front of a quotation

2007-10-10 Thread Slava Pestov
Hi,

You can do

[ swap ] swap compose

On 10-Oct-07, at 7:40 PM, Samuel Tardieu wrote:

> On a related topic, would the following be efficient?
>
>   : curry* ( param obj quot -- obj curry )
> rot [ , \ swap , % ] [ ] make ; inline

Well, it's not inefficient because it calls optimized sequence words,  
but the optimizing compiler is not able to infer the stack effect  
that would result from calling this quotation.

In most cases it is not necessary to write code which constructs  
quotations at all. Chances are you can simplify your stack effect and  
express what you need using built-in combinators.

What are you coding?

Slava

>
>   Sam
> -- 
> Samuel Tardieu -- [EMAIL PROTECTED] -- http://www.rfc1149.net/
>
>
> -- 
> ---
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a  
> browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


[Factor-talk] Efficient way of adding a word in front of a quotation

2007-10-10 Thread Samuel Tardieu
Is there an efficient equivalent of "curry" to add a word to execute
in front of a quotation (so that the quotation can still be compiled?)

For example, does

  \ swap add*

give a compilable quotation if the quotation on the stack can be
compiled?

Would "curry*" written as

  : curry* ( param obj quot -- obj curry )
swapd \ swap add* 2curry ; inline

be as efficient as the current definition?

(without considering the fact that "add*" cannot be used in the
kernel)

On a related topic, would the following be efficient?

  : curry* ( param obj quot -- obj curry )
rot [ , \ swap , % ] [ ] make ; inline

  Sam
-- 
Samuel Tardieu -- [EMAIL PROTECTED] -- http://www.rfc1149.net/


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk