Hi,

I am a newbie to clojure.

It's appreciated if you could help me to convert following C code into clojure:

float qTR(char *s1, char *s2)
{
    int    p,pl,q=0,r,s1l=strlen(s1),s2l=strlen(s2);

    for (p=0;p<s1l;p++)
        for (pl=1;pl<=s1l-p;pl++)
            for (r=0;r<s2l-pl+1;r++)
                if (!memcmp(s1+p,s2+r,pl)) q += pl;

    
return((((s1l*q)/(s1l*(s1l+1)*(s1l+2)/6.0))+((s2l*q)/(s2l*(s2l+1)*(s2l+2)/6.0)))/(s1l+s2l));
}

Actually, I have a performance issue O(n^3), so I want to know if I
could use clojure concurrency feature in this case.

Sincerely,
Payam



On 7/19/11, Tuba Lambanog <tuba.lamba...@gmail.com> wrote:
> That works well. Thank you very much!
> Tuba
>
> On Jul 19, 1:47 am, Meikel Brandmeyer <m...@kotka.de> wrote:
>> Hi,
>>
>> how about this: (count (filter (set "abc") "abracadabra"))?
>>
>> Sincerely
>> Meikel
>
> --
> 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

Reply via email to