From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Henrik Motakef Newsgroups: gmane.emacs.help Subject: Re: Designing interface of a simple elisp function Date: 12 Oct 2002 18:15:39 +0200 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <87y993eiqc.fsf@pokey.henrik-motakef.de> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1034439033 25709 127.0.0.1 (12 Oct 2002 16:10:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 12 Oct 2002 16:10:33 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 180OqW-0006gI-00 for ; Sat, 12 Oct 2002 18:10:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 180OmK-0007pb-00; Sat, 12 Oct 2002 12:06:12 -0400 Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 30 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-NNTP-Posting-Host: 213.23.27.216 Original-X-Trace: 12 Oct 2002 18:02:52 +0200, 213.23.27.216 Original-X-Complaints-To: abuse@arcor-ip.de Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-han1.dfn.de!news-fra1.dfn.de!newsfeed.arcor-ip.de!news.arcor-ip.de!213.23.27.216 Original-Xref: shelby.stanford.edu gnu.emacs.help:105977 comp.emacs:75249 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:2524 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:2524 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