PasteRack.org
Paste # 11617
2018-01-10 21:24:38

Fork as a new paste.

Paste viewed 52 times.


Embed:

  1. #lang racket
  2. (require (prefix-in h: html))
  3.  
  4. (define (extract-tag-content tag?)
  5.   (define (extract-selected-tag-data element-content)
  6.     (match element-content
  7.       [(struct h:html-full (attributes content)) (apply append (map extract-pcdata content))]
  8.       [(? tag? (struct h:html-element (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 element-content ((struct h:html-full

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

content))) ((? tag? (struct h:html-element (attributes)))

(get-content-if-named attributes)) (...

extract-tag-content: undefined;

 cannot reference an identifier before its definition

  in module: 'm