Last active
September 7, 2016 02:30
-
-
Save phondanai/407b24d0a42587a5952e54b3530d8b95 to your computer and use it in GitHub Desktop.
Split and count from text input
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 | |
(define c 0) | |
(with-input-from-file "/path/to/file" | |
(thunk | |
(for ([line (in-lines)]) | |
(set! c | |
(+ c | |
(length | |
(string-split line "|||"))))))) | |
(displayln c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment