all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Making a list from a list and an array
@ 2022-11-06 16:40 Heime
  0 siblings, 0 replies; only message in thread
From: Heime @ 2022-11-06 16:40 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor


I want to use a list of strings (in descr) to this function so that each element is placed
at the beginning of each list.

Currently 

(listru '("R1" "R2" "R3" "R4" "R5") [3 2 1 1 0]) gives me 

(("xxxxx" "xxxxx" "xxxxx") 
 ("xxxxx" "xxxxx" "") 
 ("xxxxx" "" "") 
 ("xxxxx" "" "") 
 ("" "" ""))

I want to get the following

(("R1" "xxxxx" "xxxxx" "xxxxx") 
 ("R2" "xxxxx" "xxxxx" "") 
 ("R3" "xxxxx" "" "") 
 ("R4" "xxxxx" "" "") 
 ("R5" "" "" ""))

This is the function

(defun listru (descr rekr)
  "DOCSTRING."

  (mapcar
   (lambda (n)
     (append (make-list n "xxxxx")
             (make-list (- 3 n) "")))
   rekr))






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-06 16:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 16:40 Making a list from a list and an array Heime

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.