Skip to content

Predicate types in BSL and BSL+ #257

@bugcounting

Description

@bugcounting

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions