Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Using Lisp Syntax to Express Trees

Lisp syntax is nice for expressing tree structure in linear text. A Lisp expression has the form

  expr = (functionName expr1 expr2 ... exprN)
where functionName names a function (analogous to a procedure or subroutine in other languages), and expr1...exprN are the $ N$ function arguments, each of which is a Lisp expression itself. So, in Lisp, an example three-level tree consisting of one parent, two children, and five grandchildren, could look like
tree = (topNode 
         (leftChild 
           (leftLeftGrandChild leftMiddleGrandChild leftRightGrandChild))
         (rightChild 
           (rightLeftGrandChild rightRightGrandChild)))


Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III
Copyright © 2023-08-16 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA