[racket-users] Announcing Event-lang
Hi everyone, I would like to announce the initial release of event-lang, an experimental Racket library that simplifies the creation of complex synchronizable events. https://pkgd.racket-lang.org/pkgn/package/event-lang Event-lang provides a primitive expression lifting form, > (pure 123) # some event combinators, > (sync (fmap + (pure 1) (pure 2))) 3 > (sync (app (pure +) (pure 1) (pure 2))) 3 > (sync (bind (pure 1) (pure 2) (λ xs (pure (apply + xs) 3 and a collection of event-friendly alternatives to base Racket forms and functions. > (sync (event-let ([x (pure 1)] [y (pure 2)]) (pure (list x y '(1 2) Composite events make progress by synchronizing constituent events, either concurrently or in a predictable sequence. Synchronization results can be ordered as specified, > (let ([t0 (current-inexact-milliseconds)]) (define (now) (- (current-inexact-milliseconds) t0)) (sync (async-args (pure (cons 1 (now))) (pure (cons 2 (now))) (pure (cons 3 (now)) '(1 . 0.200927734375) '(2 . 0.14990234375) '(3 . 0.178955078125) or as completed. > (let ([t0 (current-inexact-milliseconds)]) (define (now) (- (current-inexact-milliseconds) t0)) (sync (async-set (pure (cons 1 (now))) (pure (cons 2 (now))) (pure (cons 3 (now)) '(2 . 0.0771484375) '(3 . 0.093017578125) '(1 . 0.123046875) The project has three outstanding objectives: 1. Provide a sophisticated lifting form to simplify usage of the provided constructs. The event/event module contains a first approximation. Its construction was tedious and error prone, so I commented out the docs. 2. Provide a full-blown #lang event/racket/base for producing whole modules of events and event constructors from ordinary Racket code in a principled manner. 3. Provide support for static analysis of synchronization behaviors. Event programming in Racket is a curious form of meta-programming, and a few simple compile-time checks could reduce cognitive overhead. This pre-release is a request for feedback in anticipation of a production-ready version 1.0. I would like to round out the base collection and devise a comprehensive testing plan, with a stretch goal of re-introducing the sophisticated lifting form. At the moment, I'm using event-lang daily and adding base constructs as needed. Feel free to do the same or request your favorites. Please take a look and let me know what you think. Eric -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: how to create button to reset vector (tic tac toe game help)
> On May 18, 2018, at 9:16 AM, Adikwrote: > > > > On Friday, May 18, 2018 at 1:00:49 AM UTC+1, Adik wrote: > im trying to create a (start new game) button to refresh the game (clean > board).. attached is the code i have > I have already created a reset button that closes the whole game window but i > just want it to wipe the previous game data and start new game. > > Thankyou in advance. > > > > > > I have recently created a button that gets rid of the values in the game but > it is not playable after that > this is the code i came up with: > (define startnewgamebut (new button% > [parent myFrame] > [label "Start New Game"] > [callback (λ (m j) > (updateState 2 2 0) > (updateState 2 1 0) > (updateState 2 0 0) > (updateState 1 2 0) > (updateState 1 1 0) > (updateState 1 0 0) > (updateState 0 2 0) > (updateState 0 1 0) > (updateState 0 0 0) > (update) > > > )])) > > > any help? I looked at your code and added enough for a reset last night. BUT, I will say your code is so disorganized, it wouldn’t help you if I sent along my result. Question: have you heard of the model-view-control (MVC) pattern/architecture? If not, you must read up on it and separate out the state of the TTT game from the visual representation. Then you need to develop a connection between the two (control). At that point, the reset button will look more or less like this: [callback (lambda (_m _j) (reset-state) (reset-view))] — Matthias -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: how to create button to reset vector (tic tac toe game help)
On Friday, May 18, 2018 at 1:00:49 AM UTC+1, Adik wrote: > > im trying to create a (start new game) button to refresh the game (clean > board).. attached is the code i have > I have already created a reset button that closes the whole game window > but i just want it to wipe the previous game data and start new game. > > Thankyou in advance. > I have recently created a button that gets rid of the values in the game but it is not playable after that this is the code i came up with: (define startnewgamebut (new button% [parent myFrame] [label "Start New Game"] [callback (λ (m j) (updateState 2 2 0) (updateState 2 1 0) (updateState 2 0 0) (updateState 1 2 0) (updateState 1 1 0) (updateState 1 0 0) (updateState 0 2 0) (updateState 0 1 0) (updateState 0 0 0) (update) )])) any help? -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.