Did you know ... Search Documentation:
Pack odict -- document/manual.txt

Syntax of iterms (= open dicts)

[2016/12/10] Kuniaki Mukai

  • Syntax of iterms. term := <prolog term> atom := <prolog atom> variable := <prolog variable> key := <prolog ground term>
    iterm := [] (void iterm) | { key:dterm, key:dterm, ..., key:dterm }
    dterm := term | atom(dterm, ..., dterm) | iterm | rterm

    rterm := variable.kterm.kterm....kterm

  • Examples of iterm. {a:1, b:{c:2, d:3} } {a:X, b:f(X, X)} {a:X, b:X.c.d} {a:f(X.a, Y.b)} {a:f(X.A.B, Y.B)}
  • Example use of the iterm. ?- U= {a:X, b:f(X, X)}, X = hello, Ans = U.b. Ans = f(hello, hello)

    ?- U= {a:X, b:X.c.d}, X={c:{d:hello}}, Ans=U.b. Ans = hello

    ?- U= {a:f(X.a, X.b)}, X={a:hello, b:world}, Ans=U.a. Ans = f(hello, world)

    ?- U= {a:f(X.a(I))}, X={a(1):1, a(2):hello, a(3):3}, Ans=X.a(I), I=2. Ans = hello

  • Example use of the library. % swipl

    ?- [odict]. odict: ?- ['odict/ptq-fragment']. odict: ?- run_samples.

    Or: ?- use_module(libary(odict)). cil: ?- [library('odict/ptq-fragment')]. cil: ?- run_samples.