PasteRack.org
Paste # 2651
2016-08-25 07:12:17

Fork as a new paste.

Paste viewed 215 times.


Embed:

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

  1. #lang racket
  2. (require syntax/parse)
  3.  
  4. (syntax-parse #'(#:a #:b #:c)
  5.   [((~or (~once (~and a #:a))
  6.          (~once (~and b #:b))
  7.          (~once (~and #:c
  8.                       (~post (~fail #:when (and (attribute a)
  9.                                                 (attribute b)
  10.                                                 (attribute c)))))))
  11.     ...)
  12.    #t])

=>

eval:2:0: attribute: not bound as a pattern variable

  at: a

  in: (attribute a)