Re: [Factor-talk] Fry Question

2017-05-17 Thread Alexander Ilin
Oh, OK. Thank you for the explanation, John! 18.05.2017, 01:54, "John Benediktsson" : > Right now fry doesn't support "frying" into sequences that aren't quotations, > so this works: > >  '[ [ _ ] ] > > But this doesn't: > >  '[ { _ } ] > > We have a plan to fix this as

Re: [Factor-talk] Fry Question

2017-05-17 Thread John Benediktsson
Right now fry doesn't support "frying" into sequences that aren't quotations, so this works: '[ [ _ ] ] But this doesn't: '[ { _ } ] We have a plan to fix this as it turns out I was talking about this issue a couple days ago with someone. I'd like to make this fix since a lot of

[Factor-talk] Fry Question

2017-05-17 Thread Alexander Ilin
Hello! I have the following code, and it works: TUPLE: resource-gadget < track res ; : find-resource-window ( resource -- world/f ) [ { [ drop resource-gadget? ] [ res>> = ] } 2&& ] curry find-window ; Resource-gadget is a container for a resource tuple (in the res slot). The function

Re: [Factor-talk] Fry and { }

2009-06-05 Thread Samuel Tardieu
Sam == Samuel Tardieu s...@rfc1149.net writes: Sam It looks like _ is not substituted within { } in a fry expression: Sam Sam ( scratchpad ) [ '[ { _ } ] ] infer. Sam ( -- object) Sam Sam It makes it difficult to use a case inside a fry. Is it on purpose? Ping? Sam -- Samuel Tardieu --

Re: [Factor-talk] Fry and { }

2009-06-05 Thread Darrin Thompson
On Fri, Jun 5, 2009 at 5:17 AM, Samuel Tardieus...@rfc1149.net wrote: Sam == Samuel Tardieu s...@rfc1149.net writes: Sam It looks like _ is not substituted within { } in a fry expression: Sam Sam   ( scratchpad ) [ '[ { _ } ] ] infer. Sam   ( -- object) Sam Sam It makes it difficult to use

Re: [Factor-talk] fry directives inside lambda bodies

2008-11-02 Thread Eduardo Cavazos
On Saturday 01 November 2008 22:28:43 Slava Pestov wrote: I'll try and fix it. OK. For what it's worth, if it complicates the implementation too much, I wonder if it's worth it to do. Mixing frying and lambdas seems a little strange; if you're already naming things (let, lambda, etc), you

Re: [Factor-talk] fry directives inside lambda bodies

2008-11-02 Thread Slava Pestov
On Sun, Nov 2, 2008 at 1:45 AM, Eduardo Cavazos [EMAIL PROTECTED] wrote: OK. For what it's worth, if it complicates the implementation too much, I wonder if it's worth it to do. Mixing frying and lambdas seems a little strange; if you're already naming things (let, lambda, etc), you might as

[Factor-talk] fry directives inside lambda bodies

2008-11-01 Thread Eduardo Cavazos
Slava, What's the official stance on mixing fry and lambdas? In particular, using '_' inside of a lambda body. For example, this works: '[ [let | A [ 1 ] | A . 10 . ] ] call But this, which should be equivalent, does not: 10 '[ [let | A [ 1 ] | A . _ . ] ] call Ed

Re: [Factor-talk] fry directives inside lambda bodies

2008-11-01 Thread Slava Pestov
I'll try and fix it. On Sat, Nov 1, 2008 at 9:36 PM, Eduardo Cavazos [EMAIL PROTECTED] wrote: Slava, What's the official stance on mixing fry and lambdas? In particular, using '_' inside of a lambda body. For example, this works: '[ [let | A [ 1 ] | A . 10 . ] ] call But this,

Re: [Factor-talk] fry and curry

2008-09-01 Thread Slava Pestov
Dan, It might be nice if we could get rid of 2curry, 3curry, 3compose, prepose eventually. For example, consider this snippet which uses 2curry twice: [ [ dup link where dup ] 2dip [ r r first r at r push-at ] 2curry [ 2drop ] if ] 2curry each The fry version is a lot clearer:

Re: [Factor-talk] fry and curry

2008-09-01 Thread janko metelko
hm In this case fry looks 10 times nicer to my untrained eyes also. On Mon, Sep 1, 2008 at 2:04 AM, Slava Pestov [EMAIL PROTECTED] wrote: Dan, It might be nice if we could get rid of 2curry, 3curry, 3compose, prepose eventually. For example, consider this snippet which uses 2curry twice: [

Re: [Factor-talk] fry and curry

2008-08-31 Thread Daniel Ehrenberg
Well, personally, I never got used to fry. I feel comfortable using curry and compose for most things. I don't see why it is a problem to use them except in exceptionally complicated cases. For me, it feels like fry is doing more than is needed. Are you suggesting that we use { 1 2 3 } 4 '[ , + ]

Re: [Factor-talk] fry and curry

2008-08-31 Thread Slava Pestov
Hi Dan, Yes, that is what I'm suggesting. fry cannot express 'with' so we wouldn't do anything about usages of that word. Thanks for the input. I'll probably do a sweep of my own code at some point to convert curry/compose to fry, since I find fry more aesthetically pleasing, but I'll let other

Re: [Factor-talk] fry and curry

2008-08-31 Thread Eduardo Cavazos
Slava wrote: fry cannot express 'with' so we wouldn't do anything about usages of that word. Dan wrote: I'm not sure how to do what with does in terms of fry. 10 { 0 1 2 3 4 } [ - ] with map Using fry: 10 { 0 1 2 3 4 } swap '[ , _ - ] map I'm not saying it's prettier...

Re: [Factor-talk] fry and curry

2008-08-31 Thread Slava Pestov
Entering ``fry about'' in the listener will explain what it's all about. And FWIW, there is already a ``Web 2.0'' startup named REFACTR: http://refactr.com/ :-) Slava On Sun, Aug 31, 2008 at 5:52 PM, janko metelko [EMAIL PROTECTED] wrote: I have used curry but I haven't fry and I don't know

Re: [Factor-talk] fry and curry

2008-08-31 Thread janko metelko
I am not at my factor computer so can't try it right now , but will tomorrow. refactr? these web 2.0 names are really science of it's own :) they have a db error on their page. I have to call it refaktor because we can't have company names with english words ... it's just a company name... my

[Factor-talk] fry and curry

2008-08-30 Thread Slava Pestov
Hi all, Now that the 'fry' abstraction has been around for a while, how do people feel about using it? Should we generally try to phase out direct usages of 'curry' as much as possible, except for in the core, and use 'fry' everywhere else in basis and extra? Slava

Re: [Factor-talk] Fry is a lubricant

2008-07-25 Thread Daniel Ehrenberg
I have the same feeling about locals and now-considered-evil stack shufflers. All of these have some value as language features, especially to make development easier, but it seems like well-factored, well-written code doesn't use them all that much. Dan On Thu, Jul 24, 2008 at 8:58 PM, Slava

[Factor-talk] Fry is a lubricant

2008-07-24 Thread Slava Pestov
Hi all, I like fry very much, but I've noticed that most of my usages of 'fry' are pretty trivial, stuff like '[ , foo ] '[ , , foo ] Or sometimes the slightly more elaborate '[ swap , foo ] '[ drop , foo ] I've been trying to reconcile these two facts, and I think I've figured it out. In

Re: [Factor-talk] Fry is a lubricant

2008-07-24 Thread David Petersheim
If it's not too much trouble, could someone tell me what fry is? On Thu, Jul 24, 2008 at 11:58 PM, Slava Pestov [EMAIL PROTECTED] wrote: Hi all, I like fry very much, but I've noticed that most of my usages of 'fry' are pretty trivial, stuff like '[ , foo ] '[ , , foo ] Or sometimes the

Re: [Factor-talk] Fry is a lubricant

2008-07-24 Thread Slava Pestov
On Thu, Jul 24, 2008 at 11:30 PM, David Petersheim [EMAIL PROTECTED] wrote: If it's not too much trouble, could someone tell me what fry is? Fire up Factor, and run fry about Slava - This SF.Net email is sponsored by the

[Factor-talk] fry in inverse

2008-07-06 Thread Eduardo Cavazos
Dan, I spotted a place in 'inverse' where fry can be used nicely: : recover-chain ( seq -- quot ) [ no-match ] [ swap \ recover-fail 3array quotation ] reduce ; : recover-chain ( seq -- quot ) [ no-match ] [ swap '[ , , recover-fail ] ] reduce ; Ed

Re: [Factor-talk] fry in inverse

2008-07-06 Thread Daniel Ehrenberg
Feel free to change this if you care about it. I don't mind the old version of this enough to change it myself. Dan On Sun, Jul 6, 2008 at 10:37 AM, Eduardo Cavazos [EMAIL PROTECTED] wrote: Dan, I spotted a place in 'inverse' where fry can be used nicely: : recover-chain ( seq -- quot )

Re: [Factor-talk] fry

2008-03-26 Thread William Tanksley, Jr
What does one have to search for in order to read about 'fry'? Clearly 'fry' isn't the name of a vocabulary word, since it doesn't appear in any source you're showing, nor does Google find in when I search on factorcode.com; can someone post a Rosetta stone? -Wm

Re: [Factor-talk] fry

2008-03-26 Thread William Tanksley, Jr
Bruno [EMAIL PROTECTED] wrote: William Tanksley, Jr [EMAIL PROTECTED] wrote: What does one have to search for in order to read about 'fry'? Clearly It is on git, the version at factorcode is 0.91. Are you implying that the prebuilt binaries of 0.91 are not the right place to start looking?

Re: [Factor-talk] fry

2008-03-26 Thread Slava Pestov
Chris Double wrote: The easiest way is via the git repository since that contains the latest fry stuff. If you are on Windows I suggest installing cygwin. In fact, cygwin is required to compile (but not run) Factor. Make sure you include gcc and git. You can then get the git repository

Re: [Factor-talk] fry

2008-03-25 Thread Slava Pestov
Hi Chris, This is not supported yet. Another option there is to use locals instead of match-replace: [let | quot [ ... ] | [ ... [ ... quot ... ] ... ] ] However fry is lighter (syntax-wise) and what you're proposing would make a great addition so I will implement it soon. Slava Chris

Re: [Factor-talk] fry

2008-03-25 Thread Eduardo Cavazos
Is fry supposed to work with nested quotations, or should I be using some other construct? eg: 3 '[ 1 2 [ , ] ] = [ 1 2 [ 3 ] ] It doesn't yet... I've wanted to do stuff like this also. My workaround looks like this: 3 '[ , ] '[ 1 2 , ] Ed

[Factor-talk] fry

2008-03-15 Thread Slava Pestov
Hi all, Here is an example usage of the new 'fry' abstraction: : with-exit-continuation ( quot -- ) '[ exit-continuation set @ ] callcc1 exit-continuation off ; This is equivalent to any one of the following: : with-exit-continuation ( quot -- ) [ exit-continuation set call ] callcc1

Re: [Factor-talk] fry

2008-03-15 Thread Slava Pestov
Chris Double wrote: Shouldn't this be run in a scope or is fry doing that for you? If you have nested with-exit-continuation calls, then the inner will overwrite the exit-continuation won't it? Chris. This word intentionally doesn't use a scope. This is from the HTTP server which does

Re: [Factor-talk] fry

2008-03-15 Thread Samuel Tardieu
Slava == Slava Pestov [EMAIL PROTECTED] writes: Slava FWIW, fry is documented now. This is very neat! But I am surprised by the behaviour of _; I would have imagined that it would have skipped (and kept) the corresponding data on the stack at frying time, to keep the natural order. The