[racket] Whats the difference between a predicate and a flat contract?
On Tue, Dec 4, 2012 at 7:28 PM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> On Tue, Dec 4, 2012 at 7:49 PM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
>>
>> Flat contracts includes more things than contracts. For example:
>>
>> [robby at yanpu] ~/git/plt/collects/scribblings/reference$ racket
>> Welcome to Racket v5.3.1.9.
>> > (flat-contract? 'x)
>> #t
>> > (procedure? 'x)
>> #f
>>
>> The flat-contract function is a holdover from the days when flat contracts
>> weren't able to be used directly as predicate functions.
>>
>>
>> I'll push a clarification to the docs for flat-contract.
>
>
> Isn't that the wrong way around? The flat-contract function lets you use a
> predicate as a contract, not a contract as a predicate. Presumably it's
> from before predicates could be used as contracts, although I hadn't
> realized there was such a time.
There was a time when you had to call 'flat-contract' to turn a
predicate into a contract, yep. There was a housecleaning (anyone
remember the days when there were multiple suffixes (not just "/c") on
the combinators?) and I probably should have gotten rid of it at that
time, but I didn't.
(Oh and I mean "contracts" where I wrote "preducate functions" above. Oops.)
Robby