# Oz

To use this language, use the class "language-oz".

## Comments

    %
    % Foobar

    /* Foo
    bar */

## Strings

    ""
    "Foo \"bar\" baz"

## Numbers

    0
    42
    0154
    0xBadFace
    0B0101
    3.14159
    2e8
    3.E~7
    4.8E12
    &0
    &a
    &\n
    &\124

## Functions and procedures

    proc {Max X Y Z}
    {Browse Z}
    f(M Y)

## Full example

    proc {DisMember X Ys}
       dis Ys = X|_ [] Yr in Ys = _|Yr {DisMember X Yr} end
    end

    class DataBase from BaseObject
       attr d
       meth init
          d := {NewDictionary}
       end
       meth dic($) @d end
       meth tell(I)
          case {IsFree I.1} then
             raise database(nonground(I)) end
          else
             Is = {Dictionary.condGet @d I.1 nil} in
             {Dictionary.put @d I.1 {Append Is [I]}}
          end
       end
       meth ask(I)
          case {IsFree I} orelse {IsFree I.1} then
             {DisMember I {Flatten {Dictionary.items @d}}}
          else
             {DisMember I {Dictionary.condGet @d I.1 nil}}
          end
       end
       meth entries($)
          {Dictionary.entries @d}
       end
    end

    declare
    proc {Dynamic ?Pred}
       Pred = {New DataBase init}
    end
    proc {Assert P I}
       {P tell(I)}
    end
    proc {Query P I}
       {P ask(I)}
    end

    EdgeP = {Dynamic}
    {ForAll
    [edge(1 2)
     edge(2 1)   % Cycle
     edge(2 3)
     edge(3 4)
     edge(2 5)
     edge(5 6)
     edge(4 6)
     edge(6 7)
     edge(6 8)
     edge(1 5)
     edge(5 1)  % Cycle
    ]
    proc {$ I} {Assert EdgeP I} end
    }