Thanks , that did the trick. 

Apperent; string/reverse works different from reverse 

One question : what does into do  and does (empty x) means if x is empty or 
do you make a empty copy of x. 

Roelof


Op woensdag 7 oktober 2015 20:07:00 UTC+2 schreef Moe Aboulkheir:
>
> Roelof,
>
> Something like this:
>
> (defn palindrome [x]
>   (if (string? x)
>     (clojure.string/reverse x)
>     (into (empty x) (reverse x))))
>
> Alternatively, you may want to consider explicitly using seq on your 
> inputs when you get them, and using that of the basis of comparison & input 
> to reverse.  If you don't actually care about the concrete sequence type 
> (i.e. you only want sensible equality semantics after reversing something), 
> dropping it as soon as possible may be a better strategy.
>
> Take care,
> Moe
>
> On Wed, Oct 7, 2015 at 6:51 PM, Roelof Wobben <wobben...@gmail.com 
> <javascript:>> wrote:
>
>> Hello, 
>>
>> I try to solve a problem for 4clojure where I have to make a palingdrome 
>> detector.
>>
>> So for trying I did this : 
>>
>> (ns fourclojure.core
>>   (:gen-class))
>>
>>
>> (defn palingdrome [string] 
>>   ( reverse string))
>>
>> (apply str (palingdrome '( 1 2 3) ))  '321'
>> (apply str (palingdrome "Roelof" )) "foleoR"
>>
>> (defn palingdrome2 [string] 
>>   ( reverse string))
>>
>> (palingdrome2 '( 1 2 3) )  ( 3 2 1 ) 
>> (palingdrome2  "Roelof" )  (\f \o \l \e \o \R)
>>
>> So it works for a map or for a string.
>>
>> Is there a way I can make it work for both ? 
>>
>> Roelof
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> 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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to