Anonymous user
Algebraic data types: Difference between revisions
m
Emacs Lisp: Fix formatting, add more notes on pcase.
(→{{header|jq}}: ce) |
m (Emacs Lisp: Fix formatting, add more notes on pcase.) |
||
Line 576:
=={{header|Emacs Lisp}}==
The <code>pcase</code>
<lang lisp>(defun rbt-balance (tree)
(pcase tree
(`(B (R (R ,a ,x ,b) ,y ,c) ,z ,d) `(R (B ,a ,x ,b) ,y (B ,c ,z ,d)))
Line 606 ⟶ 605:
(dotimes (i 16)
(setq s (rbt-insert (1+ i) s)))
(pp s))</lang>
Output:
|