Skip to content

Instantly share code, notes, and snippets.

@samth
Created June 19, 2014 15:29
Show Gist options
  • Save samth/0a44ac1256d22bd9317c to your computer and use it in GitHub Desktop.
Save samth/0a44ac1256d22bd9317c to your computer and use it in GitHub Desktop.
#lang racket
(define N 100000000)
(define K 50000000)
(time
(for/fold ([c 0]) ([i (in-range N)] #:break (not c))
(if (= i K)
#f
(add1 c))))
(time
(let/ec exit
(for/fold ([c 0]) ([i (in-range N)] #:break (not c))
(if (= i K)
(exit #f)
(add1 c)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment