A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/CLHS/Body/f_tree_e.htm below:

CLHS: Function TREE-EQUAL

CLHS: Function TREE-EQUAL Function TREE-EQUAL

Syntax:

tree-equal tree-1 tree-2 &key test test-not => generalized-boolean

Arguments and Values:

tree-1---a tree.

tree-2---a tree.

test---a designator for a function of two arguments that returns a generalized boolean.

test-not---a designator for a function of two arguments that returns a generalized boolean.

generalized-boolean---a generalized boolean.

Description:

tree-equal tests whether two trees are of the same shape and have the same leaves. tree-equal returns true if tree-1 and tree-2 are both atoms and satisfy the test, or if they are both conses and the car of tree-1 is tree-equal to the car of tree-2 and the cdr of tree-1 is tree-equal to the cdr of tree-2. Otherwise, tree-equal returns false.

tree-equal recursively compares conses but not any other objects that have components.

The first argument to the :test or :test-not function is tree-1 or a car or cdr of tree-1; the second argument is tree-2 or a car or cdr of tree-2.

Examples:

 (setq tree1 '(1 (1 2))
       tree2 '(1 (1 2))) =>  (1 (1 2))
 (tree-equal tree1 tree2) =>  true
 (eql tree1 tree2) =>  false
 (setq tree1 '('a ('b 'c))
       tree2 '('a ('b 'c))) =>  ('a ('b 'c)) 
=>  ((QUOTE A) ((QUOTE B) (QUOTE C)))
 (tree-equal tree1 tree2 :test 'eq) =>  true

Side Effects: None.

Affected By: None.

Exceptional Situations:

The consequences are undefined if both tree-1 and tree-2 are circular.

See Also:

equal, Section 3.6 (Traversal Rules and Side Effects)

Notes:

The :test-not parameter is deprecated.

The following X3J13 cleanup issues, not part of the specification, apply to this section:
Copyright 1996-2005, LispWorks Ltd. All rights reserved.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4