Re: converting a string into a set

2011-07-18 Thread Sunil S Nandihalli
(set abc) will do it...

On Tue, Jul 19, 2011 at 9:20 AM, Tuba Lambanog tuba.lamba...@gmail.comwrote:

 Hello,
 My apologies for this newbie question. I couldn't find a way to
 convert a string to a set, thus:

 abc = #{a b c}

 Thanks.
 tuba

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Tuba Lambanog
Hi,
(set abc)
gives me #{\a \b \c}.
I'm expecting instead: #{a b c}
But thanks,
Tuba

On Mon, Jul 18, 2011 at 9:50 PM, Tuba Lambanog tuba.lamba...@gmail.comwrote:

 Hello,
 My apologies for this newbie question. I couldn't find a way to
 convert a string to a set, thus:

 abc = #{a b c}

 Thanks.
 tuba

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Sean Corfield
On Mon, Jul 18, 2011 at 9:17 PM, Tuba Lambanog tuba.lamba...@gmail.com wrote:
 (set abc)
 gives me #{\a \b \c}.
 I'm expecting instead: #{a b c}

(set (map abc))

(set (map str Tuba Lambanog))
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: converting a string into a set

2011-07-18 Thread Benjamin Esham
Tuba Lambanog wrote:

 Tuba Lambanog wrote:
 
  Hello, My apologies for this newbie question. I couldn't find a way to
  convert a string to a set, thus:
  
  abc = #{a b c}
 
 (set abc) gives me #{\a \b \c}.  I'm expecting instead: #{a b c}

Hi Tuba,

Are you quite sure that #{\a \b \c} is not what you want? In Clojure's
notation, a backslashed character [more or less] refers to a
single-character string--something akin to the char type from C. Hence \a is
the character a.  On the other hand #{a b c} is a set containing three
Clojure symbols, which is probably not what you want.

(If you want to be using a, b, and c as some kind of identifiers, take a
look at keywords.)

-- 
Benjamin D. Esham  |  bdes...@gmail.com  |  www.bdesham.info
How to Ask Questions the Smart Way, by Eric S. Raymond:
  http://catb.org/~esr/faqs/smart-questions.html

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: converting a string into a set

2011-07-18 Thread Andreas Kostler

On 19/07/2011, at 2:29 PM, Sean Corfield wrote:

 On Mon, Jul 18, 2011 at 9:17 PM, Tuba Lambanog tuba.lamba...@gmail.com 
 wrote:
 (set abc)
 gives me #{\a \b \c}.
 I'm expecting instead: #{a b c}
 
 (set (map abc))
 
 (set (map str Tuba Lambanog))

This will produce #{a b c}

