On Sep 30, 2010, at 10:37 PM, HiHeelHottie wrote:
> (ns test-test.parse
> (:use [clojure.contrib.string :only (split)]))
>
> (defn parse-char [m c]
> (condp = (:state m)
> :degree (cond
> (Character/isDigit c) (assoc m :degree (+ (* (:degree
> m) 10) (Character/digit c 10)))
Everybody, thanks for all your responses. conj to vector feels good
so that's what I'm playing with now. Michael, in answer to your
question, and this may be more detail than you bargained for, I'm
playing around with a little state machine parser. It actually
doesn't do much now, but baby step
Mark Engelberg writes:
> str uses a string builder behind the scenes, so it's efficient this
> way.
If the `str' implementation didn't take the input sequence to be lazy,
it could figure out how long the resulting string needed to be, and
construct the StringBuilder using the single-integer cons
On Thu, Sep 30, 2010 at 04:48, HiHeelHottie wrote:
>
> Is there an idiomatic way to build up a string over different lines of
> code? Or, should one simply use StringBuilder.
>
>
I recently wrote a program that generates complex java enums (as source)
from input data recorded in clojure syntax (
On Wed, Sep 29, 2010 at 9:01 PM, HiHeelHottie wrote:
> Thanks for the response. What if you are appending over different
> lines of code? Would it be slightly more efficient to use one
> StringBuilder or not worth the bother.
I'm trying to think what your code would look like that you'd have
mu
Start with an empty vector, say v.
conj your strings to the vector at the various points in your code, so
at the end v will be something like
["this" "is" "a" "string"]
Then, when you're done, apply str to the vector, i.e., (apply str v) to get
"thisisastring"
str uses a string builder behind the
On Sep 29, 2010, at 11:01 PM, HiHeelHottie wrote:
> What if you are appending over different lines of code?
Could you give an example of what you're trying to do? Mutable strings are
almost never necessary, in my experience.
--
You received this message because you are subscribed to the Google
Thanks for the response. What if you are appending over different
lines of code? Would it be slightly more efficient to use one
StringBuilder or not worth the bother.
On Sep 29, 11:32 pm, Stuart Campbell wrote:
> On 30 September 2010 12:48, HiHeelHottie wrote:
>
>
>
> > Is there an idiomatic
On Sep 29, 2010, at 10:32 PM, Stuart Campbell wrote:
> I would just use (str) - it uses a StringBuilder when given more than one
> argument:
There's also (format), which I find helpful for building more complex strings.
--
You received this message because you are subscribed to the Google
Grou
On 30 September 2010 12:48, HiHeelHottie wrote:
>
> Is there an idiomatic way to build up a string over different lines of
> code? Or, should one simply use StringBuilder.
>
>
I would just use (str) - it uses a StringBuilder when given more than one
argument:
user> (source str)
(defn str
"Wit
Is there an idiomatic way to build up a string over different lines of
code? Or, should one simply use StringBuilder.
--
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
11 matches
Mail list logo