[plt-scheme] Questions about contracts

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Mon Apr 16 19:16:20 EDT 2007

Let's say the SVN  Revision 3591 of SRFI 63 
(http://svn.plt-scheme.org/view/trunk/collects/srfi/63/63.ss?revision=3591&pathrev=5900).

The contract of make-shared-array is:

   (make-shared-array
    (->r ((array array?)
          (mapper (->* () (listof natural-number/c)
                       ((listof natural-number/c)))))
         indices (listof natural-number/c)
         array?))

which looks fine.

But if you run it:

> (define fred (make-array '#(#f) 8 8))
> (define freds-diagonal
    (make-shared-array fred (lambda (i) (list i i)) 8))
. 6:5: top-level broke the contract
  (->r ((array ...) (mapper ...)) indices ... ...)
on make-shared-array; expected a procedure that accepts 0 arguments and any 
number of arguments larger than 0, given: #<procedure>
>

Chongkai

----- Original Message ----- 
From: "Matthias Felleisen" <matthias at ccs.neu.edu>
To: "Chongkai Zhu" <czhu at cs.utah.edu>
Cc: <plt-scheme at list.cs.brown.edu>
Sent: Monday, April 16, 2007 5:06 PM
Subject: Re: [plt-scheme] Questions about contracts


> Can you provide an example? A statement like this is rather, eh, 
>  strange. -- Matthias
>
>
>
>
> On Apr 16, 2007, at 7:01 PM, Chongkai Zhu wrote:
>
>>
>> ----- Original Message ----- From: "Matthias Felleisen" 
>> <matthias at ccs.neu.edu>
>> To: "Henk Boom" <lunarc.lists at gmail.com>
>> Cc: <plt-scheme at list.cs.brown.edu>
>> Sent: Monday, April 16, 2007 4:55 PM
>> Subject: Re: [plt-scheme] Questions about contracts
>>
>>
>>>  (2) unlike Eiffel's, our contract system copes with higher-order 
>>> functions.
>>
>> Sorry, but I tried our contract system with higher-order functions 
>> recently, and doesn't feel that it works in general cases.
>>
>> Chongkai
>>
>>
>
> 



Posted on the users mailing list.