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

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

Re: Using list with append


From: Heime
Subject: Re: Using list with append
Date: Wed, 09 Nov 2022 17:19:12 +0000

------- Original Message -------
On Wednesday, November 9th, 2022 at 5:08 PM, Stephen Berman 
<stephen.berman@gmx.net> wrote:


> On Wed, 09 Nov 2022 12:09:04 +0000 Heime heimeborgia@protonmail.com wrote:
> 
> > This function makes a list of lists.
> > 
> > (defun pmchart selectr nc)
> 
> 
> I assume you meant this: (defun pmchart (descr selectr nc)
> 
> > "TODO."
> > 
> > (seq-mapn
> > (lambda (p q)
> > (message "p: %S" p)
> > (list q (append (make-list p "xxxxx")
> > (make-list (- nc 1 p) ""))))
> > selectr
> > descr))
> > 
> > Calling
> > 
> > (pmchart '("Peter" "Paul") [3 2] 5)
> > 
> > gives the list
> > 
> > '(("Peter" ("xxxxx" "xxxxx" "xxxxx" ""))
> > ("Paul" ("xxxxx" "xxxxx" "" "")))
> > 
> > But I want to adapt it to get this
> > 
> > '(("Peter" "xxxxx" "xxxxx" "xxxxx" "")
> > ("Paul" "xxxxx" "xxxxx" "" ""))
> > 
> > Doing the following did not help
> > 
> > (list (append q (make-list p "xxxxx") (make-list (- nc 1 p) ""))))
> 
> 
> You want to append the list of x's to the list containing the name, not
> to the name (which is a sequence of characters, so appending to it would
> make a list beginning with the numerical values of the characters of the
> name):
> 
> (append (list q) (make-list p "xxxxx") (make-list (- nc 1 p) ""))
> 
> Steve Berman

You are absolutely right.  Thank you so very much.




reply via email to

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