unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Passing two sequences to  make a list of lists
@ 2022-11-08  6:22 Heime
  2022-11-08  6:40 ` Emanuel Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Heime @ 2022-11-08  6:22 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor



I have constructed the following to make a lists of lists.  The purpose
is to have a list DESCR of N string elements; and an associated array SELECTR,
also of N elements but composed of integers.

The output would be a list of lists.  Each internal list would represent
a row in a table.  The separate rows (each a list) are then put in a list.

Each element of DESCR would be used as the first element of each 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 list, call it M.

Thus for DESCR being '("Peter" "Paul"); and SELECTR being [3 2]; and M being 5; one
would get

'(("Peter" "xxxxx" "xxxxx" "xxxxx" "")  ; list of M of 5 elements
  (Paul"   "xxxxx" "xxxxx" "" ""))      ; number of "xxxxx" blacks being 2


This is the function I have been playing with


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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing two sequences to  make a list of lists
  2022-11-08  6:22 Passing two sequences to make a list of lists Heime
@ 2022-11-08  6:40 ` Emanuel Berg
  2022-11-08 13:37   ` Heime
  0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2022-11-08  6:40 UTC (permalink / raw)
  To: help-gnu-emacs

Heime wrote:

> This is the function I have been playing with
>
>   (seq-mapn
>      (lambda (x y)
>        (list x (mapconcat
> 		  (lambda (s)
> 		    (prog1
> 			(if (> y 0) (append (make-list s "xxxxx")) "")
>                       (setq y (1- y))))
>                   "")
>              " "))
>      descr
>      selectr)

Hm ... maybe you should add some set functions or
anonymous functions?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Passing two sequences to  make a list of lists
  2022-11-08  6:40 ` Emanuel Berg
@ 2022-11-08 13:37   ` Heime
  0 siblings, 0 replies; 3+ messages in thread
From: Heime @ 2022-11-08 13:37 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs

------- Original Message -------
On Tuesday, November 8th, 2022 at 6:40 AM, Emanuel Berg <incal@dataswamp.org> wrote:


> Heime wrote:
> 
> > This is the function I have been playing with
> > 
> > (seq-mapn
> > (lambda (x y)
> > (list x (mapconcat
> > (lambda (s)
> > (prog1
> > (if (> y 0) (append (make-list s "xxxxx")) "")
> > (setq y (1- y))))
> > "")
> > " "))
> > descr
> > selectr)
> 
> 
> Hm ... maybe you should add some set functions or
> anonymous functions?

Do you understand my difficulty?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-08 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  6:22 Passing two sequences to make a list of lists Heime
2022-11-08  6:40 ` Emanuel Berg
2022-11-08 13:37   ` Heime

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).