Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #lang racket
- (require sxml)
- (define url "https://example.com")
- (define anchor-text "demo")
- (define new-item `(li (a (@ (href ,url) (target "_blank")) ,anchor-text)))
- (define (list-template url anchor-text) `(li (a (@ (href ,url) (target "_blank")) ,anchor-text)))
- (define (nested-map-handler f L)
- (if (list? L)
- (map (lambda (x) (nested-map-handler f x))
- L)
- (f L)))
- (define (node-logic node)
- (if (and (list? node) (eq? (car node) 'li))
- (list node new-item)
- node
- ))
- (define template-appended-li (list new-item (list-template "https://fandom.org" "fans universe"))) ; this one is contract error free
- (display (srl:sxml->html (nested-map-handler node-logic new-item))) ; this one is not error free
Advertisement
Add Comment
Please, Sign In to add comment