From: Henrik Motakef <henrik.motakef@web.de>
Subject: Re: Designing interface of a simple elisp function
Date: 12 Oct 2002 18:15:39 +0200 [thread overview]
Message-ID: <87y993eiqc.fsf@pokey.henrik-motakef.de> (raw)
In-Reply-To: b00bb831.0210120739.3ae4248d@posting.google.com
gnuist006@hotmail.com (gnuist006) writes:
> Now this "car" does not apply to a string but to a list. On the other
> hand the arbitary length input applies to string. Does there exist
> string to list function? But even that also seems cheating. What is the
> most elegant way to write such a function so that it is also readible
> in use.
The map-functions work on sequences, not only lists. So, for example
(mapcar 'identity "foo")
returns a list of three characters. An alternative would be
(split-string "foo" "")
which gives a list of one-character strings.
> (b2d '101001) is most desirable
> (b2d "101001") is tolerable if this is the best that can be done
You can convert a symbol to a name with the symbol-name function,
i.e. (symbol-name 'foo) => "foo". Unfortunatly, this will not work
with '101001, because it really is the same as 101001 - numbers are
self-quoting, so for example (eq '0001 1) is t, as is (numberp '1).
You could use '\101001 however, or just accept a number instead of a
symbol or string.
Regards
Henrik
next prev parent reply other threads:[~2002-10-12 16:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-12 15:39 Designing interface of a simple elisp function gnuist006
2002-10-12 16:15 ` Henrik Motakef [this message]
2002-10-13 0:24 ` Edward O'Connor
2002-10-13 0:06 ` Mario Lang
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/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y993eiqc.fsf@pokey.henrik-motakef.de \
--to=henrik.motakef@web.de \
/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).