PasteRack.org
Paste # 24268
2018-01-10 21:17:57

Fork as a new paste.

Paste viewed 27 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 h:meta (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 h:meta (attributes))

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

(a...

extract-tag-content: undefined;

 cannot reference an identifier before its definition

  in module: 'm