unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Noah Lavine <noah.b.lavine@gmail.com>
To: Andy Wingo <wingo@pobox.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>,
	"Thien-Thi Nguyen" <ttn@gnuvola.org>,
	guile-devel@gnu.org
Subject: Re: Do you recognize these modules?
Date: Wed, 11 Jul 2012 11:20:07 -0400	[thread overview]
Message-ID: <CA+U71=M987ttSfYmZgWRVrUuynZ0ZbhfCfFPKUW1rh6ETmz6vQ@mail.gmail.com> (raw)
In-Reply-To: <87sjcypoet.fsf@pobox.com>

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Ooops, I think those errors are because I forgot to commit my changes
to guile.texi for patches 3 and 4. Here are updated versions. (I
believe the second patch from earlier should work.)

I will make another patch to clean out the @twerpcommentary lines.

Noah

On Wed, Jul 11, 2012 at 6:44 AM, Andy Wingo <wingo@pobox.com> wrote:
> On Wed 11 Jul 2012 05:02, Noah Lavine <noah.b.lavine@gmail.com> writes:
>
>> I'm sorry to miss 2.0.6 by only a few days, but I have turned this
>> documentation into some patches. Here they are; I think they are ready
>> to apply to stable-2.0.
>
> Cool.  I applied the first one.  When applying the rest, I got:
>
>     /home/wingo/src/guile/doc/ref//lineio.texi:12: Prev reference to nonexistent node `Double-Key Hash Tables' (perhaps incorrect sectioning?).
>     /home/wingo/src/guile/doc/ref//hcons.texi:12: `Eq? Hash Consing' has no Up field (perhaps incorrect sectioning?).
>     /home/wingo/src/guile/doc/ref//gap-buffer.texi:12: Next reference to nonexistent node `Double-Key Hash Tables' (perhaps incorrect sectioning?).
>     /home/wingo/src/guile/doc/ref//guile.texi:375: Menu reference to nonexistent node `Double-Key Hash Tables' (perhaps incorrect sectioning?).
>     /home/wingo/src/guile/doc/ref//hcons.texi:12: warning: unreferenced node `Eq? Hash Consing'.
>     makeinfo: Removing output file `guile.info' due to errors; use --force to preserve.
>     make[4]: *** [guile.info] Error 1
>
> As Thien-Thi suggests, it's probably good to filter out the
> @twerpcommentary etcetera in your next patches.
>
> Cheers,
>
> Andy
> --
> http://wingolog.org/

[-- Attachment #2: 0001-Documentation-style-change.patch --]
[-- Type: application/octet-stream, Size: 2076 bytes --]

From 98344e7d0abe8fb5ebf12e25ee9b6736ba39e385 Mon Sep 17 00:00:00 2001
From: Noah Lavine <noah.b.lavine@gmail.com>
Date: Tue, 10 Jul 2012 21:01:25 -0400
Subject: [PATCH 1/2] Documentation style change

 * doc/ref/hcons.texi: change section name.
 * doc/ref/guile.texi: update menu.
---
 doc/ref/guile.texi |    2 +-
 doc/ref/hcons.texi |   21 ++++++++-------------
 2 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index ccb522f..dff6886 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -372,7 +372,7 @@ available through both Scheme and C interfaces.
 * Conventional Calling::        Calling procedures with conventional interfaces.
 * Common List Operations::      List procedures from Common Lisp.
 * Gap Buffer::                  Strings with fast insertion/deletion.
-* Double-Key Hash Tables::      Two-way maps.
+* Eq? Hash Consing::            Hash tables whose keys are pairs.
 * Buffered Line IO::            Like @code{read-line}, but buffered.
 * Bindings Browsing::           Browsing the module hierarchy.
 * New Hash Mappings::           New hash mappings.
diff --git a/doc/ref/hcons.texi b/doc/ref/hcons.texi
index 1fc3613..273a871 100644
--- a/doc/ref/hcons.texi
+++ b/doc/ref/hcons.texi
@@ -9,24 +9,19 @@
 @c copy of the license is included in the section entitled ``GNU Free
 @c Documentation License.''
 
-@node Double-Key Hash Tables
-@section Double-Key Hash Tables
-
-To use double-key hash tables, evaluate the form:
-
-@smalllisp
-(use-modules (ice-9 hcons))
-@end smalllisp
-
-@c @twerpcommentary (verbatim (ice-9 hcons))
-@c @verbatim
-Eq? hash-consing
+@node Eq? Hash Consing
+@section Eq? Hash Consing
 
 A hash conser maintains a private universe of pairs s.t. if
 two cons calls pass eq? arguments, the pairs returned are eq?.
 
 A hash conser does not contribute life to the pairs it returns.
-@c @end verbatim
+
+To use eq?-hash consers, evaluate
+
+@smalllisp
+(use-modules (ice-9 hcons))
+@end smalllisp
 
 @c @twerpdoc (hashq-cons-hash)
 @c ../../ice-9/hcons.doc
-- 
1.7.6


[-- Attachment #3: 0002-Document-ice-9-string-fun.patch --]
[-- Type: application/octet-stream, Size: 6417 bytes --]

From 357d5bb9941997e34cb26f50a3b3fdde484e5802 Mon Sep 17 00:00:00 2001
From: Noah Lavine <noah.b.lavine@gmail.com>
Date: Tue, 10 Jul 2012 21:02:15 -0400
Subject: [PATCH 2/2] Document (ice-9 string-fun)

 * doc/ref/string-fun.texi: add documentation.
 * doc/ref/Makefile.am: update Makefile.
 * doc/ref/guile.texi: update menu.

 Based on documentation contributed by Thien-Thi Nguyen.
---
 doc/ref/Makefile.am     |    1 +
 doc/ref/guile.texi      |    2 +
 doc/ref/string-fun.texi |  139 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 142 insertions(+), 0 deletions(-)
 create mode 100644 doc/ref/string-fun.texi

diff --git a/doc/ref/Makefile.am b/doc/ref/Makefile.am
index f86a831..5524ab6 100644
--- a/doc/ref/Makefile.am
+++ b/doc/ref/Makefile.am
@@ -71,6 +71,7 @@ guile_TEXINFOS = preface.texi			\
 		 poe.texi			\
 		 popen.texi			\
 		 runq.texi			\
+		 string-fun.texi		\
 		 session.texi			\
 		 stack-catch.texi		\
 		 threads.texi			\
diff --git a/doc/ref/guile.texi b/doc/ref/guile.texi
index dff6886..92453f3 100644
--- a/doc/ref/guile.texi
+++ b/doc/ref/guile.texi
@@ -379,6 +379,7 @@ available through both Scheme and C interfaces.
 * Memoization::                 Procedures that remember their outputs.
 * Alternate Pipes::             Another interface to pipes.
 * Run Queues::                  For parallel execution.
+* String Utilities::            Searching and splitting strings.
 * Preloaded Modules for Interactive Sessions::
 * Lazy Catch::                  Catch without unwinding.
 * Higher level thread procedures::
@@ -409,6 +410,7 @@ available through both Scheme and C interfaces.
 @include poe.texi
 @include popen.texi
 @include runq.texi
+@include string-fun.texi
 @include session.texi
 @include stack-catch.texi
 @include threads.texi
diff --git a/doc/ref/string-fun.texi b/doc/ref/string-fun.texi
new file mode 100644
index 0000000..9a70738
--- /dev/null
+++ b/doc/ref/string-fun.texi
@@ -0,0 +1,139 @@
+@c string-fun.texi
+
+@c Copyright (C) 2012 Free Software Foundation, Inc.
+@c
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
+@c copy of the license is included in the section entitled ``GNU Free
+@c Documentation License.''
+
+@node String Utilities
+@section String Utilities
+@cindex string utilities
+@cindex strings
+
+Guile provides a convenient set of procedures that take advantage of the
+shared substring capability.  These are available by evaluating:
+
+@lisp
+(use-modules (ice-9 string-fun))
+@end lisp
+
+@c @twerpcommentary (verbatim (ice-9 string-fun))
+
+This module provides the following procedures:
+
+@verbatim
+ (split-after-char char str ret)
+ (split-before-char char str ret)
+ (split-discarding-char char str ret)
+ (split-after-char-last char str ret)
+ (split-before-char-last char str ret)
+ (split-discarding-char-last char str ret)
+ (split-before-predicate pred str ret)
+ (split-after-predicate pred str ret)
+ (split-discarding-predicate pred str ret)
+ (separate-fields-discarding-char ch str ret)
+ (separate-fields-after-char ch str ret)
+ (separate-fields-before-char ch str ret)
+ ((string-prefix-predicate pred?) prefix str)
+ (string-prefix=? prefix str)
+ (sans-surrounding-whitespace s)
+ (sans-trailing-whitespace s)
+ (sans-leading-whitespace s)
+ (sans-final-newline str)
+ (has-trailing-newline? str)
+@end verbatim
+
+@subsection Dividing Strings Into Fields
+
+The names of these functions are very regular.
+Here is a grammar of a call to one of these:
+
+@verbatim
+  <string-function-invocation>
+  := (<action>-<seperator-disposition>-<seperator-determination>
+               <seperator-param> <str> <ret>)
+
+<str>    = the string
+
+<ret>    = The continuation.  String functions generally return
+           multiple values by passing them to this procedure.
+
+<action> =    split
+            | separate-fields
+
+ "split" means to divide a string into two parts.
+ <ret> will be called with two arguments.
+
+ "separate-fields" means to divide a string into as many parts as
+ possible.  <ret> will be called with however many fields are found.
+
+<seperator-disposition> =      before
+                             | after
+                             | discarding
+
+ "before" means to leave the seperator attached to
+ the beginning of the field to its right.
+
+ "after" means to leave the seperator attached to
+ the end of the field to its left.
+
+ "discarding" means to discard seperators.
+
+ Other dispositions might be handy.  For example, "isolate"
+ could mean to treat the separator as a field unto itself.
+
+<seperator-determination> =    char
+                             | predicate
+
+ "char" means to use a particular character as field seperator.
+ "predicate" means to check each character using a particular predicate.
+
+ Other determinations might be handy.  For example, "character-set-member".
+
+<seperator-param> = A parameter that completes the meaning of the
+                    determinations.  For example, if the determination
+                    is "char", then this parameter says which character.
+                    If it is "predicate", the parameter is the predicate.
+
+For example:
+
+ (separate-fields-discarding-char #\, "foo, bar, baz, , bat" list)
+ => ("foo" " bar" " baz" " " " bat")
+
+ (split-after-char #\- 'an-example-of-split list)
+ => ("an-" "example-of-split")
+@end verbatim
+
+As an alternative to using a determination "predicate", or to trying to
+do anything complicated with these functions, consider using regular
+expressions.
+
+
+@subsection String Prefix Predicates
+
+Very simple:
+
+@lisp
+(define-public ((string-prefix-predicate pred?) prefix str)
+ (and (<= (string-length prefix) (string-length str))
+       (pred? prefix (make-shared-substring str 0 (string-length prefix)))))
+
+(define-public string-prefix=? (string-prefix-predicate string=?))
+@end lisp
+
+@subsection Strippers
+
+@verbatim
+<stripper> = sans-<removable-part>
+
+<removable-part> =     surrounding-whitespace
+                     | trailing-whitespace
+                     | leading-whitespace
+                     | final-newline
+@end verbatim
+
+@c string-fun.texi ends here
-- 
1.7.6


  reply	other threads:[~2012-07-11 15:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 22:26 Do you recognize these modules? Noah Lavine
2012-05-01 23:22 ` Thien-Thi Nguyen
2012-05-02 15:26   ` Noah Lavine
2012-05-14  8:04     ` Thien-Thi Nguyen
2012-05-14 10:52       ` Noah Lavine
2012-05-14 12:59         ` David Kastrup
2012-05-14 13:59           ` Noah Lavine
2012-05-14 14:12             ` David Kastrup
2012-05-14 12:44       ` Ludovic Courtès
2012-05-14 17:00         ` Thien-Thi Nguyen
2012-05-14 17:30           ` Noah Lavine
2012-05-15 20:14           ` Andy Wingo
2012-05-25  8:53             ` Thien-Thi Nguyen
2012-05-25 12:48               ` Andy Wingo
2012-05-25 17:02                 ` Thien-Thi Nguyen
2012-07-11  3:02                   ` Noah Lavine
2012-07-11  7:21                     ` Thien-Thi Nguyen
2012-07-11 10:44                     ` Andy Wingo
2012-07-11 15:20                       ` Noah Lavine [this message]
2012-07-11 17:59                         ` Noah Lavine
2012-08-25 22:27                           ` Noah Lavine
2012-08-26 20:47                             ` Ludovic Courtès
2013-03-23 10:36             ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+U71=M987ttSfYmZgWRVrUuynZ0ZbhfCfFPKUW1rh6ETmz6vQ@mail.gmail.com' \
    --to=noah.b.lavine@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=ttn@gnuvola.org \
    --cc=wingo@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).