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

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

Re: Elisp Reference Manual on inserting tables


From: Heime
Subject: Re: Elisp Reference Manual on inserting tables
Date: Tue, 08 Nov 2022 04:09:33 +0000

------- Original Message -------
On Monday, November 7th, 2022 at 9:12 PM, Michael Heerdegen 
<michael_heerdegen@web.de> wrote:


> Heime heimeborgia@protonmail.com writes:
> 
> > > `cl-mapcar' allows to map over multiple sequences. Alternatively use 
> > > nested` mapcar' calls.
> > 
> > There is also the possibility of using mapcar*
> 
> 
> That's only the old, now obsolete, name of `cl-mapcar'.
> 
> Michael.


Have been focusing on this implementation.  But I have to gen rid of the 
split-string part in mapconcat.  Have found that I can use seq-mapn to 
iterate over two sequences simultaneously.  Then use mapconcat to make the 
string, and use y (from the selectr sequence) as a counter in the function
argument. There exists the convenient "prog1" that makes it possible to 
lower the counter after the "if" form, but return the value of the "if" 
form (the first function in the prog1 body).

(chart-struct '("Peter" "Paul") [3 2])

(defun chart-struct (descr selectr)
  "TODO."

  (seq-mapn
     (lambda (x y)
       (list x (mapconcat
                  (lambda (s)
                    (prog1
                        (if (> y 0) (append (make-list y "xxxxx")))
                      (setq y (1- y))))
                  (split-string "|||" "" t))
             (append (make-list y ""))))
     descr
     selectr))




reply via email to

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