[cl-faq] [lispfaq commit] r13 - trunk
codesite-noreply@google.com
codesite-noreply at google.com
Thu Mar 8 12:17:40 CST 2007
Author: peter.seibel
Date: Thu Mar 8 10:17:23 2007
New Revision: 13
Modified:
trunk/faq.txt
trunk/lispfaq.txt
Log:
Moving string splitting question from lispfaq to faq.
Modified: trunk/faq.txt
==============================================================================
--- trunk/faq.txt (original)
+++ trunk/faq.txt Thu Mar 8 10:17:23 2007
@@ -511,7 +511,7 @@
** Nomenclature
-*** Why is it called "LET"?
+*** Why is it called LET?
Think of a mathematical proof - "Let x be the distance from origin ..."
@@ -823,6 +823,33 @@
(map-into (make-array 10) #'make-foo)
+
+*** How do I split a string?
+
+There is no function in the language specification for splitting a
+string (or any other sequence) into parts. And since it's not
+particularly hard to implement the particular kind of splitting one
+wants in any given case using some combination of \cl{SUBSEQ},
+\cl{POSITION}, \cl{SEARCH}, and \cl{LOOP} Lispers were left to their
+own devices for quite some time.
+
+However in June/July 2001, a group of Lispers on comp.lang.lisp hashed
+out the specification and implemantion of a defacto standard library,
+SPLIT-SEQUENCE, containing three functions, SPLIT-SEQUENCE,
+SPLIT-SEQUENCE-IF, and SPLIT-SEQUENCE-IF-NOT, that are designed to fit
+well with the standard Common Lisp functions for dealing with
+sequences. In its simplest form it works like this:
+
+ (split-sequence #\\Space "A stitch in time saves nine.")
+
+gives:
+
+ ("A" "stitch" "in" "time" "saves" "nine."), 28
+
+For more details and a download link, consult the specification,
+available from
+\link{\href{http://ww.telent.net/cliki/SPLIT-SEQUENCE}\text{its CLiki
+page}}.
*** Why does (read-from-string "foobar" :start 3) return FOOBAR instead of BAR?
Modified: trunk/lispfaq.txt
==============================================================================
--- trunk/lispfaq.txt (original)
+++ trunk/lispfaq.txt Thu Mar 8 10:17:23 2007
@@ -283,28 +283,6 @@
and appropriate.
-*** How do I split a string?
-
-There is no `right' answer to this question; many lisp programmers
-have rolled their own solution in the past, and others are of the view
-that it should never be necessary, as long as all sequence functions
-are used with consistent :start and :end arguments.
-
-However, a community-based `standard' was developed in June/July 2001
-on \link{\href{news:comp.lang.lisp}\text{comp.lang.lisp}}; known as
-SPLIT-SEQUENCE (formerly PARTITION), it works as follows in its
-simplest form:
-
- (split-sequence #\\Space "A stitch in time saves nine.")
-
-gives
-
- ("A" "stitch" "in" "time" "saves" "nine."), 28
-
-For more details, consult the specification, available from
-\link{\href{http://ww.telent.net/cliki/SPLIT-SEQUENCE}\text{its CLiki
-page}}.
-
*** Why are my structure contents wrong?
Most probably, one of your structure slots is called `p'. The accessor
More information about the cl-faq
mailing list