Konrad Hinsen writes:
> Then, a module that uses it:
>
>#lang s-exp "my-typed-lang.rkt"
>
>(define-foo x)
After a closer look at the language definition mechanism, I came to the
conclusion that the language here is actually "s-exp", with my module
merely providing the initial bindi
Where are you calling `cubic-bezier` from? If its from the REPL, the module
itself, or a submodule the function won’t have a contract attached. Only code
outside `cubic-bezier`s module will have the version of `cubic-bezier` with a
contract attached.
On Wed, Oct 1, 2014 at 9:46 PM, Alexander Mc
Chris,
It sounds like your mental model of the canvas is that stuff you draw on
it stays there permanently, like paint on a real-world canvas. This is
not how the GUI works. When the GUI canvas is displayed on the screen,
it asks your program (by calling on-paint) to draw the canvas contents
Thanks everyone - amazingly helpful and quick reponses!
crystal clear code - thanks Sean
The MVC analogy is very helpful. I think I have some old Apple SmallTalk
discs lying around!
Cheers
Chris
On 2 October 2014 12:44, Justin Zamora wrote:
> You should learn about Model-View-Controller arch
Hello,
I've been working on a sample project to better understand how to use the
contract system. I created a simple Bezier curve implementation and am
using (provide (contract-out...) to attach contracts to the provided
bindings.
Basically I have a procedure called cubic-bezier that accepts two
You should learn about Model-View-Controller architecture (for example at
http://en.m.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller).
Briefly, the model is a data structure that represents the information you
are working with. The view is able to produce a visual representation of
the m
At the risk of sending duplicate information, and you should prefer
Matthias' responses as he is far more experienced, but one idea is to place
all drawing code under the canvas class definition. Then the button
callback should invoke that class' new drawing method. This keeps the
actual drawing co
Thanks Matthias and Sean
It's often helpful when people asking questions ask them clearly ! :)
I'll now attempt a clarification...
say I have a button in the window, and when that button is pressed, I want
to draw on the canvas - and later, another button is pressed, and I might
want to draw some
Hi,
Just make the drawing code part of on-paint. I have inlined a subclass for
you:
#lang racket/gui
(define frame (new frame%
[label "Example"]
[width 300]
[height 300]))
(define top-canvas (new (class canvas% (super-new [parent frame])
Does this help?
#lang racket/gui
(define frame
(new frame%
[label "Example"]
[width 300]
[height 300]))
(define top-canvas
(new (class canvas%
(inherit get-dc)
(super-new [parent frame])
(define/override (on-paint)
(define dc (get-
I would like to draw on a canvas in a window at various times during
program execution.
My first attempt was to combine two examples:
#lang racket/gui
(define frame (new frame%
[label "Example"]
[width 300]
[height 300]))
(define top-canvas
Oh! Really. Thank you! Sorry, I am not experienced in Racket.
2014-10-02 0:56 GMT+04:00 Matthias Felleisen :
>
> In this context, null is just a variable and it gets bound to what it
> matches:
>
> > Welcome to Racket v6.1.0.8.
> > > (match 'hello-world [null null])
> > 'hello-world
>
>
>
> On O
In this context, null is just a variable and it gets bound to what it matches:
> Welcome to Racket v6.1.0.8.
> > (match 'hello-world [null null])
> 'hello-world
On Oct 1, 2014, at 4:52 PM, Yuri Garmay wrote:
> Hi, all
>
> Accidentally, I found out that null matchs in unexpected way (seems
Hi, all
Accidentally, I found out that null matchs in unexpected way (seems it
matchs always)
So,
(define (length-my list)
(match list
['() 0]
[(cons x xs)
(+ 1
(length-my xs))]
[_ 'not-a-list]))
(length-my '(1 2 3 4))
>produces 4
But
(define (length-my list)
(match
Hello,
Just in case anybody is keeping track of Racket use cases
worldwide: here is a web site written entirely in Racket
http://ephemeris.ipa.nw.ru/
The site is rather simple. It produces astronomical
ephemeris tables for the chosen body of the Solar
System for specified dates.
Racket is cred
Hi everyone,
I'd like to define my own language that produces modules and code
considered "typed", as in Typed Racket. In fact, my language is
just a subset of Typed Racket plus a few new macros.
I started by writing "my-typed-lang.rkt":
#lang typed/racket
(provide define-foo
16 matches
Mail list logo