Skip to content

Instantly share code, notes, and snippets.

@jbclements
Created March 14, 2013 01:08
Show Gist options
  • Save jbclements/5157987 to your computer and use it in GitHub Desktop.
Save jbclements/5157987 to your computer and use it in GitHub Desktop.
#lang racket
(define lines
(list "hootehutt 23 hoethoet 4"
"abc 9 thuoteh 9"))
(define (maybe-numify s)
(match (regexp-match #px"[0-9]+" s)
[#f s]
[else (string->number s)]))
(for/list ([l lines])
(map maybe-numify (string-split l)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment