On 2026-04-03 11:56, Jakub T. Jankiewicz wrote:
> The name `is`, in its current form, is problematic. It doesn't make sense
> semantically. `is` should compare two values not compare if something is
> truthy.
>
> In normal sentence you have:
>
> x is y
>
> so the prefix notation should be:
>
> (is x y)
>
Hi Jakub!
Your idea is very reasonable. Especially for the case with two
arguments. For one argument `is` can be read differently.
(define your-idea "`is` should compare two values")
(is (very-reasonable? your-idea))
(is (string=? your-idea "`is` should assert truthness"))
Try instead of `x is y` pattern use `it is so that ...`.
it is so that your-idea conforms very-reasonable? predicate.
is it so?
There are a few thoughts on the topic:
1. I'm not a native english speaker, but for me such reading make sense.
So, probably is asserting thruthness of its argument can be a valid
option. I may be wrong, but would be glad to hear input
2. It's much shorter. The test looks cleaner and easier to read.
Subjective, of course.
3. assert is an overloaded term and `assert` is very likely provided in
many implementations and in r6rs. `is` is free from assert's "baggage".
4. Clojure is quite succesful in using is as primary assert macro. It's
in built-in clojure.test and used in majority of the projects.
5. Using is as a single argument form is a more powerful construction,
as one can express `x is y` with `is x equal? y`, in Scheme syntax:
(is (equal? x y))
And a few more examples:
(is (throws-exception? (/ a 0)))
(is (prefix? "hell" "hello"))
(is (= 2 (+ 4 4)))
> And the best way to implement `is` is using equal.
>
> (define (is x y)
> (if (not (equal x y))
> (signal "Error")))
>
> in LISP Scheme, I use JavaScript testing framework called AVA. The tests
> looks like this:
>
> (test "core: values without wrapping"
> (lambda (t)
Offtopic:
This is an interesting idea. I have a long standing thought, that at
the moment we can't provide a context from test runner into test itself.
Wrapping the body into lambda with one argument is one of the options to
consider.
One of the use cases is to implement fixtures that can be attached to
test or suite via metadata and provide some values from fixtures into
the test via this argument.
> (t.is (values 1) 1)
> (t.is #void (values))))
>
> t is an object from AVA that have is method. But I use `t.is` macro anyway.
> LIPS Scheme use JavaScript dot notation.
>
> And if `is` must be an assert, like the doc string in example implementation
> says. Then it should be called accordingly.
>
> (assert (= 1 2))
>
> I'm not sure what `assert` in the example implementation is (it's used by
> `is` macro). `assert` is not part of the R7RS.
>
> And if guile-ares-rs wants to use `(is x)` this can be easily abstracted with
> a macro.
>
> (define-library (ares-test)
> (export (rename assert is))
> (import (scheme base)
> (test))
>
> (define-syntax assert
> (syntax-rules ()
> ((_ expr)
> (is expr #t)))))
>
>
Thank you for the message and feedback! :)
--
Best regards,
Andrew Tropin