Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for infix dots #35

Open
wilbowma opened this issue Jun 20, 2016 · 2 comments
Open

Support for infix dots #35

wilbowma opened this issue Jun 20, 2016 · 2 comments

Comments

@wilbowma
Copy link

I want to write an infix expression but I can't use {} to make it infix, but neither can I use infix dots:

define-syntaxsyntax-rules (:)
   [(⊢ Γ e : t) (void)]

;; I didn't expect this would work
{Γ ⊢ e2 : t}

;; but this doesn't work either
(Γ . ⊢ . e2 : t)
@AlexKnauth
Copy link
Collaborator

Infix dots would be a good thing to support. I've also wanted to use them for -> contracts.

But for your case, if you define an nfx macro, you can have it recognize and transform it:

#lang sweet-exp racket

define-syntaxsyntax-rules (:)
    [(⊢ Γ e : t) (void)]

define-syntax nfx
  syntax-rules (⊢ :)
    [(nfx Γ ⊢ e : t)
     (⊢ Γ e : t)]

{Γ ⊢ e2 : t}

@wilbowma
Copy link
Author

Oh. Hm. That seems awkward and non-local, but I suppose that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants