I am curious, what data store are you interacting with?
On Wednesday, April 3, 2013 2:01:33 PM UTC+2, Ryan wrote:
>
> Most SQL Database support array types natively
>
>
> If you are using MySQL unfortunately there isn't and the OP (including
> myself) probably needs this because his RDBMS does n
>
> Most SQL Database support array types natively
If you are using MySQL unfortunately there isn't and the OP (including
myself) probably needs this because his RDBMS does not support the array
type.
On Wednesday, April 3, 2013 2:47:45 PM UTC+3, Thomas Heller wrote:
>
> My Question would be
My Question would be: why are you trying to do this? You mentioned you are
working with a database, I assume that means SQL (as almost all NoSQL
Databases support some kind of JSON which doesnt require your
"workarround"). Most SQL Database support array types natively, while
support might be a
> (comma-separated (list "1" "2" "3" "4" "5")) ==> "\"1\", \"2\",
\"3\", \"4\", \"5
> It must work with any data type - ints, strings, other lists, etc.
The OP needs different encoding rules per type (some of which are
unspecified, strings must be quoted, "etc."), and this could possibly be
Not sure if the OP will see this thread because I was the one that dig it
up since I had a similar problem :)
user=> (apply pr-str (interpose \, (list "jim" "jon" "chris")))
> "\"jim\" \\, \"jon\" \\, \"chris\""
I am not sure if that's correct. I think that the final string should look
like th
I'm sorry, I've not followed this discussion - what is wrong with
user=>(apply str (interpose \, (list 1 2 3 4 5)))
"1,2,3,4,5"
the problem is strings where you want to preserve each string...you can
special case that and avoid the (apply str...) bit..
user=> (interpose \, (list "jim" "jon" "c
Using a protocol fn to do the encoding of the values according to the rules
you set per type then using clj.string/join should be quite fast and not so
horrible.
On Thursday, October 28, 2010 2:18:08 AM UTC+2, andrei wrote:
>
> Hi all,
>
> I work with a database and need a function, that will
andrei, can you please share the solution you came up after all?
On Thursday, October 28, 2010 3:04:32 PM UTC+3, andrei wrote:
>
>
> > Are you looking for pr-str?
> >
> > user> (pr-str "foo")
> > "\"foo\""
>
> Yeah, that's exactly what I tried to implement with my `pr-to-str`,
> thank you.
-
andrei, can you please the solution you came up after all?
On Thursday, October 28, 2010 3:04:32 PM UTC+3, andrei wrote:
>
>
> > Are you looking for pr-str?
> >
> > user> (pr-str "foo")
> > "\"foo\""
>
> Yeah, that's exactly what I tried to implement with my `pr-to-str`,
> thank you.
--
--
> Are you looking for pr-str?
>
> user> (pr-str "foo")
> "\"foo\""
Yeah, that's exactly what I tried to implement with my `pr-to-str`,
thank you.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegrou
> Does this help?
>
> user> (use 'clojure.string)
> nil
> user> (join "," (range 10))
> "0,1,2,3,4,5,6,7,8,9"
It still doesn't work for the list of strings. But thanks for
reminding about it.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post
Does this help?
user> (use 'clojure.string)
nil
user> (join "," (range 10))
"0,1,2,3,4,5,6,7,8,9"
-Avram
On Oct 28, 4:22 am, andrei wrote:
> I was seeking `interpose` function, thanks. But it still doesn't work
> for strings - they are not wrapped by "\"\. E.g.
>
> (apply str (interpose ", "
On 28 October 2010 13:22, andrei wrote:
>
> I was seeking `interpose` function, thanks. But it still doesn't work
> for strings - they are not wrapped by "\"\. E.g.
>
> (apply str (interpose ", " (list 1 2 3 4 5))) ==> "1, 2, 3, 4, 5"
>
> and
>
> (apply str (interpose ", " (list "1" "2" "3" "4"
I was seeking `interpose` function, thanks. But it still doesn't work
for strings - they are not wrapped by "\"\. E.g.
(apply str (interpose ", " (list 1 2 3 4 5))) ==> "1, 2, 3, 4, 5"
and
(apply str (interpose ", " (list "1" "2" "3" "4" "5"))) ==> "1, 2, 3,
4, 5"
The problem is that applying
I didn't do any timing, but, I would say the idiomatic way:
(apply str (interpose ", " some-vector))
Chris
On Wed, Oct 27, 2010 at 8:18 PM, andrei wrote:
> Hi all,
>
> I work with a database and need a function, that will convert Clojure
> sequence to a string with a comma-separated element
15 matches
Mail list logo