Re: Raw strings

2013-03-18 Thread Marko Topolnik
On Monday, March 18, 2013 8:59:27 PM UTC+1, Andy Fingerhut wrote: > > str is based on the toString() method of java.util.regex.Pattern, so I do > not understand why you say it only works if you build up from parts that > are literal regexes. For example: > > user=> (def r1 (re-pattern "\\sfoo

Re: Raw strings

2013-03-18 Thread Andy Fingerhut
On Mon, Mar 18, 2013 at 12:48 PM, Marko Topolnik wrote: > > On Monday, March 18, 2013 8:37:19 PM UTC+1, Stefan Kamphausen wrote: >> >> >> this works pretty well, at least better than I expected, e.g.: >> >> user=> (def r1 #"(\s.)") >> #'user/r1 >> user=> (def r2 #"([abc])") >> #'user/r2 >> user=

Re: Raw strings

2013-03-18 Thread Marko Topolnik
On Monday, March 18, 2013 8:37:19 PM UTC+1, Stefan Kamphausen wrote: > > > this works pretty well, at least better than I expected, e.g.: > > user=> (def r1 #"(\s.)") > #'user/r1 > user=> (def r2 #"([abc])") > #'user/r2 > user=> (def r3 (re-pattern (str r1 "|" r2))) > #'user/r3 > user=> r3 > #"(

Re: Raw strings

2013-03-18 Thread Stefan Kamphausen
On Monday, March 18, 2013 12:25:07 PM UTC+1, Maik Schünemann wrote: > > http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes > > It would have been nice to still have #" available for this and #// for regexes. That's probably my Perl heritage leaking through, though :) -- --

Re: Raw strings

2013-03-18 Thread Stefan Kamphausen
Hi, On Monday, March 18, 2013 12:50:13 PM UTC+1, Marko Topolnik wrote: > > Dynamic regex building is a standard technique. Unfortunately, once you > leave the regex literal world, you are back to escaping everything. this works pretty well, at least better than I expected, e.g.: user=> (def r

Re: Raw strings

2013-03-18 Thread vemv
I wasn't familiar with dynamic regex building. Sounds like a task that would be best performed separately from normal Clojure reading/evaluation (i.e. using a different file). I don't think dynamic SQL construction would benefit from raw strings. String interpolation is a different story. On M

Re: Raw strings

2013-03-18 Thread vemv
- doc strings with examples could be more human readable (defn ^{:examples '[(with-out-str (clipboard (doc distinct)))] clipboard [x] ...) Just if a mechanism like this were used more widely... we'd get syntax coloring for free, and a facility for programatically querying examples.

Re: Raw strings

2013-03-18 Thread Marko Topolnik
On Monday, March 18, 2013 12:35:31 PM UTC+1, vemv wrote: > Nobody wants to store every regexp in a separate file. >> > > That's because regexes are 'atomic' - you don't place Clojure expressions > in the middle of them. SQL or math are vastly different from that. As for > SQL, it *is* commo

Re: Raw strings

2013-03-18 Thread vemv
> > Nobody wants to store every regexp in a separate file. > That's because regexes are 'atomic' - you don't place Clojure expressions in the middle of them. SQL or math are vastly different from that. As for SQL, it *is* common practice to store them as isolatedly as possible. I have not

Re: Raw strings

2013-03-18 Thread Maik Schünemann
http://dev.clojure.org/display/design/Alternate+string+quote+syntaxes On Mon, Mar 18, 2013 at 11:50 AM, Dave Sann wrote: > I'd welcome the ability to change delimiter. I've found it very useful in > the past to avoid illegible or hard to read strings. > > > On Monday, 18 March 2013 19:57:06 UTC

Re: Raw strings

2013-03-18 Thread Dave Sann
I'd welcome the ability to change delimiter. I've found it very useful in the past to avoid illegible or hard to read strings. On Monday, 18 March 2013 19:57:06 UTC+11, Luc wrote: > > Looks fine to me. If it's an extension to the literal syntax it's also a > narrow scope change. > > The standa

Re: Raw strings

2013-03-18 Thread Softaddicts
Looks fine to me. If it's an extension to the literal syntax it's also a narrow scope change. The standard escape sequences make things harder even for display purposes. We would also benefit from this, we are handling huge amounts of raw text and just for debugging purposes we have to mentally h

Re: Raw strings

2013-03-18 Thread Marko Topolnik
Chas Emerick is also one of those who voiced their desireto see such a feature in Clojure. On Monday, March 18, 2013 8:13:58 AM UTC+1, puzzler wrote: > > On Sun, Mar 17, 2013 at 11:23 PM, Softaddicts > > > wrote: > >> >> Do you h

Re: Raw strings

2013-03-18 Thread Mark Engelberg
On Sun, Mar 17, 2013 at 11:23 PM, Softaddicts wrote: > > I find raw string handling in XML simply ugly :) Agreed. > > Do you have a suggestion on how to represent raw strings ? Something > concrete > we could discuss about ? > > In several languages, they use a sequence of three double-quotes

Re: Raw strings

2013-03-17 Thread Softaddicts
I find raw string handling in XML simply ugly :) Of course I do have a strong opinion about how bad XML turned out from a typesetting tool to an industry wide cancer :) but cdata stuff basically breaks the XML structure. Visually speaking it's a mess, obviously it's relative, XML by itself is n

Re: Raw strings

2013-03-17 Thread Mark Engelberg
On Sun, Mar 17, 2013 at 6:07 PM, vemv wrote: > Reading a raw string stored in a file is already trivial :) > I'm aware that one can store a raw string in a file. But in many instances, this would be absurd. For the kind of rapid interactive development we have in Clojure, we don't necessarily

Re: Raw strings

2013-03-17 Thread vemv
> > Python has a notation for "raw strings" > Python also has multiple inheritance :) what I want to mean is that some features have dubious value, regardless of whether they made it to language X or Y. I'm working on a project right now where the lack of raw strings is > killing me.