Re: New string utilities library ready

2009-08-23 Thread Sean Devlin
Stuart, This is a significant improvement over the original str-utils library, and goes a long way towards making "string processing kick ass in Clojure". I like the fact that you made some design decisions for the library, and did everything you could to stick with them. That makes the library

Re: New string utilities library ready

2009-08-22 Thread Sean Devlin
Okay, I'm not sure what the correct thing do for the entire library is, but I think I've got a convincing argument for some functions. The following functions share a name with core functions butlast contains? drop get partition repeat reverse take These functions should follow their correspon

Re: New string utilities library ready

2009-08-20 Thread Brian Carper
On Aug 19, 2:16 pm, Sean Devlin wrote: > First, I would change the names of functions functions that collide > with core to str-take, str-drop, etc.  It's just as much to type, and > it is safe to use these names.  Also, it would make it easier for Rich > to promote the library to the standard li

Re: New string utilities library ready

2009-08-20 Thread Bradbev
On Aug 20, 8:26 am, Stuart Sierra wrote: > Seems like opinion is pretty evenly divided here.  I'll leave the > library as-is for now, give it some time to see how things play out. > > In the mean time, as a compromise, I've added str-utils2/partial, > which is like clojure.core/partial for functi

Re: New string utilities library ready

2009-08-20 Thread Stuart Sierra
Seems like opinion is pretty evenly divided here. I'll leave the library as-is for now, give it some time to see how things play out. In the mean time, as a compromise, I've added str-utils2/partial, which is like clojure.core/partial for functions that take their primary argument first. (str2/

Re: New string utilities library ready

2009-08-20 Thread Michel Salim
On Wed, 2009-08-19 at 23:29 -0700, Meikel Brandmeyer wrote: > Hi, > > Disclaimer: personal opinion following... > > I'm sorry. I don't get the elegance of point-free style. > > In mathematics f denotes the function, while f(x) denotes the value f > takes over x. This is actually a nice and easy

Re: New string utilities library ready

2009-08-20 Thread Chas Emerick
On Aug 20, 2009, at 2:29 AM, Meikel Brandmeyer wrote: > Hi, > > Disclaimer: personal opinion following... I think that's all we have when it comes to matters of style :-) > I'm sorry. I don't get the elegance of point-free style. > > In mathematics f denotes the function, while f(x) denotes the

Re: New string utilities library ready

2009-08-19 Thread Meikel Brandmeyer
Hi, Disclaimer: personal opinion following... I'm sorry. I don't get the elegance of point-free style. In mathematics f denotes the function, while f(x) denotes the value f takes over x. This is actually a nice and easy to understand notation. But why do I have to clutter my clojure code with `

Re: New string utilities library ready

2009-08-19 Thread John Harrop
On Thu, Aug 20, 2009 at 12:45 AM, samppi wrote: > > For me, I'd like it if the core functions had the "data" as the first > argument, but have a special function—I can't come up with a better > name than "partial-2"—so that (partial-2 function opt1 opt2 opt3) is > equivalent to (fn [data] (functi

Re: New string utilities library ready

2009-08-19 Thread samppi
For me, I'd like it if the core functions had the "data" as the first argument, but have a special function—I can't come up with a better name than "partial-2"—so that (partial-2 function opt1 opt2 opt3) is equivalent to (fn [data] (function data opt1 opt2 opt3)). That way, I could do things like

Re: New string utilities library ready

2009-08-19 Thread Sean Devlin
+1 On Aug 19, 11:02 pm, Stuart Sierra wrote: > On Aug 19, 9:56 pm, CuppoJava wrote: > > > If I were to have my way, I would redefine all the clojure.core > > functions to assume the "data" is the last argument instead of the > > first. (this includes ->) This way they would play nice with both

Re: New string utilities library ready

2009-08-19 Thread Stuart Sierra
On Aug 19, 9:56 pm, CuppoJava wrote: > If I were to have my way, I would redefine all the clojure.core > functions to assume the "data" is the last argument instead of the > first. (this includes ->) This way they would play nice with both > partial and ->. That's a really interesting idea. Wha

Re: New string utilities library ready

2009-08-19 Thread CuppoJava
I'm also looking for a satisfactory answer to this problem. So far I'm slightly in favor of putting the "data" (ie. the sequence/ collection/object ...) first in the argument list and the "parameters" following. This is because there's so many core functions that take a function and arguments an

Re: New string utilities library ready

2009-08-19 Thread Sean Devlin
Hmmm... that's pretty clever. Well done. Well, if we're gonna play golf :) (def & comp) (def p partial) ;;I like this because the amount of white spaces tells me something ;;Almost Pythonesque (map (& (p map (& (p str2/drop 2) (p str2/take 5))) (p str2/split #"\t"))

Re: New string utilities library ready

2009-08-19 Thread Stuart Sierra
On Aug 19, 5:16 pm, Sean Devlin wrote: > However, over time I found this signature did not work well with my > code.  Often I would write something like this > > (map (comp (partial map (comp   #(str2/drop % 2) >                                 #(str2/take % 5))) >                 #(str2/split %

Re: New string utilities library ready

2009-08-19 Thread Stuart Sierra
On Aug 19, 5:16 pm, Sean Devlin wrote: > I suspect I am in the minority with my next concern.  The library > takes the string as the first argument, so that it works well with the > -> macro.  When I originally wrote my string library, I favored this > type of signature too. > > However, over tim

Re: New string utilities library ready

2009-08-19 Thread Stuart Sierra
On Aug 19, 3:09 pm, Howard Lewis Ship wrote: > Have you considered splitting the str-utils2 into two namespaces, one > that can be imported, and another that needs to be required with a > namespace? Hi Howard, Hadn't thought of that, actually. There are 9 conflicts, out of 32 definitions: tak

Re: New string utilities library ready

2009-08-19 Thread Howard Lewis Ship
Have you considered splitting the str-utils2 into two namespaces, one that can be imported, and another that needs to be required with a namespace? On Wed, Aug 19, 2009 at 11:22 AM, Chouser wrote: > > On Wed, Aug 19, 2009 at 1:59 PM, Vagif Verdi wrote: >> >> I'm using str-utils2 for a couple of m

Re: New string utilities library ready

2009-08-19 Thread Dan Larkin
On Aug 19, 2009, at 2:22 PM, Chouser wrote: > I use (require '[clojure.contrib.str-utils2 :as str2]) for > now and would recommend just 'str' if the lib name changes. Except, of course, since there is already a str function, 'str' would be a bad alias. 'strutils' or 'str-utils' sound fine t

Re: New string utilities library ready

2009-08-19 Thread Chouser
On Wed, Aug 19, 2009 at 1:59 PM, Vagif Verdi wrote: > > I'm using str-utils2 for a couple of months now. Do not care about the > old library. Me too. I think it would be helpful to have a recommended namespace alias to help keep different people's code a bit more uniform. I use (require '[cloju

Re: New string utilities library ready

2009-08-19 Thread Vagif Verdi
I'm using str-utils2 for a couple of months now. Do not care about the old library. --~--~-~--~~~---~--~~ 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 t

New string utilities library ready

2009-08-19 Thread Stuart Sierra
Hey folks, clojure.contrib.str-utils is one of the first libs I wrote, and it's showing its age. I decided to try to start fresh, incorporating some ideas discussed on the list. In general, I'm trying to provide an efficient, functional API for string manipulation. My new attempt is creatively