Pierre:

I maintain the cheatsheet, and I put .indexOf and .lastIndexOf on there
since they are probably the most common thing I saw asked about that is in
the Java API but not the Clojure API, for strings.  There are also links to
whole Java classes and their entire API, e.g. for file I/O, for which there
is no Clojure equivalent, since file I/O is a common need.  Clojure is
meant to be a hosted language, not hiding its host platform, but making it
easily callable.

If there are entire Java classes that meet very common needs that aren't
mentioned on the cheatsheet, I would consider adding links to their
documentation pages.  I don't want to fill up the cheatsheet with many
individual Java methods, though.

As for why there are not Clojure equivalents of particular Java API
methods, I think the reasoning might be similar (it has likely been
discussed publicly, but I don't have a link handy) -- don't create a large
number of Clojure functions that do nothing more than what the equivalent
Java APIs do.

Andy


On Sat, Jul 19, 2014 at 3:58 AM, Pierre Masci <mas...@gmail.com> wrote:

> Hi all, just nit picking about Clojure's String API.
>
> I've been comparing it with Java's
> <http://www.tutorialspoint.com/java/java_strings.htm>, and I noticed that
> (not surprisingly) they are very similar.
> There are just 2-3 functions that exist in Java but don't have an
> equivalent in Clojure. I was wondering if they could be worth adding to
> clojure.string :
>
> (.indexOf s "c")   and   (.lastIndexOf "c")
>
> (.startsWith s "danc")   and   (.endsWith s "ing")
>
> (.charAt s 5)
>     same as (get s 5) but expresses a clearer intent. It's less general
> than (get) though as it only applies to Strings, so that might be
> unnecessary sugar.
>
>
>
>
> .indexOf and .lastIndexOf are indicated in the Clojure Cheatsheet
> <http://clojure.org/cheatsheet>, maybe .startsWith and .endsWith also
> deserve to be mentioned there?
>
> I've been wondering why some functions have been ported, like (lower-case)
> for (.toLowerCase), but not the ones mentioned above.
>
> I told you it was nit picking (^c^) Clojure's API is awesome as it is.
>
>  --
> 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.
>

-- 
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