I want to construct a list of lists using the function pmchart

(pmchart '("Peter" "John") [3 2] 5)

to produce

'(("Peter" "xxxxx" "xxxxx" "xxxxx" "")
  ("John"  "xxxxx" "xxxxx" ""      ""))

The function takes a list DESCR of N string elements; and an associated array SELECTR, also of N elements but composed of integers.

Each list represents cells in a row of a table. Each element of DESCR is used as the first element of each sub-list. Whilst the corresponding DESCR value would be the number of "xxxxx" blocks in the remaining elements of each list, with the rest being empty strings.

I would also require a numeric value that determines the total number of elements in each sub-list, call it M.

(defun pmchart (descr selectr m)
    (lambda (x y)
       (message "x: %S" x)
       (list y 
                (append (make-list x "xxxxx")
                        (make-list (- m x) ""))
  • 3
    Please try to learn from answers. You already asked a very similar question here. And from that answer, the answer to this question is straightforward. Also, instead of responding to @NickD his request to clarify your question, you are posting an even worse explained question here. Please respond to @NickD about how to associate the selector with the framework first, or explain how the numbers are related to the rows in complt-chart. Although I know what you mean, you should make your question clear first. Commented Nov 6, 2022 at 10:13
  • 1
    See the comments on the answer here. Commented Nov 6, 2022 at 10:15
  • I see. Just been using the same example a lot.
    – Dilna
    Commented Nov 6, 2022 at 10:18
  • This is simpler to avoid all the calls to list symbol-name, featurep, mapconcat, lambda. Se we do not to check for feature. Meaning that "vertico" is just a string, any string.
    – Dilna
    Commented Nov 6, 2022 at 10:22
  • 3
    Does this answer your question? Table according to numeric selector
    – NickD
    Commented Nov 6, 2022 at 16:55

1 Answer 1


Let me 'extract' the answer from the answer here

(mapcar (lambda (n)
          (append (make-list n "xxxxx")
                  (make-list (- 3 n) "")))
        [3 2 2 1 0])

You should come up with how to create the 'chart' you want yourself, as you do not explain how the numbers are associated with the frameworks or 'rows in the chart'.

  • B.t.w. the selectr must be a vector per se? Commented Nov 6, 2022 at 10:50
  • I am getting (void-function map) with your answer. Regarding the vector per se, would you suggest a way to do things better?
    – Dilna
    Commented Nov 6, 2022 at 12:59
  • I could change the array into a list.
    – Dilna
    Commented Nov 6, 2022 at 13:17
  • Ah, I did not realize that map was actually a function in the 'cl-lib' library. But I see that mapcar can be used to map over all kinds of sequences (I thought it could be only used for lists), so I'll just modify the answer to use mapcar. Commented Nov 6, 2022 at 14:24
  • It is all good, except for one small thing. The start of each row has also a string. Perhaps store them in a list and pass that through as well?
    – Dilna
    Commented Nov 6, 2022 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.