Permalink
Browse files

experiment to see if this is how err should work

  • Loading branch information...
1 parent 0eb0b11 commit 89548ead051a32e4f10998d418a533c07267c952 @awwx awwx committed Jun 9, 2011
Showing with 25 additions and 0 deletions.
  1. +7 −0 err.arc
  2. +18 −0 err.t
View
@@ -0,0 +1,7 @@
+(use arc)
+
+(def err-message (message . args)
+ (+ message (if args (+ ": " (intersperse " " (map tostring:write args))))))
+
+(redef err (message . args)
+ (racket-error (apply err-message message args)))
View
18 err.t
@@ -0,0 +1,18 @@
+(use test-by-example)
+
+(example-test (runtime '(err)) #<<.
+
+> (err-message "foo")
+"foo"
+
+> (err-message "foo" 1 2 3)
+"foo: 1 2 3"
+
+> (err-message "foo" '("abc" "def"))
+"foo: (\"abc\" \"def\")"
+
+> (err "foo" 1 2)
+err: foo: 1 2
+
+.
+)

0 comments on commit 89548ea

Please sign in to comment.