std-mapatom


Synopsis

(std-mapatom <func> <tree>)

Description

STD-MAPATOM is used to map a function to every atom in a tree. It returns the results of the function evocations in the same tree structure. If the tree is a flat list, it returns the same as MAPCAR.

Note

The AutoLISP version so far has a stack problem with too large lists. This function is highly recursive.

Examples

(std-mapatom '1+ '(0 1 (2 (3))))	=> (1 2 (3 (4)))
(std-mapatom (function (lambda (x) (cons 0 x)))
            '(0 1 (2 (3))))
=> ((0 . 0)(0 . 1) ((0 . 2) ((0 . 3))))

Arguments

func: a function or lambda list accepting one argument.

Return Value

A copy of the tree with the function applied to every symbol in the tree.

Side Effects

None.

It may throw an stack overflow error if the recursion stack is exhausted. In plain AutoLISP this may be a maximal lisp length of about 240, dependent of the version.

Module

(std-require 'STDLIST)

Defined in STDLIST

#- SMALL