PasteRack.org
Paste # 84746
2018-01-10 19:50:15

Fork as a new paste.

Paste viewed 41 times.


Embed:

Struct match

  1. #lang racket
  2.  
  3. (struct dot (x y))
  4.  
  5. (define (match-element element value)
  6.   (match value
  7.     [(element (p)) p]))
  8.  
  9. (match-element dot (dot 1))

=>

eval:3:0: match: syntax error in pattern

  in: (element (p))

match-element: undefined;

 cannot reference an identifier before its definition

  in module: 'm