The documentation for the match form is missing #9

Closed
opened 5 years ago by sorawee · 2 comments
sorawee commented 5 years ago (Migrated from github.com)

See the subject line.

See the subject line.
mbutterick commented 5 years ago (Migrated from github.com)

True. I don’t know how it works.

True. I don’t know how it works.
AlexKnauth commented 5 years ago (Migrated from github.com)
The @racket[txexpr] form can also be used as a @racket[match] pattern:

@examples[#:eval my-eval
(match (div)
  [(txexpr tag attrs elems)
   (values tag attrs elems)])
(match (div “Hello” (p “World”))
  [(txexpr tag attrs elems)
   (values tag attrs elems)])
(match (div “Hello” (p “World”))
  [(txexpr ‘div attrs1 (list elems1 ... (txexpr ‘p attrs2 elems2)))
   (values attrs1 elems1 attrs2 elems2)])
(match (div ((id “top”)) “Hello” (p “World”))
  [(txexpr ‘div attrs1 (list elems1 ... (txexpr ‘p attrs2 elems2)))
   (values attrs1 elems1 attrs2 elems2)])
]
```racket The @racket[txexpr] form can also be used as a @racket[match] pattern: @examples[#:eval my-eval (match ‘(div) [(txexpr tag attrs elems) (values tag attrs elems)]) (match ‘(div “Hello” (p “World”)) [(txexpr tag attrs elems) (values tag attrs elems)]) (match ‘(div “Hello” (p “World”)) [(txexpr ‘div attrs1 (list elems1 ... (txexpr ‘p attrs2 elems2))) (values attrs1 elems1 attrs2 elems2)]) (match ‘(div ((id “top”)) “Hello” (p “World”)) [(txexpr ‘div attrs1 (list elems1 ... (txexpr ‘p attrs2 elems2))) (values attrs1 elems1 attrs2 elems2)]) ] ```
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/txexpr#9
Loading…
There is no content yet.