Added new implementation of contract structure properties. Contracts are now
based on prop:contract, and flat contracts are based on prop:flat-contract. The
flat contract property inherits prop:contract (flat contracts are contracts) and
prop:procedure (flat contracts are predicates).
A value is now a contract if it has prop:contract, or if it is a flat contract.
A value is now a flat contract if it has prop:flat-contract, or if it is a
procedure of one argument (assumed to be a predicate), or if it is one of the
constants allowed as a flat contract (e.g. booleans, numbers, strings, symbols,
regular expressions).
The old custom contract systems (proj-prop and friends, make-proj-contract and
friends) have been supplanted by the new properties, constructors for the
properties' associated values, and "simple-contract" and "simple-flat-contract"
constructors for one-off contracts. These forms are all documented in the
reference. Documentation of the legacy bindings has been removed, though as
many of them as possible are still exported to give legacy code time to migrate.
This commit includes all the changes to the contract system, plus replacement of
all uses of the legacy bindings (proj-prop, proj-get, make-proj-contract,
several others) in other collections.
svn: r18009
if it's coming from a file -- not when it's a string. In that case, use
`#f' for the name, so other code (specifically, `input->code') will use
'program.
svn: r17987
generator. This will make this:
(generator (yield 1) (yield))
also repeat #<void> when it's done which will be very confusing. Better
just add a note in the docs on (generator (yield 1)) returning no values
when it's done.
Also, remove some of the `case-lambda' optimizations...
svn: r17983
generator. (Also considered making it an error when the generator is
called while it is running, but that doesn't allow (yield (yield X))
fun.)
svn: r17982
For example,
(define g (generator (yield (yield (yield 1)))))
(list (g) (g 2) (g 3) (g 4) (g) (g))
evaluates to '(1 2 3 4 4 4). This is something that Python does (as a
generator.send method), which might be useful for using generators as
co-routines, and it is actually easy to implement since sending values
is exactly what we get when the generator call is actually calling the
saved continuation. So most of the change is dealing with the
technicalities of throwing an error when the generator is called with
some arguments, when that's done after it's terminated (at the stage
where it's repeating the last value for ever).
A few tests added for this.
svn: r17979
return any number of values. They will be collected and used as the
repeat-forever result of calling the generator again.
Note: there's an exception for using no values -- instead of returning
no values forever, use void, since no values can be more surprising, and
it can happen when someone uses something like
(generator (yield 1) (yield 2) (yield 3))
since the result of `yield' is (values). (This will change in a
following commit, but even then it will be popular since people will
usually invoke the generator with no arguments which leads to the zero
values. Could be solved if you use (g (void)) -- but that's awkward, I
think.)
svn: r17978