racket / racket/redex

define-term in pattern position

Open
#215 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
112
Forks
42
PR merge metrics
No merged PRs in 30d

Description

I usually think of any term being allowed in pattern position and simply acting as "unify with this".

I think of define-term as simply introducing a meta-variable that means literally the term being defined.

However, both of these mental models are broken when combined:

(require redex/reduction-semantics)
(define-language L)
(define-term T true)
> (redex-match? L true (term T))
#t
> (redex-match? L T (term true))
#f
> (define-judgment-form L
    #:mode (eval I O)
    [(eval true true)])
> (judgment-holds (eval T true))
#t
> (judgment-holds (eval T T))
#f

Is there a reason? Could this be supported?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the interaction among define-term, redex-match?, define-judgment-form, and judgment-holds shown in the examples. Determine why the two pattern cases differ and define what supported define-term behavior in pattern position should mean; done requires an agreed behavior for both examples.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.