[racket-dev] Please help me to understand the two lines.
On Mon, May 30, 2011 at 10:07 AM, Yingjian Ma <yingjian.ma1955 at gmail.com> wrote:
>
> The lines are from
> http://pre.racket-lang.org/docs/html/reference/booleans.html
> section 3.1
>
> The lines are:
> (boolean? v) → boolean?
> v : any/c
>
> Question 1
> The result (boolean? v) is a boolean. Why is it not
> (boolean? v) → boolean
> instead of
> (boolean? v) → boolean?
> ?
`boolean?' is a contract, since all predicates are contracts.
`boolean' is not a contract; it's not defined at all.
> Question 2
> If v can be anything, why not just use any instead of using any/c?
The difference between `any' and `any/c' is explained here:
http://docs.racket-lang.org/guide/contract-func.html?q=any#(part._any_and_any_c)
> Question 3
> What does / and c mean?
The convention of ending names with "/c" is a naming convention for
contracts. In Racket, "/" can appear in names just like any other
character, such as "?" or "c".
--
sam th
samth at ccs.neu.edu