Lists, Operators and Arithmetic

  • Here we study:

    • Lists
    • Operations on lists

Representing of Lists (3.1)

  • List is a usual structure as any structure is Prolog
  • Head and tails of a list
  • .(Head, Tail): is the representation of the list is Prolog
  • Nested Lists: Hobbies 1, 2 and L
  • Tail = [b, c] and L = .(a, Tail) OR L = [a | Tail]
  • The difference between sets and lists that the order of items in the list matter and in set doesn’t matte
  • Membership Operation:
  • Concatenation Operation:

    • using the inverse parameters: the power set of a concatenation
    • months example:

      • before and after specific moth
      • months after and before specific month
  • Sub List
  • Permutation

3.3 Operator Notation

  • The difference between:

    • Infix Operators: xfx, xfy and yfx
    • Prefix Operators: fx and fy
    • Postfix: xf and yf
  • Directives: act as operator definition
  • No operation on data is associated with an operator

3.4 Arithmetic

  • The is operator
  • Comparison operators:

>=, =<, =:=, =\=

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s