[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using list with append
From: |
Stephen Berman |
Subject: |
Re: Using list with append |
Date: |
Wed, 09 Nov 2022 18:08:59 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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