error takes just a string

svn: r16071
This commit is contained in:
Matthias Felleisen 2009-09-19 17:20:34 +00:00
parent a58389ad20
commit 4ad2d25e1d
2 changed files with 5 additions and 7 deletions

View File

@ -464,7 +464,7 @@
("Misc"
(identity (any -> any)
"to return the argument unchanged")
((beginner-error error) (symbol string -> void) "to signal an error")
((beginner-error error) (string -> void) "to signal an error")
((beginner-struct? struct?) (any -> boolean)
"to determine whether some value is a structure")
((beginner-equal? equal?) (any any -> boolean)

View File

@ -184,15 +184,13 @@ namespace.
(apply append a b x)))
(define-teach beginner error
(lambda (sym str)
(unless (and (symbol? sym)
(string? str))
(lambda (str)
(unless (string? str)
(raise
(make-exn:fail:contract
(format "error: expected a symbol and a string, got ~e and ~e"
sym str)
(format "error: expected a string, got ~e and ~e" str)
(current-continuation-marks))))
(error sym "~a" str)))
(error str)))
(define-teach beginner struct?
(lambda (x)