From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: list conversion Date: Tue, 06 May 2003 22:09:01 +0200 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1052252123 16289 80.91.224.249 (6 May 2003 20:15:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 6 May 2003 20:15:23 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Tue May 06 22:15:20 2003 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 19D8qO-0004EE-00 for ; Tue, 06 May 2003 22:15:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19D8lp-00022f-07 for gnu-help-gnu-emacs@m.gmane.org; Tue, 06 May 2003 16:10:37 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.telebyte.nl!news.tele.dk!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:9357 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9357 zghuang@bloomberg.net (Z. Huang) writes: > Given a list ("first" "second" "third"). I'd to convert it to a > a new list: > (("" . "first") > ("" . "second") > ("" . "third")) > > The following lisp code was intended for this purpose, but not working. It > looks that I missed some very basic stuff (I rarely code in lisp). Can > anyone point out what is wrong? Thanks in advance. You could do it like this: (defun list-conversion (list) (mapcar (lambda (x) (cons "" x)) list))