File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Clojure and the fly likes Range of values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Clojure
Bookmark "Range of values" Watch "Range of values" New topic

Range of values

Gayathri kopparapu

Joined: Nov 07, 2013
Posts: 11

How can i convert the output of "(range 0 10)" to #{"0" "1" "2" "3" "4" "5" "6" "7" "8" "9"}
Sean Corfield
Ranch Hand

Joined: Feb 09, 2011
Posts: 279

Think about the steps involved: (range 0 10) - which is the same as (range 10) by the way - produces a sequence of numbers; you want to convert each number in the sequence to a string; then you want to convert that result sequence into a set.

Sounds like map and set.

Do you know how to convert a number to a string?

I'm not just giving you the answer because I think you would benefit from going through the steps and figuring it out - and this is a very simple problem so if you don't understand how to solve this, you will be lost when you encounter harder problems.
I agree. Here's the link:
subject: Range of values
It's not a secret anymore!