[Factor-talk] Animation

2008-03-04 Thread Ben Schlingelhof
I discovered Factor about a month ago and am trying very much to fall in love with it. As usual at the very beginning of a new relationship, I'm rather confused. Loved Forth in 1989, so I have a faint memory of stack-based programming. Still everything in Factor is new, promising, and utterly s

[Factor-talk] Factor + breakpoint = crash

2008-03-04 Thread Victor M.
Factor crash when I add a breakpoint inside a quot inside another quot. Steps: 3 3 [ over [ over 2array . ] each drop ] each drop ctrl+w second button over 2array and select breakpoint And another question. Is there an easy way to do a double loop? Something like: for i = 0 to 2 do for j = 0 t

[Factor-talk] pattern matching with extra/inverse

2008-03-04 Thread Phil Dawes
Hi Dan, Hi Factor List Last night I was looking for a pattern matching library and found your post on extra/inverse. I just wanted to check that I'm not missing a trick: I want to match 3 elt sequences, but after the match I want the seq as it was (i.e. not destructured). I'm doing the followin

Re: [Factor-talk] pattern matching with extra/inverse

2008-03-04 Thread Phil Dawes
D'oh! dup first3 { { [ _ >fixnum _ >fixnum _ >string ] [ dosomething ] } { [ _ >fixnum _ >string _ >fixnum ] [ dosomething2 ] } } switch Cheers, Phil Phil Dawes wrote: > Hi Dan, Hi Factor List > > Last night I was looking for a pattern matching library and found your > post on extra/inv

Re: [Factor-talk] pattern matching with extra/inverse

2008-03-04 Thread Phil Dawes
Ah - now that's a sweet idea. It never occurred to me to use predicate classes with a builtin superclass. ! RENAME ME : 3match? ( seq quot quot quot -- ? ) 3array [ call ] 2all? ; PREDICATE: array something [ fixnum? ] [ fixnum? ] [ string? ] 3match? ; PREDICATE: array something2 [ fixnum? ] [ s

Re: [Factor-talk] Animation

2008-03-04 Thread Ricardo Boccato Alves
Hi, I am a noob too, starting to play with opengl using the redbook and factor so here is an example of how to make an animation using timers. I couldn't figure out how to do it using . It is probably not the best solution and it flicks (I still don't know how to do double-buffering in factor). H

Re: [Factor-talk] Animation

2008-03-04 Thread Slava Pestov
On 4-Mar-08, at 6:08 AM, Ben Schlingelhof wrote: > I managed to paint a nice square on the screen: > > : display ( -- ) > blue gl-color > { 30 30 } { 100 100 } gl-fill-rect > ; > > : test-window ( -- ) > [ > [ display ] > { 600 600 } over set-slate-dim > "Test" open-window > ]

Re: [Factor-talk] Factor + breakpoint = crash

2008-03-04 Thread Slava Pestov
On 4-Mar-08, at 8:16 AM, Victor M. wrote: > Factor crash when I add a breakpoint inside a quot inside another > quot. Steps: > > 3 3 [ over [ over 2array . ] each drop ] each drop > ctrl+w > second button over 2array and select breakpoint You cannot set a breakpoint on a core word which may it

Re: [Factor-talk] pattern matching with extra/inverse

2008-03-04 Thread Slava Pestov
Hi Phil, Try using multimethods. You'll need to unpack your 3-element sequence first, though. USE: multi-methods GENERIC: foo METHOD: foo { integer string integer } ... ; { 1 "hello" 3 } first3 foo Slava On 4-Mar-08, at 9:29 AM, Phil Dawes wrote: > Hi Dan, Hi Factor List > > Last night I

Re: [Factor-talk] Animation

2008-03-04 Thread Slava Pestov
On 4-Mar-08, at 3:10 PM, Ricardo Boccato Alves wrote: > Hi, > > I am a noob too, starting to play with opengl using the redbook and > factor so here is an example of how to make an animation using timers. > I couldn't figure out how to do it using . It is probably not > the best solution and it f

Re: [Factor-talk] Animation

2008-03-04 Thread Ricardo Boccato Alves
Hi, Thanks for the info! Actually I guess the flicker comes from the resolution I set for the timer and the step I used in the square motion. By playing a little bit with them I get a much smoother movement. Sorry about the missinformation. []s, Ricardo Boccato Alves. On Tue, Mar 4, 2008 at 6:0