packages feed

haskeem-0.6.10: guard.scm

; the first 'test', "(begin...)", is only to print out the value of
; the exception that was thrown: that 'test' always returns #f

(define (tryit test)
  (guard
   (err ((begin (write-string "exception is '")
		(display err)
		(write-string "'\n")
		#f) #t)
	((and (string? err) (string=? err "meh"))
	 (write-string "caught 'meh'\n")
	 "I am the 'meh'-catcher")
	((and (string? err) (string=? err "barf"))
	 (write-string "caught 'barf'... yuk!\n")
	 -42)
	((and (string? err) (string=? err "yahoo!"))
	 (write-string "a little excitable today, aren't we...\n")
	 "US$44.6billion")
	((eqv? err '(1 2))
	 (write-string "does not compute\n")
	 "daleks rule! (until their heads blow off)"))
   (raise test)))