{"size": 1063, "ext": "rktl", "max_stars_repo_path": "pkgs/racket-benchmarks/tests/racket/benchmarks/shootout/typed/except.rktl", "max_stars_repo_name": "lkh01/racket", "max_stars_repo_stars_event_min_datetime": "2018-07-05T21:18:24.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-04T14:48:37.000Z", "max_issues_repo_path": "pkgs/racket-benchmarks/tests/racket/benchmarks/shootout/typed/except.rktl", "max_issues_repo_name": "lkh01/racket", "max_issues_repo_issues_event_min_datetime": "2017-05-10T07:33:20.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-19T15:49:46.000Z", "max_forks_repo_path": "pkgs/racket-benchmarks/tests/racket/benchmarks/shootout/typed/except.rktl", "max_forks_repo_name": "lkh01/racket", "max_forks_repo_forks_event_min_datetime": "2016-04-25T11:47:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-05-09T14:52:48.000Z"}
{"max_stars_count": 4, "max_issues_count": 9, "max_forks_count": 3, "avg_line_length": 23.6222222222, "max_line_length": 76, "alphanum_fraction": 0.5418626529}
(: HI Integer)
(define HI 0)
(: LO Integer)
(define LO 0)

(define (hi-excp? x) (eq? x 'Hi_Exception))
(define (lo-excp? x) (eq? x 'Lo_Exception))
(define (true? x) (if (boolean? x) x #t))

(: some_fun (Integer -> Any))
(define (some_fun n)
  (with-handlers
      ([true? (lambda (exn) #f)])
    (hi_fun n)))

(: hi_fun (Integer -> Any))
(define (hi_fun n)
  (with-handlers
      ([hi-excp? (lambda (exn) (set! HI (+ HI 1))) ])
    (lo_fun n)))

(: lo_fun (Integer -> Any))
(define (lo_fun n)
  (with-handlers
      ([lo-excp? (lambda (exn) (set! LO (+ LO 1))) ])
    (blowup n)))

(: blowup (Integer -> Any))
(define (blowup n)
  (if (= 0 (modulo n 2))
      (raise 'Hi_Exception)
      (raise 'Lo_Exception)))

(: main ((Vectorof String) -> Void))
(define (main args)
  (let* ((n (if (= (vector-length args) 1)
                (assert (string->number (vector-ref args 0)) exact-integer?)
                1)))
    (do ((i 0 (+ i 1)))
        ((= i n))
      (some_fun i)))
  (printf "Exceptions: HI=~a / LO=~a\n" HI LO))

(main (current-command-line-arguments))
