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

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

Re: Define skeleton from alist?


From: Gene
Subject: Re: Define skeleton from alist?
Date: Wed, 13 Jul 2016 14:37:39 -0700 (PDT)
User-agent: G2/1.0

At first blush it seems as you might have an impoverished mental model arising 
from an attitude and/or worldview in which Iteration, state-retention (EG via 
assignment via `setq'), and strings dominate.

Though `dolist' can iterate through a list, `mapcar' and its relatives can also 
access every element of a list.
You can think of `mapcar' as a higher order function analogous to a hand; it 
can hold any number of functions in it's tool-using hand ... even an on-the-fly 
anonymous lambda function.
When mapcar has a list element in it's hand the variants of c___r (with `car' 
and `cdr' qualifying as the simplest cases) can select subelements.

Thus I present the following for your `eval'uation:

(mapcar 'identity fountain-title-page-list)

(mapcar (lambda (elt)(identity elt)) fountain-title-page-list)

(mapcar (lambda (elt)(car elt)) fountain-title-page-list)

(mapcar (lambda (elt)(cdr elt)) fountain-title-page-list)

(mapcar (lambda (elt)(cons (car elt)(cdr elt))) fountain-title-page-list)

I'm hoping that what you learn can be used along with `concat' and 
`skeleton-read' to accomplish your desires.

Cheers!
  Gene


reply via email to

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