Re: [racket] Understanding contracts

2014-10-04 Thread Matthias Felleisen
You're right in that the error should be shown in context. We'll think about it, and thanks for bring it up -- Matthias On Oct 3, 2014, at 11:00 PM, Alexander McLin wrote: > Making a correction here, my wish error message should say this. > > in: the 1st argument of >(->* >

Re: [racket] Understanding contracts

2014-10-03 Thread Alexander McLin
Making a correction here, my wish error message should say this. * in: the 1st argument of* * (->** *((and/c number? (between/c 0 1)))* *(#:clamp-range boolean?)* *number?)* Because I understand that the phrase *"the range of"* means the last item in the -> form whic

Re: [racket] Understanding contracts

2014-10-03 Thread Alexander McLin
Actually I wasn't quite ready to move on. When I apply (curve 3) where (define curve (cubic-bezier a b) a and b are bezier-control-point? I get the following contract error: --- *(curve 3)* *. . cubic-bezier: contract violat

Re: [racket] Understanding contracts

2014-10-03 Thread Alexander McLin
Good evening Mathias, After studying your program and mine, and running various permutations, I understand where I was going wrong. It appears that while doing manual experimentation I had gotten confused to which module I was actually in the REPL when calling various functions by hand. Also my te

Re: [racket] Understanding contracts

2014-10-02 Thread Matthias Felleisen
If you use this as the program: #lang racket ;; contracts set up boundaries between two regions of a program, say two modules ;; --- ;; the library (provide (contract-out [struct bezi

Re: [racket] Understanding contracts

2014-10-02 Thread Alexander McLin
Spencer, I'm calling cubic-bezier from within a (module+ test (require submod "..")...) form that itself is defined in the file where cubic-bezier is defined. Also I tried from within REPL and requiring the code file. Matthias, I ran your example and it works exactly the way I wanted. The lambda

Re: [racket] Understanding contracts

2014-10-02 Thread Matthias Felleisen
Let's make Spencer's question concrete. Say we have this situation: #lang racket ;; contracts set up boundaries between two regions of a program, say two modules ;; --- ;; the library (module se

Re: [racket] Understanding contracts

2014-10-01 Thread Spencer florence
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

[racket] Understanding contracts

2014-10-01 Thread Alexander McLin
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