simplified version of guile-log and more coherrent

parent 80c97ec5
GNU Lesser General Public License (LGPL) version 2
This is a port of racket-5.1 version of contracts which are
under,
Copyright (c) 2010-2011 PLT Scheme Inc.
With changes by Stefan Israelsson Tampe in order to make it work under
guile
See "COPYING.LIB" for more information about the license.
......@@ -318,42 +318,89 @@ This will bind v with x in a letrec manner and then execute code ...
with an iomplicit <and> around it.
(<match> [#:mode +] (X ...)
G.L. (<match> [#:mode +] (pat ... code) ...)
This is a small wrapper around umatch the difference is that if works under
G.L. and that code is evaluated under G.L. and that backtratcking is correctly
setuped.
<funcall>
Scm (<def> (f [#:mode +] a ..) (p ... code) ...))
Scm (<<define>> (f [#:mode +] a ..) (p ... code) ...))
This is a sugar for essentially,
(<define> (f a ...) (<match> [#:mode +] (a ...) (p ... code) ...))
<ret>
<recur>
The difference is that <<define>> will never backtrack to a new match
and <def> will backtrack to the next matcher if the code part fails
<def>
<<define>>
<apply>
<bag-of>
<fkn>
G.L. (<funcall> F . L)
This is actually funcall the difference is that it will make sure to lookup
F if it is a unify variable pointing to a lambda.
<pp>
<pp-dyn>
G.L. (<recur> Loop ((V X) ...) code ...)
This is essentially a named let for the G.L. environment. code ...
is evaluated in G.L. and X is in Scm.
<code>
<tail-code>
<return>
<ret>
<next>
G.L. (<pp> x)
This will pretty-print x and print it as a list-version of the code
<format>
<with-bt>
<with-fail>
(<pp-dyn> Redo-print Undo-print)
When the current unify stack backtracks accros this position it will do a
(<pp> Undo-print), if it will again redo accross this dynwind it will pretty-print e.g. (<pp> Redo-print)
G.L. (<format> port str arg ...)
As with format, but under G.L.
G.L. (<code> code ...)
Will execute (begin code ...) as scheme and then continue this is always true
G.L. (<tail-code> (p cc)
code ...)
This will bind the failure thunk p and continuation cc inside code ... which is
evaluated under Scm e.g. an implicit begin. It is the scheme code's (code ...=
responsability to continue using cc or backtrack using p.
G.L. (<return> code ...)
This will just do a Scm: (begin code ...) and simply return that form in the
guile log pass
G.L. (<ret> val)
The same as (<return> (u-scm val))
G.L. (<next>)
Will backtrack to the next clause in a match (TODO: this has not been tested)
G.L. (<with-fail> p code ...)
This will use p as a failure for G.L. (<and> code ...)
G.L. (<with-cut> cut code ...)
This will use cut as a cut failure for G.L. (<and> code ...)
G.L. (<peek-fail> p code ...)
This will bind p to the failure thunk at this instruction
G.L. (<succeeds> P)
Will try P and if it succededs undo any bindings and continue
Scm (<with-guile-log> (p cc) code ...)
This will start a guile-log session using failure think p and continuation
cc and use p as a cut as well
Scm (<with-guile-log> (cut p cc) code ...)
This will start a guile-log session using failure think p and continuation
cc and use cut as the cut failure thunk.
Scm (<ask> P ...)
will execute (<and> P ...) and if sucess return #t else if fail return #f
Scm (<eval> (v1 ...) code fini cc)
This will bind new variables v1 ... and execute code with failure fini
and continuation cc under G.L.
Scm (<run> n (v ...) code ...)
bind v ... with variables and execute the code and collect the list
of list of bindings of v at sucess if (v ...) = (w) then it will return a list
of values.
<succeeds>
<->> prompt=>
<with-prolog-environment> <collector> parse<> <eval>
<ask>
<set-cut>
bag-of/3 set-of/3 <run>
<exec> <take> <*>
*r* ! !! <repl-vars> <unify>
unwind-mute unwind-interval unwind-token
mark-once/2 mark/2
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment