[Factor-talk] randomize word is broken?

2009-02-14 Thread study.ana...@gmail.com
Hello. I found strange behavior of the randomize word in random vocab. The code is pasted here. > ( scratchpad ) build . > 633 > ( scratchpad ) 30 [ { 0 1 } randomize first ] replicate . > { 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 } Thanks. -

Re: [Factor-talk] randomize word is broken?

2009-02-14 Thread Doug Coleman
Thanks for the bug report. This is fixed now -- the randomize word could not exchange an element with itself, so two element sequences would always just reverse. There's a unit test to make sure this doesn't happen again. Doug On Feb 14, 2009, at 2:29 AM, study.ana...@gmail.com wrote: > >

[Factor-talk] First impressions

2009-02-14 Thread Matt Gushee
OK, I'm hooked. I was trying to avoid learning another new language-- especially since I was in the middle of trying to systematize my haphazard knowledge of C. But I find Factor ... strangely compelling. Anyway, thought I should briefly introduce myself. I've been around open source development s

[Factor-talk] Macro puzzle

2009-02-14 Thread Matt Gushee
Hi, all-- Okay, so I am trying to understand how macros work in Factor. I wrote my first macro last night, which looks like this: MACRO: print-with-suffix ( str -- ) append print ; Then I can define a word in terms of the macro: : print-with-yeah ( str -- ) " yeah!" print-with-suffix ;

Re: [Factor-talk] Macro puzzle

2009-02-14 Thread Doug Coleman
Hi Matt, You don't need a macro to do what you're doing: : print-with-suffix ( str -- ) append print ; is correct as is. Macros are for expanding code at compile-time. In the UI, do "macros" about and read the docs. Some good examples of macros are in basis/generalizations and basis/combin

Re: [Factor-talk] First impressions

2009-02-14 Thread Slava Pestov
On Sat, Feb 14, 2009 at 11:56 PM, Matt Gushee wrote: > OK, I'm hooked. I was trying to avoid learning another new language-- > especially since I was in the middle of trying to systematize my > haphazard knowledge of C. But I find Factor ... strangely compelling. Thanks for the feedback! > Anywa

Re: [Factor-talk] Macro puzzle

2009-02-14 Thread Slava Pestov
Matt, Doug wrote a very detailed e-mail that explains everything; I'd just like to add a couple of minor points. If it wasn't for the compiler, then the following would be equivalent: MACRO: foo ( x -- ) bar ; : foo ( x -- ) bar call ; What the compiler does, then, is if it encounters a call to