On 1/21/11 6:01 AM, Svante Carl v. Erichsen wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi!
I should call it string-conc, conc-string, or conc->string. I should not expect from first sight that either, string+ or string*, would concatenate. From those names, it also would seem surprising that they can take any sequences, not just strings, as arguments.
I see the main merit of creating such a function of reduced generality in that you can pass it around as a simple #'string-conc instead of (lambda (&rest sequences) (apply #'concatenate 'string sequences)).
Best wishes
Svante
Am 21.01.2011 11:20, schrieb Tord Romstad:
On Thu, Jan 20, 2011 at 10:22 PM, karol skocikkarol.skocik@gmail.com wrote:
Some time ago, I tried to communicate on IRC channel about a very, very simple addition: string+, which is obviously a nice, small name for (apply #'concatenate 'string strings).
Pet peeve: string+ is a *small* name, but it is not a *nice* name for string concatenation. Additive notation for string concatenation is extremely ugly and counter-intuitive for anyone who has studied mathematics. It is extremely annoying that C++, JavaScript and a few other languages have adopted this convention. Additive notation is normally used for commutative operations, which string concatenation is not.
There already is a standard notation for string concatenation, from long before the days of computers and programming languages. Mathematically, strings under concatenation is the free monoid (http://en.wikipedia.org/wiki/Monoid) over the set of all available characters. The single binary operation in a non-commutative monoid is nearly always written as multiplication. And even if you don't know anything about abstract algebra, multiplicative notation makes much more sense: After all, even in elementary high school algebra, abc*de equals abcde, but abc+de does not.
Therefore, if you really need a function for string concatenation and want to share it with the world, please name it string*, not string+
Tord
pro mailing list pro@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/pro
Svante Carl v. Erichsen Wentorfer Str. 96 21029 Hamburg
+49-(0)40-34923721 +49-(0)160-6941474 Svante.v.Erichsen@web.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk05Z28ACgkQFZBb0npmKszsaACfakZ+2dcC/DXGkB1sfbiNhEL4 CJEAn23exdW3M6E7LFGIFV539p2r6Tgv =quCk -----END PGP SIGNATURE-----
pro mailing list pro@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/pro
Our utility library calls it "strcat". I think string-concat is probaby better.
Dave Moon established the general ethic on the Lisp machine of using longer, clearer names in general. This may be because we were coming off the PDP-10 ITS system, in which many terms were in all caps and six or fewer characters, which could be fit into one PDP-10 word using "sixbit" encoding, and we were particularly sick of short names. But I don't think it really was because of that. It was more like "computers are powerful now and we write programs for people to read, not to fit into tiny amounts of core".
-- Dan