Created
February 26, 2013 04:06
-
-
Save takikawa/5035794 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #lang racket | |
| ;; a fun implementation of balanced brackets from Rosetta Code | |
| (define (balanced? str) | |
| (with-handlers ([exn:fail? (λ (exn) #f)]) | |
| (define in (open-input-string str) | |
| (let loop ([x (read in)]) | |
| (if (not (eof-object? x)) | |
| (loop (read in)) | |
| #t)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment