2009/4/4 samppi
>
> I don't really want it so much for documentation strings—they're
> already formatted in a standard way [...]
Well, they certainly are formatted in *a* standard way :-), e.g. they have a
"hard-coded" formatted only suitable as-is for 80 columns wide terminals :-)
Indeed, for
2009/4/6 Nathan Kitchen
>
> On Apr 4, 4:16 pm, Stuart Sierra wrote:
> > This can be macro-ized:
> >
> > (defmacro bigstr [& strings]
> > "Concatenates strings at compile time."
> > (apply str strings))
> >
> > user> (macroexpand-1 '(bigstr "This is a really long string "
> >
On Apr 4, 4:16 pm, Stuart Sierra wrote:
> This can be macro-ized:
>
> (defmacro bigstr [& strings]
> "Concatenates strings at compile time."
> (apply str strings))
>
> user> (macroexpand-1 '(bigstr "This is a really long string "
> "that I just felt like using "
Great! The code that uses it would be kind of bulkier than I wanted,
but it's okay. I can at least make my code much more readable without
hurting its runtime performance. Thanks a lot.
On Apr 4, 4:16 pm, Stuart Sierra wrote:
> This can be macro-ized:
>
> (defmacro bigstr [& strings]
> "Concat
This can be macro-ized:
(defmacro bigstr [& strings]
"Concatenates strings at compile time."
(apply str strings))
user> (macroexpand-1 '(bigstr "This is a really long string "
"that I just felt like using "
"in my program."))
"This
Of course–it's good that Clojure does that. :) Along with the fact
that it's intuitive, docstrings are in a standardized style to print
nicely with (doc):
(defn foo
"First line is wrapping around
and is indented by two spaces.
But this is only because (doc) allows for this,
indenting the
Of course, Clojure's treatment of simple multiline literal strings already
handles them intuitively
user=> "a multiline
string"
"a multiline\nstring"
user=>
Java and many other popular languages don't do this.
But I understand that you'd like to have the literal newline ignored.
Joshua
--~--~-
I see—perhaps using (str) would indeed be the best answer. I'll be
doing that for now, but I wonder what Rich Hickey thinks of this.
Indeed, this is a big headache in just about every programming
language I've encountered. I'd rather not have to do this:
(...lots of inde
I'm in favor of auto concatenating multiple string literals at
compilation, but I am strongly opposed to doing any sort of formatting
with them. If you want a new line, you stick a \n in your first
string; if you want a space, you stick it in there as well. This:
"hello"
"world"
should tra
Implementing the multi-line strings with the backslash is simple
enough (see my earlier post; I got the line number wrong, by the way,
it's around 421) but causing them to ignore following whitespace is
probably a bit harder. It seems to me that this is a typical problem
in many programming langu
Ah, I posted the same code twice. I meant to show the "more readable"
versions.
Using backslashes:
(...lots of indented code
(if (= m :auto-detect)
(if (<= detected-indent n)
(r
I don't really want it so much for documentation strings—they're
already formatted in a standard way—than just being able to embed
large literal text in my code without making the code nigh unreadable.
Here's an example:
(...lots of indented code
Hi,
2009/4/4 samppi
>
> I wish I could do this:
>
> (code...
>"Long error string that doesn't fit within 80 characters but is
> descriptive, \
> which is good, right?"
> ...more code...)
>
> (The string above would say, "Long error string that doesn't fit
> within 80 characters but is
This is how java strings work (including their workaround involving
StringBuilder objects), so I guess it's no worse than that. But I
tried adding it, and it seems like this can be implemented by adding a
single case statement to LispReader.java with no other problems.
Something like
case '\n': c
I wish I could do this:
(code...
"Long error string that doesn't fit within 80 characters but is
descriptive, \
which is good, right?"
...more code...)
(The string above would say, "Long error string that doesn't fit
within 80 characters but is descriptive, which is good, right?")
P
15 matches
Mail list logo