help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: list conversion


From: Jesper Harder
Subject: Re: list conversion
Date: Tue, 06 May 2003 22:09:01 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

address@hidden (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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]