[plt-scheme] Re: MrEd - Gui

From: Laurent (Ouaibou at gmail.com)
Date: Mon Oct 1 17:33:13 EDT 2007

Okay ;)

I change my procedure for :

>(define (interactions-show)
>  (begin (if (send toplevel-editor is-shown?)
>             (send editor-vdragable delete-child toplevel-editor)
>             (send editor-vdragable add-child toplevel-editor))))

And now, it's working :)
Thanks a lot.

Laurent,

On 30 sep, 22:36, "Matt Jadud" <jad... at gmail.com> wrote:
> Hi Laurent,
>
> On 9/30/07, Laurent <Ouai... at gmail.com> wrote:
>
> > I understood your last post, but not how to write a contract for a
> > function of zero argument.
>
> > What's a contract ?
>
> Good question. For further reading, see:
>
> http://www.htdp.org/
>
> However, the short version: it tells us what types of information are
> going into your function, and what types of information are going out
> of your function. In languages like Java, the contract of a function
> is fairly explicit:
>
> void some_fun (int x) { ... }
>
> The language tells us that the input to the function is a Java int,
> and the return value is void.
>
> Some people, when working in languages like Scheme, tend to write a
> type statement in a comment above the function definition that says
> what types of information should go in and come out. In PLT Scheme,
> there is even a mechanism for making these part of the execution of
> your program (see "contracts" in the Help Desk). However, as a step,
> you might say a contract on a Scheme function might look like:
>
> ;; CONTRACT
> ;; some-fun : integer -> void
> (define (some-fun ...) ...)
>
> This tells me that the function should only take in integers, and the
> return value is void. Now, when I have a problem like you had, I might
> have a starting point for figuring out where things went wrong...
> since you might argue that your error is a contract violation. That
> is, you were trying to invoke the result of calling a function, but
> the contract did not say that a function was returned by it.
>
> Then again, you might say otherwise. You might just say you made a
> syntax error. Either way, your style is your own, but this is a useful
> tool, I think, for keeping your code clear.
>
> Cheers,
> Matt
> _________________________________________________
>   For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.