What's the easiest way to parse numbers in clojure?
Posted
by Rob Lachlan
on Stack Overflow
See other posts from Stack Overflow
or by Rob Lachlan
Published on 2010-04-14T18:54:18Z
Indexed on
2010/04/15
17:43 UTC
Read the original article
Hit count: 422
clojure
I've been using java to parse numbers, e.g.
(. Integer parseInt numberString)
Is there a more clojuriffic way that would handle both integers and floats, and return clojure numbers? I'm not especially worried about performance here, I just want to process a bunch of white space delimited numbers in a file and do something with them, in the most straightforward way possible.
So a file might have lines like:
5 10 0.0002
4 12 0.003
And I'd like to be able to transform the lines into vectors of numbers.
© Stack Overflow or respective owner