سؤال

The manual on standard libraries for Scheme r6rs suggests that if I import the library (rnrs exceptions (6)) I should be able to call (error? val) to check if a given value is an &error type. I want to do this for unit testing. I've added the library to my import header and the code compiles, so I know the import is working fine. But DrRacket still recognizes error? as undefined. Does anyone know what's going on here?

My code:

#!r6rs
(import (rnrs base) (rnrs exceptions (6)))
(error? "hello world")
هل كانت مفيدة؟

المحلول

You need the conditions library:

#!r6rs
(import (rnrs) (rnrs conditions))
(display (error? "hello world"))

yields

=> #f
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top