Re: [Factor-talk] stack effect

2015-07-29 Thread Iain Gray
many thanks > On 29 Jul 2015, at 12:04, Björn Lindqvist wrote: > > Georg solved your problem, but in the future you can easily use > Factors introspection to see why it complains about stack effects. For > example, the first quotation given to the inner if is [ 0 ] and you > can infer its stack

Re: [Factor-talk] stack effect

2015-07-29 Thread Björn Lindqvist
Georg solved your problem, but in the future you can easily use Factors introspection to see why it complains about stack effects. For example, the first quotation given to the inner if is [ 0 ] and you can infer its stack effect: IN: scratchpad [ 0 ] infer. ( -- x ) Then because the two quotatio

Re: [Factor-talk] stack effect

2015-07-29 Thread Iain Gray
thanks, getting my iprefix Scheme code confused with postffix factor > On 29 Jul 2015, at 09:01, Georg Simon wrote: > > Am Wed, 29 Jul 2015 08:44:20 +0100 > schrieb Iain Gray : > > Just guessing: > Replace [ 0 < amount 0 coins = or [ 0 ] > with [ 0 amount < 0 coins = or [ 0 ] >

Re: [Factor-talk] stack effect

2015-07-29 Thread Georg Simon
Am Wed, 29 Jul 2015 08:44:20 +0100 schrieb Iain Gray : Just guessing: Replace [ 0 < amount 0 coins = or [ 0 ] with [ 0 amount < 0 coins = or [ 0 ] signature.asc Description: PGP signature -- _

Re: [Factor-talk] Stack effect declaration is wrong

2014-08-24 Thread mr wzrd
Er, nevermind, seems to work now somehow. On 08/24/2014 01:01 PM, mr wzrd wrote: > Hello list. > > Sometimes I get an error that a stack effect declaration is wrong, > and then can't figure out why. > > --- The word > historical-prices-from-year cannot be executed

Re: [Factor-talk] stack effect

2012-03-02 Thread Jon Harper
If you are typing this directly in the listener, the non-optimizing compiler is used, which doesn't enforce static stack effects on words. If you write this code in a file and compile it with the optimizing compiler, you will get an error. Regards, Jon Le 2 mars 2012 22:32, "Arkady Rost" a écrit :

Re: [Factor-talk] stack effect

2012-03-02 Thread Doug Coleman
You're using the datastack as a data structure. That's like calling a varargs function in C -- in your case, loop could consume any number of elements on the stack. The implementation of the listener doesn't restrict code like this, but the compiler does. You have to know how many arguments from t

Re: [Factor-talk] stack effect

2012-03-02 Thread Joe Groff
On Fri, Mar 2, 2012 at 1:32 PM, Arkady Rost wrote: > Hi! > Today I was trying to write some factor code and it turned out that I can > write such code: > 1 5 4 3 2 [ 5 = not ] loop > It works and produces stack with one element 1. I expect that at least I > would have a warning because loop word t

Re: [Factor-talk] stack-effect syntax

2010-11-21 Thread Shaping
They're count-binding, but not type-binding. >Ignore for now the fact that you can declare nested effects. Take >the basic case. What if I really want word sum-of-integers to be >able to add only integers and not, say, floats?: Then I suggest you try some other language which has st

Re: [Factor-talk] stack-effect syntax

2010-11-18 Thread Miles Gould
On Thu, Nov 18, 2010 at 05:58:48AM -0600, Shaping wrote: >A word could be defined with the following stack effects and the behavior >would be the same: > >: foo ( a quot -- ) > >: foo ( apples bananas -- ) > >: foo ( !...@# @#$ -- ) Yes. >Likewise, with nested stack ef

Re: [Factor-talk] stack-effect syntax

2010-11-18 Thread Joe Groff
On Thu, Nov 18, 2010 at 5:28 PM, Shaping wrote: > I was looking for a definition. "quot:" does not seem to behave like a > word or literal. "quot:" > > Yes, that is the part that concerns me. Why did we design this convention? > The convention comes from Forth best practices, in which word de

Re: [Factor-talk] stack-effect syntax

2010-11-18 Thread Shaping
I was looking for a definition. "quot:" does not seem to behave like a word or literal. "quot:" occurs only once on the above page in an example of a row-polymorphic combinator, but is not defined. However, "quot" is mentioned briefly in the table of 13 "names": There's no documentation for "qu

Re: [Factor-talk] stack-effect syntax

2010-11-18 Thread Joe Groff
On Thu, Nov 18, 2010 at 4:26 PM, Shaping wrote: > > I was looking for a definition. "quot:" does not seem to behave like a > word or literal. "quot:" occurs only once on the above page in an example > of a row-polymorphic combinator, but is not defined. However, "quot" is > mentioned briefly in

Re: [Factor-talk] stack-effect syntax

2010-11-18 Thread Shaping
> I can't find any info in Browser on "quot:". http://docs.factorcode.org/content/article-effects.html I was looking for a definition. "quot:" does not seem to behave like a word or literal. "quot:" occurs only once on the above page in an example of a row-polymorphic combinator, but is n

Re: [Factor-talk] Stack effect inference (COM words not using define-declared)

2008-06-11 Thread Joe Groff
> Hi Joe, > > The new 'beep' code causes a bootstrap failure on Unix platforms with > X11. Doh, forgot to commit the change to x11.xlib to add the XBell function. Fixed. By the way, trying to build Factor with X11=1 on OS X Leopard bumps into this bug: http://wiki.finkproject.org/index.php/F

Re: [Factor-talk] Stack effect inference (COM words not using define-declared)

2008-06-11 Thread Slava Pestov
On Jun 11, 2008, at 4:34 PM, Slava Pestov wrote: > The new 'beep' code causes a bootstrap failure on Unix platforms with > X11. I found and fixed the problem; never mind. Slava - Check out the new SourceForge.net Marketpl

Re: [Factor-talk] Stack effect inference (COM words not using define-declared)

2008-06-11 Thread Slava Pestov
On Jun 9, 2008, at 10:20 PM, Joe Groff wrote: >> By the way, the COM code defines some words with 'define'. Can you >> update it to use 'define-declared' please? The new stack effect >> literal syntax (look at (() might help. > > Sure thing--the change is in git://repo.or.cz/factor/jcg.git . I've

Re: [Factor-talk] Stack effect inference (COM words not using define-declared)

2008-06-09 Thread Joe Groff
> By the way, the COM code defines some words with 'define'. Can you > update it to use 'define-declared' please? The new stack effect > literal syntax (look at (() might help. Sure thing--the change is in git://repo.or.cz/factor/jcg.git . I've got a couple of other patches in there too: one add

Re: [Factor-talk] Stack effect inference

2008-06-09 Thread Slava Pestov
Joe, Eventually I might do something like that; when I implement multi- methods, it might make sense for the parser to always expect ( after the word name. For now, I'm enforcing this in the compiler, not the parser. By the way, the COM code defines some words with 'define'. Can you update

Re: [Factor-talk] Stack effect inference

2008-06-09 Thread Joe Groff
> Since my plan is to use Factor to take over the world and get > disgustingly rich, this is not an acceptable state of affairs. There > are two solutions: > > 1) Revive the old stack effect inference algorithm which did not > require annotations at all. > > 2) Require stack effect declarations on

Re: [Factor-talk] Stack effect inference

2008-06-09 Thread janko metelko
I vote for #2, I probably need/want stack effect declarations even more than the compiler when I look at code. But, I vote for 2b) Require stack effect declarations on all words On Sat, Jun 7, 2008 at 12:00 PM, Slava Pestov <[EMAIL PROTECTED]> wrote: > Hi all, > > For a while now Factor has requ