Skip to content

Section 3.1 gives confusing prose on define-metafunction vs define-relation #7

@csgordon

Description

@csgordon

I'm following along typing everything, and hit a minor snag.

Section 3.1 gives two alternative definitions of unique and suggests they are equivalent:

(define-metafunction REDEX
      unique : any ... -> boolean
      [(unique any_!_1 ...) #t]
      [(unique _ ...) #f])

There is a kind of short-hand for defining predicates (metafunctions that produce either true or false), called, confusingly enough, define-relation:

(define-relation REDEX
  unique ⊆ any × ...
  [(unique any_!_1 ...)])

The text suggests the two are interchangable, but the define-metafunction form seems to break things. I tried to evaluate the PCF typing judgment using the define-metafunction form of unique, but got the following error:

define-judgment-form: expected judgment form name in: unique

The error goes away if I switch to the define-relation form, and the tutorial code itself uses the relation form in shared.rkt (line 128)

I ran into this on Racket (DrRacket) 6.5, but checked on 6.2.1 as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions