Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

mapcon

mapcon

type: defined macro (closure)
location: extension
source file: init.lsp
Common LISP compatible: yes
supported on: all machines

SYNTAX

(mapcon <function> <list1> [ <list2> ... ] )
        <function>      -       a function definition (like a LAMBDA) 
                                or a function name
        <listN>         -       a list or list expression

DESCRIPTION

MAPCON applies the <function> to the successive CDRs of each of the lists <listN>. Each of the lists supplies one of the arguments to <function>. The MAPCON macro is similar to the MAPLIST function, except that MAPCON returns a list that is constructed via the destructive NCONC function from the results of the <function> applications. If the lists are of different lengths, the shortest list will determine the number of applications of <function>.

EXAMPLES

(maplist 'list '(a b))                  ; returns (((A B)) ((B)))
(mapcon  'list '(a b))                  ; returns ((A B) (B))

NOTE: Remember that MAPCON uses NCONC and so it destructively deals with its list arguments.

NOTE: The use of the <function> will work properly when it is a quoted symbol (which is the name of the function), an unquoted symbol (whose value is a function) or a closure object (like a LAMBDA).

NOTE: The macros MAPCAN and MAPCON are created in the INIT.LSP file. If they do not exist in your XLISP system, you might be having a problem with INIT.LSP. Before you start XLISP, look in the directory you are currently in, and check to see if there is an INIT.LSP.


Go to the first, previous, next, last section, table of contents.