Skip to main contentCal State San Bernardino / [CNS] / [Comp Sci Dept] / [R J Botting] / [CSci320] [Search ]
[Schedule] [Syllabi] [Text] [Labs] [Projects] [Resources] [Grading] [Contact]
Sessions: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
lisp.functions.html (HTML) [lisp.functions.txt(Text)] Tue May 15 20:54:44 PDT 2007

Contents


    LISP functions and Macros

      Macros

      'e::= (quote e). #'e::= (function e).
    1. #(e...)::= an array of the specified expressions. Forms are not strictly functions because they delay eavaluating there arguments: #xhdigits::= a hexadecimal number. #\char::= the ASCII code of the character.

      Forms

    2. definition::="(define" "("sym fargs")" e")"::=Scheme-like definition.
    3. conditional::="(cond" #case")"::=evaluate first case with non-null predicate.
    4. case::= "("pred e #e")".
    5. define_macro::="(defmacro" sym fargs #e")"::=define a macro.
    6. define_funtion::="(defun" sym fargs #e")"::=define a function.
    7. loop::=do_loop.
    8. do_loop::="(do" O("*") "("#binding")" "("texpr #rexpr")" #e")" | "(dolist" "("sym e #rexpr")" #e")" | "("dotimes "("sym e #rexpr")" #e ")".
    9. lambda_expression::="(lambda" args #e")"::=returns an unamed function closure.
    10. block::="(let" "("#(binding")" #e")"::=create local bindings.
    11. local_seq_environment::="(let*" "("#(binding")" #e")"::=sequentially create local bindings.
    12. program::="(prog*" "(" #binding")" #e")" | "(prog1" e1 #e")" | "(prog2" e1 e2 #e ")" | "(progn" #e")".
      FormEffect
      (progn e1 ...)Evaluate expression in sequence and return last value
      (prog* (b1 b2 b3 ...) e1 e2 e2 ...en)execute binding in sequence and then execute expression in sequence, and return value of last one
      (prog (b ...) e1 e2 e2 ...en)execute all bindings and then execute expression in sequence, and return value of last one
      (prog1 e1 ...)Evaluate each expression in turn but return the first value
      (prog2 e1 e2 ...)Evaluate each expression in turn but return the second value
    13. raw_data::="(quote" e ")"::=return an expression unevaluated.

      Functions

        These all have same syntax
      1. (functions_name args...)

        Symbolic:+-*...

      2. *::=multiply a list of numbers.
      3. +::=add a list of numbers.
      4. -::=subtract a list of numbers or negate a single number. /::=divide a list of numbers. /=::=test for not equal to.
      5. 1+::=add one to a number.
      6. 1-::=subtract one from a number.
      7. <::=test for less than.
      8. <=::=test for less than or equal to.
      9. =::=test for equal to.
      10. >::=test for greater than.
      11. >=::=test for greater than or equal to.

        A

      12. abs::=the absolute value of a number.
      13. address-of::=get the address of an xlisp node.
      14. alloc::=change number of nodes to allocate in each segment.
      15. and::=the logical and of a list of expressions(shortcircuited).
      16. append::=append lists, does not play well with atoms.
      17. apply::=apply a function to a list of arguments.
      18. aref::=get the nth element of an array.
      19. assoc::=find an expression in an a-list.
      20. atom::=is this an atom?.

        B

      21. backquote::=fill in a template - Macro arguments prefixed by comma.
      22. baktrace::=print n levels of trace back information.
      23. boundp::=is this a bound symbol?.
      24. break::=enter a break loop.

        C

      25. car::=return the car --first part-- of a list node.
      26. case::=(value [e]...)`.
      27. catch::=evaluate expressions and catch throws.
      28. cdr::=return the cdr -- second part -- of a list node.
      29. cerror::=signal a correctable error.
      30. char::=extract a character from a string.
      31. clean-up::=clean-up after an error.
      32. close::=close a file.
      33. comma::=evaluate argument in a backquoted macro body(?).
      34. comma_at::=evaluate argument in a backquoted macro body and splice.
      35. cond::Forms=A LISP conditional form that tests a series of pairs and selects the first where the first part of the pair evaluates to a non-null value like T. -- see conditional.
      36. cons::=construct a new list node out of two arguments.
      37. consp::=is this a non-empty list?.
      38. continue::=continue from a correctable error.
      39. cos::=compute the cosine of a number.
      40. cxxr::=all cxxr combinations. (cdar x) = (cdr (car x)).
      41. cxxxr::=all cxxxr combinations.
      42. cxxxxr::=all cxxxxr combinations.

        D

      43. define::Forms=The Scheme form that returns a new function -- see definition.
      44. defun::Forms=The XLISP form that returns a new function -- see define_function.
      45. defmac::Forms=The XLISP form that creates new forms! -- see define_macro.
      46. delete::=delete an expression from a list.

        E

      47. eq::=are the expressions identical?.
      48. eql::=are the expressions identical?.
      49. equal::=are the expressions equal?.
      50. error::=signal a non-correctable error.
      51. errset::=trap errors.
      52. eval::=evaluate an xlisp expression.
      53. evalhook::=evaluate with hooks.
      54. evenp::=is this number even?.
      55. exit::=exit xlisp.
      56. exp::=compute e to the e power.
      57. expand::=expand memory by adding segments.
      58. expt::=compute e1 to the e2 power.

        F

      59. flatc::=length of printed representation using princ.
      60. flatsize::=length of printed representation using prin1.
      61. float::=converts an integer to a floating point number.
      62. funcall::=call a function with arguments.
      63. function::=quote a function.

        G

      64. gc::=force garbage collection.
      65. gensym::=generate a symbol.
      66. get::=get the value of a property.
      67. go::=go to a tag within a prog construct.

        H

      68. hash::=compute the hash index for a symbol.
      69. help::=Scan functions.lsp for function named sym.

        I

      70. if::=if texpr then expr1 else expr2.
      71. intern::=make an interned symbol.

        L

      72. last::=return the last list node of a list.
      73. length::=find the length of a list or string.
      74. list::=create a list of values.
      75. listp::=is this a list?.
      76. load::=load an xlisp source file.
      77. logand::=the bitwise and of a list of numbers.
      78. logior::=the bitwise inclusive or of a list of numbers.
      79. lognot::=the bitwise not of a number.
      80. logxor::=the bitwise exclusive or of a list of numbers.

        M

      81. make-array::=make a new array.
      82. make-symbol::=make an uninterned symbol.
      83. man::=Display the manual pages.
      84. mapc::=apply function to successive cars.
      85. mapcar::=apply function to successive cars.
      86. mapl::=apply function to successive cdrs.
      87. maplist::=apply function to successive cdrs.
      88. max::=the largest of a list of numbers.
      89. mem::=show memory allocation statistics.
      90. member::=find an expression in a list.
      91. min::=the smallest of a list of numbers.
      92. minusp::=is this number negative?.

        N

      93. nconc::=destructively concatenate lists.
      94. not::=is this false?.
      95. nth::=return the nth element of a list.
      96. nthcdr::=return the nth cdr of a list.
      97. null::=is this an empty list?.
      98. numberp::=is this a number?.

        O

      99. oddp::=is this number odd?.
      100. open::=open a file, returns stream for I/O.
      101. or::=the logical or of a list of expressions.

        P

      102. peek::=peek at a location in memory.
      103. peek-char::=peek at the next character.
      104. plusp::=is this number positive?.
      105. poke::=poke a value into memory.
      106. prin1::=print a list of values.
      107. princ::=print a list of values without quoting.
      108. print::=print a list of values on a new line.
      109. prog::=the program feature, see program above.
      110. putprop::=put a property onto a property list.

        R

      111. random::=compute a random number between 1 and n-1.
      112. read::=read an xlisp expression.
      113. read-char::=read a character from a file or stream.
      114. read-line::=read a line from a file or stream.
      115. rem::=remainder of a list of numbers.
      116. remove::=remove an expression.
      117. remprop::=remove a property.
      118. return::=cause a prog construct to return a value.
      119. reverse::=reverse a list.
      120. rplaca::=replace the car of a list node.
      121. rplacd::=replace the cdr of a list node.

        S

      122. set::=set the value of a symbol.
      123. setf::=set the value of a field.
      124. setq::=set the value of a symbol.
      125. sin::=compute the sine of a number.
      126. sqrt::=compute the square root of a number.
      127. strcat::=concatenate strings.
      128. string::=make a string from an integer ascii value.
      129. sublis::=substitute with an a-list.
      130. subst::=substitute expressions.
      131. subseq::=extract a substring.
      132. symbol-name::=get the print name of a symbol.
      133. symbol-plist::=get the property list of a symbol.
      134. symbol-value::=get the value of a symbol.
      135. symbolp::=is this a symbol?.
      136. system::=send string as command to operating system..

        T

      137. tan::=compute the tangent of a number.
      138. terpri::=terminate the current print line.
      139. throw::=throw to a catch.
      140. top-level::=clean-up after an error and return to the top level.
      141. transcript::=create a file with a transcript of a session.
      142. truncate::=truncates a floating point number to an integer.
      143. type-of::=returns the type of the expression.

        W

      144. write-char::=write a character to a file or stream.

        Z

      145. zerop::=is this number zero?.

      . . . . . . . . . ( end of section Functions) <<Contents | End>>

    . . . . . . . . . ( end of section LISP functions and Macros) <<Contents | End>>

End