PasteRack.org
Paste # 17412
2016-08-25 07:11:41

Fork as a new paste.

Paste viewed 88 times.


Embed:

Use of ~post to check other (~or) ... elements

#lang racket
(require syntax/parse)
 
(syntax-parse #'(#:a #:b #:c)
  [((~or (~once (~and a #:a))
         (~once (~and b #:b))
         (~once (~and #:c
                      (~post (~fail #:when (and (attribute a)
                                                (attribute b)
                                                (attribute c)))))))
    ...)
   #t])