From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joseph Brenner Newsgroups: gmane.emacs.help Subject: Re: [ELISP] How do you turn an array of chars into a string? Date: Tue, 03 Aug 2010 13:57:44 -0700 Message-ID: <877hk776t3.fsf@kzsu.stanford.edu> References: <87wrsae07o.fsf@kzsu.stanford.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291854839 24651 80.91.229.12 (9 Dec 2010 00:33:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 00:33:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 01:33:55 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQUSH-0006fK-EX for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 01:33:53 +0100 Original-Received: from localhost ([127.0.0.1]:40791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQUSG-0000iw-NE for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 19:33:52 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.posted.rawbandwidth!news.posted.rawbandwidth.POSTED!not-for-mail Original-NNTP-Posting-Date: Tue, 03 Aug 2010 15:57:32 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:rxc4UifxkWcrFcSi6/04iw5bFak= Original-Lines: 30 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 198.144.208.84 Original-X-Trace: sv3-jRauu5s7v56fo2STwToh9hJEyYQjoMJPRsvHqG1nV7NpEogTZUEKW/taS/8aWgQJBPIqS3x4a0Q0dqn!1DISH7QA39tMji4Lw06ZTOdUTckhIngfjgZbu8sqNi8sSP7vaeFk3KfcBN/R5WuttHrXSeBN57k= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Original-Xref: usenet.stanford.edu gnu.emacs.help:180326 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76303 Archived-At: Stefan Monnier writes: >> What if you want to convert an array-of-chars into a string? > > A string *is* an array of chars. Yes, I've heard that, but: (let ((mah-array [?c ?a ?t]) (mah-string "cat")) (equal mah-array mah-string)) ;; ==> nil (let ((mah-array [?c ?a ?t]) (mah-string "cat")) (string= mah-array mah-string)) ;; Lisp error: (wrong-type-argument stringp [99 97 116]) Though on the other hand: (equal (aref [?c ?a ?t] 2) (aref "cat" 2)) ;; ==> t In any case, it doesn't exactly make sense to me to just say that "a string is an array of chars". I suppose you might say "a string is an array of chars, with a type of 'string'".