PasteRack.org
Paste # 13666
2018-01-10 21:18:45

Fork as a new paste.

Paste viewed 97 times.


Embed:

Struct match tag

  1. #lang racket
  2. (require (prefix-in h: html))
  3.  
  4. (define (extract-tag-content tag-name)
  5.   (define (extract-selected-tag-data element-content)
  6.     (match content
  7.       [(struct h:html-full (attributes content)) (apply append (map extract-pcdata content))]
  8.       [(struct tag-name (attributes)) (get-content-if-named attributes)]
  9.       [(struct h:html-element (attributes)) null])))
  10.  
  11. (extract-tag-content h:meta)

=>

eval:2:0: begin (possibly implicit): no expression after a

sequence of internal definitions

  in: (begin (define (extract-selected-tag-data

element-content) (match content ((struct h:html-full

(attributes content)) (apply append (map extract-pcdata

content))) ((struct tag-name (attributes))

(get-content-if-named attributes)) ((struct h:html-element

...

extract-tag-content: undefined;

 cannot reference an identifier before its definition

  in module: 'm