Loading ...
Sorry, an error occurred while loading the content.

3627Help with creating LISP Function Pattern?

Expand Messages
  • eyhktom
    Feb 22, 2005
    • 0 Attachment
      Hi
      I'm trying to create a function pattern for a reduced set of LISP
      (ACL2), but I'm having a hard time. Nothing I try works, and I'm not
      quite sure why.

      It's pretty simple, a \/ with no preceding \' followed by the
      function name followed by any number of white spaces followed by any
      number of expressions with matching parentheses ending in a end
      parentheses

      for example:

      (equal x y)

      equal would be a function

      (equal (a b c) '(a b c))

      equal and the first 1 would be a function, the second 1 would not.
      (a b c) means that 1 is a function that takes two arguments, and the
      variable names are 2 and 3.
      '(a b c) means a list of values a, b, and c.

      basically its always

      (function_name argument1 argument2)

      where argument 1 and two can either recursively use the function
      declaration or be a variable name

      Another example
      (equal (app (app a b) c) (app a (app b c)))

      equal takes two arguments
      1) (app (app a b) c)
      app is another function that takes two arguments
      1-1) (app a b)
      app is another function that takes two arguments
      1-1-1) a (variable name)
      1-1-2) b (variable name)
      1-2) c (variable name)
      2) (app a (app b c))
      etc..

      it doesn't necessarily have to be the same function, but it can be
      any other function.

      I hope I have clarified myself, and if anybody could help me out I'd
      really appreciate it.
      Thanks!


      Eugene Kim
    • Show all 2 messages in this topic