diff options
| author | mistivia <i@mistivia.com> | 2025-06-30 20:52:29 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-07-01 01:22:00 +0800 |
| commit | e11f5d02afc9130c1398eeb3e2d25cd965bef27e (patch) | |
| tree | db628ad5048e010efcb342269a9358f4f8434529 /docs/primitives.md | |
| parent | 628c76ab4a242294ddf915872e733c317e3fe242 (diff) | |
Update primitives.md
Diffstat (limited to 'docs/primitives.md')
| -rw-r--r-- | docs/primitives.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/primitives.md b/docs/primitives.md index f1c8850..b82fdde 100644 --- a/docs/primitives.md +++ b/docs/primitives.md @@ -21,12 +21,12 @@ that is expected to throw exceptions. Evaluates *form*. If *form* results in an **error signal**, `assert-error` returns `#t`. Otherwise, it throws an error indicating that *form* did not produce an error. This primitive is useful for writing tests that verify if specific code paths correctly raise errors. -```llisp +```lisp (assert-error (error "This is an error.")) - -> #t + ;; -> #t (assert-error (+ 1 2)) - -> Error + ;; -> Error ``` --- @@ -38,17 +38,17 @@ The `try` primitive evaluates the given ***expression***. If the evaluation of * ```lisp (try (throw "Alas!") - (lambda (e) (string-append "Caught exception: " e))) - -> "Caught exception: Alas!" + (lambda (e) (concat "Caught exception: " e))) + ;; -> "Caught exception: Alas!" (try (+ 1 2) - (lambda (e) (string-append "Caught exception: " e))) - -> 3 + (lambda (e) (concat "Caught exception: " e))) + ;; -> 3 (try (+ 1 2) 'not-a-function) - -> Error: try: syntax error, catch is not a function. + ;; -> Error: try: syntax error, catch is not a function. ``` |
