In the student languages, function predicate allows one to define a
type (signature form) constrained by a predicate that indicates
precisely the values that belong to the type.
(define (nonzero-number? v) (and (number? v) (not (= v 0))))
(define NonZeroNumber (signature (predicate nonzero-number?)))
Even though predicate is defined in all student languages, it cannot
really be used in BSL or BSL+ where functions are not first class.
I'm unsure what's the best way of handling this. Removing predicate
from BSL is not a good idea, given that there are several examples of
data type definitions that are already used with BSL and BSL+ (e.g.,
interval data types in HtDP) but would require predicate to be
defined.
Would making functions first class already in BSL and BSL+ create any
issues?
In the student languages, function
predicateallows one to define atype (signature form) constrained by a predicate that indicates
precisely the values that belong to the type.
Even though
predicateis defined in all student languages, it cannotreally be used in BSL or BSL+ where functions are not first class.
I'm unsure what's the best way of handling this. Removing
predicatefrom BSL is not a good idea, given that there are several examples of
data type definitions that are already used with BSL and BSL+ (e.g.,
interval data types in HtDP) but would require
predicateto bedefined.
Would making functions first class already in BSL and BSL+ create any
issues?