Anonymous user
Empty string: Difference between revisions
→{{header|TXR}}: Filled in.
(→{{header|TXR}}: Added.) |
(→{{header|TXR}}: Filled in.) |
||
Line 629:
=={{header|TXR}}==
====Pattern Matching====
<lang txr>@(bind a "")</lang>
If <code>a</code> is unbound, a binding is created, containing the empty string.
If <code>a</code> is already bound, <code>bind</code> succeeds if <code>a</code> contains the empty string, and the pattern matching continues at the next directive. Or else a failure occurs, triggering backtracking behavior.
====TXR Lisp====
<lang lisp>@(do (defvar *a* "")
(if (equal *a* "")
(format t "empty string\n"))
(set *a* "nonempty")
(if (zerop (length *a*))
(format t "guess what?\n")))</lang>
=={{header|TUSCRIPT}}==
|