I think 
(set (map #(symbol (str %)) abc))
should do the trick

 -- 
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/
 
 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
]

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: converting a string into a set

2011-07-18 Thread Andreas Kostler
I'm with Benjamin despite my last post...
On 19/07/2011, at 2:31 PM, Benjamin Esham wrote:

 Tuba Lambanog wrote:
 
 Tuba Lambanog wrote:
 
 Hello, My apologies for this newbie question. I couldn't find a way to
 convert a string to a set, thus:
 
 abc = #{a b c}
 
 (set abc) gives me #{\a \b \c}.  I'm expecting instead: #{a b c}
 
 Hi Tuba,
 
 Are you quite sure that #{\a \b \c} is not what you want? In Clojure's
 notation, a backslashed character [more or less] refers to a
 single-character string--something akin to the char type from C. Hence \a is
 the character a.  On the other hand #{a b c} is a set containing three
 Clojure symbols, which is probably not what you want.
 
 (If you want to be using a, b, and c as some kind of identifiers, take a
 look at keywords.)
 
 -- 
 Benjamin D. Esham  |  bdes...@gmail.com  |  www.bdesham.info
 How to Ask Questions the Smart Way, by Eric S. Raymond:
  http://catb.org/~esr/faqs/smart-questions.html
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: converting a string into a set

2011-07-18 Thread Tuba Lambanog
(thank-you Sean A Corfield)

On Mon, Jul 18, 2011 at 10:29 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Mon, Jul 18, 2011 at 9:17 PM, Tuba Lambanog tuba.lamba...@gmail.com
 wrote:
  (set abc)
  gives me #{\a \b \c}.
  I'm expecting instead: #{a b c}

 (set (map abc))

 (set (map str Tuba Lambanog))
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Tuba Lambanog
Hi,
I'm clear on what I want ;) (something new to me), but I'm not clear on how
to get there. I'd like to compare str1 and str2, if at least one of the
letters in str1 is in str2. I'm thinking that if I can convert str1 and str2
to sets, then I can use the set intersection operation. It probably doesn't
matter here if the sets contain characters or symbols?
Tuba

On Mon, Jul 18, 2011 at 10:31 PM, Benjamin Esham bdes...@gmail.com wrote:

 Tuba Lambanog wrote:

  Tuba Lambanog wrote:
 
   Hello, My apologies for this newbie question. I couldn't find a way to
   convert a string to a set, thus:
  
   abc = #{a b c}
 
  (set abc) gives me #{\a \b \c}.  I'm expecting instead: #{a b c}

 Hi Tuba,

 Are you quite sure that #{\a \b \c} is not what you want? In Clojure's
 notation, a backslashed character [more or less] refers to a
 single-character string--something akin to the char type from C. Hence \a
 is
 the character a.  On the other hand #{a b c} is a set containing three
 Clojure symbols, which is probably not what you want.

 (If you want to be using a, b, and c as some kind of identifiers, take a
 look at keywords.)

 --
 Benjamin D. Esham  |  bdes...@gmail.com  |  www.bdesham.info
 How to Ask Questions the Smart Way, by Eric S. Raymond:
  http://catb.org/~esr/faqs/smart-questions.html

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Andreas Kostler
In that case you don't need to convert to a symbol...
(set abc) should be fine...

Using set intersection, something like this is probably what you're looking 
for...
(use 'clojure.set)
(if (empty? (intersection (set abc) (set cde))) false true)) 

I'm sure there's other (better) ways though

On 19/07/2011, at 2:48 PM, Tuba Lambanog wrote:

 Hi,
 I'm clear on what I want ;) (something new to me), but I'm not clear on how 
 to get there. I'd like to compare str1 and str2, if at least one of the 
 letters in str1 is in str2. I'm thinking that if I can convert str1 and str2 
 to sets, then I can use the set intersection operation. It probably doesn't 
 matter here if the sets contain characters or symbols?
 Tuba
 
 On Mon, Jul 18, 2011 at 10:31 PM, Benjamin Esham bdes...@gmail.com wrote:
 Tuba Lambanog wrote:
 
  Tuba Lambanog wrote:
 
   Hello, My apologies for this newbie question. I couldn't find a way to
   convert a string to a set, thus:
  
   abc = #{a b c}
 
  (set abc) gives me #{\a \b \c}.  I'm expecting instead: #{a b c}
 
 Hi Tuba,
 
 Are you quite sure that #{\a \b \c} is not what you want? In Clojure's
 notation, a backslashed character [more or less] refers to a
 single-character string--something akin to the char type from C. Hence \a is
 the character a.  On the other hand #{a b c} is a set containing three
 Clojure symbols, which is probably not what you want.
 
 (If you want to be using a, b, and c as some kind of identifiers, take a
 look at keywords.)
 
 --
 Benjamin D. Esham  |  bdes...@gmail.com  |  www.bdesham.info
 How to Ask Questions the Smart Way, by Eric S. Raymond:
  http://catb.org/~esr/faqs/smart-questions.html
 
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with your 
 first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Sunil S Nandihalli
(some (set str1) str2)

 will give you what you want..
Sunil

On Tue, Jul 19, 2011 at 10:06 AM, Tuba Lambanog tuba.lamba...@gmail.comwrote:

 (thank-you Sean A Corfield)


 On Mon, Jul 18, 2011 at 10:29 PM, Sean Corfield seancorfi...@gmail.comwrote:

 On Mon, Jul 18, 2011 at 9:17 PM, Tuba Lambanog tuba.lamba...@gmail.com
 wrote:
  (set abc)
  gives me #{\a \b \c}.
  I'm expecting instead: #{a b c}

 (set (map abc))

 (set (map str Tuba Lambanog))
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread David Nolen
On Tue, Jul 19, 2011 at 12:48 AM, Tuba Lambanog tuba.lamba...@gmail.comwrote:

 Hi,
 I'm clear on what I want ;) (something new to me), but I'm not clear on how
 to get there. I'd like to compare str1 and str2, if at least one of the
 letters in str1 is in str2. I'm thinking that if I can convert str1 and str2
 to sets, then I can use the set intersection operation. It probably doesn't
 matter here if the sets contain characters or symbols?
 Tuba


Or you could do this:

(some (set str1) (set str2))

David

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: converting a string into a set

2011-07-18 Thread Tuba Lambanog
Wow, that some function is just what I'd expect from Clojure, simple,
straightforward, elegant. How did I miss it?
Thanks all.
Tuba

On Jul 18, 11:00 pm, David Nolen dnolen.li...@gmail.com wrote:
 On Tue, Jul 19, 2011 at 12:48 AM, Tuba Lambanog 
 tuba.lamba...@gmail.comwrote:

  Hi,
  I'm clear on what I want ;) (something new to me), but I'm not clear on how
  to get there. I'd like to compare str1 and str2, if at least one of the
  letters in str1 is in str2. I'm thinking that if I can convert str1 and str2
  to sets, then I can use the set intersection operation. It probably doesn't
  matter here if the sets contain characters or symbols?
  Tuba

 Or you could do this:

 (some (set str1) (set str2))

 David

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en