Converting Command Line String Integers To Integers

I find the bigger concepts in Clojure easier to understand. Using reduce for one, and immutable variables. The little stuff like pulling data in from stdin and assigning it to variables has me spinning. Here’s one to convert input numeric values from stdin:

Thanks to Jan on StackOverflow for this example.


(defn cvt-str-to-int
{
:doc "Converts character command line to integers.
This is highly dependent on what's on the command line"
}
[string]
(map #(Integer/parseInt %)
(split string #" ")))
Advertisements

1 Comment

Filed under Clojure

One response to “Converting Command Line String Integers To Integers

  1. Pingback: Clojure: Links, News And Resources (4) « Angel “Java” Lopez on Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s