From: Miles Bader <miles@gnu.org>
Cc: stephen@xemacs.org, emacs-devel@gnu.org,
xemacs-design@xemacs.org, rms@gnu.org
Subject: Re: Rationale for split-string?
Date: Mon, 21 Apr 2003 19:43:47 -0400 [thread overview]
Message-ID: <20030421234347.GA12507@gnu.org> (raw)
In-Reply-To: <200304212111.h3LLBLK11879@eel.dms.auburn.edu>
On Mon, Apr 21, 2003 at 04:11:21PM -0500, Luc Teirlinck wrote:
> (defun split-string (string &optional separators omit-nulls)
>
> There are two problems with this. First of, all it would break tons
> of existing Emacs code. Secondly, the defaults for SEPARATORS and for
> OMIT-NULLs do not match. Thus, the most routine call of
> (split-string string) would produce nonsensical results in the case of
> leading or trailing whitespace.
Other than the all-defaults case (where _both_ optional arguments are
omitted), I think Stephen's formulation is very natural, in that you usually
want OMIT-NULLS to be t if you're splitting on a non-whitespace string.
I think the problem with the all-defaults case could be solved by having
OMIT-NULLS default to t when SEPARATORS is not specified. This is what awk
does I think (with split), and it's really very natural.
[IOW, at the beginning of the function, put:
(unless separators (setq omit-nulls t))
]
-Miles
--
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde
next prev parent reply other threads:[~2003-04-21 23:43 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-17 9:06 Rationale for split-string? Stephen J. Turnbull
2003-04-17 11:30 ` Stefan Reichör
2003-04-18 1:54 ` Richard Stallman
2003-04-18 2:59 ` Steve Youngs
2003-04-17 17:44 ` Stefan Monnier
2003-04-17 19:32 ` Luc Teirlinck
2003-04-18 11:50 ` Stephen J. Turnbull
2003-04-18 14:17 ` Stefan Monnier
2003-04-19 8:18 ` Stephen J. Turnbull
2003-04-19 13:35 ` Richard Stallman
2003-04-19 4:14 ` Richard Stallman
2003-04-19 8:55 ` Stephen J. Turnbull
2003-04-21 0:59 ` Richard Stallman
2003-04-21 1:55 ` Luc Teirlinck
2003-04-21 10:58 ` Stephen J. Turnbull
2003-04-21 21:11 ` Luc Teirlinck
2003-04-21 23:43 ` Miles Bader [this message]
2003-04-22 3:26 ` Luc Teirlinck
2003-04-22 4:09 ` Jerry James
2003-04-22 8:15 ` Eli Zaretskii
2003-04-22 13:22 ` Stephen J. Turnbull
2003-04-22 14:38 ` Jerry James
2003-04-22 12:56 ` Luc Teirlinck
2003-04-22 14:56 ` Jerry James
2003-04-22 15:27 ` Luc Teirlinck
2003-04-22 13:19 ` Stephen J. Turnbull
2003-04-22 13:39 ` Miles Bader
2003-04-22 13:51 ` Luc Teirlinck
2003-04-22 16:26 ` Luc Teirlinck
2003-04-23 1:00 ` Richard Stallman
2003-04-23 4:09 ` Stephen J. Turnbull
2003-04-24 23:12 ` Richard Stallman
2003-05-20 1:55 ` Stephen J. Turnbull
2003-05-22 15:00 ` Kai Großjohann
-- strict thread matches above, loose matches on Subject: below --
2003-05-20 3:11 Bill Wohler
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030421234347.GA12507@gnu.org \
--to=miles@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=rms@gnu.org \
--cc=stephen@xemacs.org \
--cc=xemacs-design@xemacs.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.