updated the documentation

parent 83cf6a65
......@@ -158,7 +158,7 @@ The next two command is mirroring the two commands above. But for these we don't
@code{(gp-restore-state state)}, Restore a state that is saved by gp-store-state
@code{(gp-restore-wind state)}, the same as above, but they will not change the dynamic globals to the old state.
@code{(gp-restore-wind state)}, the same as above, but they will not change the dynamic globals to the old state use this if the restorage should keep all live guarded variables at their value.
@section The guile log variables
@findex gp-var!
......@@ -277,8 +277,9 @@ N.B. the setup stack is executed before the setup que.
@section guarded state variables
@findex with-guarded-states
These variables works almost like a local variable it's ok to @code{set!} it the value is still recreatable via a restore-state operation on the other hand under the workings of @code{gp-unwind} and @code{restore-unwind} the variables behaves as a local variable. These objects are very handy in interleaving commands in the guile-log section.
@code{(with-guarded-states guard ((s v) ...) code ...)}, think of @code{s} as a local variable and @code{v} as it's initial binding. @code{guard} is then used to set thes variable like @{(guard v-new ...)} e.g. it should behave as in
These variables works almost like a global variable it's ok to @code{set!} it the value is still recreatable via a restore-state operation on the other hand under the workings of @code{gp-unwind} and @code{restore-unwind} the variables behaves as a global variable. These objects are very handy in interleaving commands in the guile-log section.
@code{(with-guarded-states guard ((s v) ...) code ...)}, think of @code{s} as a local variable and @code{v} as it's initial binding. @code{guard} is then used to set these variable like @{(guard v-new ...)} e.g. it should behave as in
@verbatim
(begin
......@@ -286,7 +287,9 @@ These variables works almost like a local variable it's ok to @code{set!} it the
...)
@end verbatim
And if one stick to wind versions of unwinding and restoring this is indeed the semantic. On the other hand if we would like to escape and store the state for later use it is possible to do that with the standard framework.
And if one stick to wind versions of unwinding and restoring this is indeed the semantic. On the other hand if we would like to escape and store the state for later use it is possible to do that with the standard framework like <stall> <state-ref> and one can even get a call/cc and prompts working.
@code{(with-guarded-globals g (s ...) code ...)}, this as above but now @code{s...} is already a variables that has been defined.
@section spurious commands
@findex gp-print
......@@ -423,22 +426,33 @@ will put the @code{p} and the @code{cc} in front and execute that. e.g. to defin
@code{G.L. (<not> p)}, successes if @code{p} fail and fails if @code{p} successes. Note that when @code{p} fails any unifying action inside @code{p} will prevail.
@findex <if>
@findex <if-some>
@findex <cond>
@findex <or-i>
@findex <or-union>
@findex <succeeds>
@findex <and-i>
@findex interleave
@findex interleave-union
@findex and-interleave
@code{G.L. (<if> p x)}, if @code{p} is a success then @code{x}, @code{p} will only success at most one time.
@code{G.L. (<if> p x y)}, if @code{p} is success then @code{x}, else backtrack and use @code{y}, the same condition holds on @code{p} as the previous version of if.
@code{G.L. (<if-some> p x)}, the same as @code{(<and> p x)}.
@code{G.L. (<if-some> p x y)}, logicaly the same as @code{(<or> (<and> p a) (<and> (<not> p) b))}.
@code{G.L. (<cond> (P X) ...)}, like the ordinary cond, but using @code{<if>} in stead of @code{if}
@code{G.L. (<or-i> p1 p2 ... pn)}, if @code{p1} successes and we later backtrack then try @code{p2} etc and so on until @code{pn} if @code{pn} successes and we later backtrack then @code{p1} is tried again and interleave like that. To note here is that this form uses both bank a and b and in order to function correctly when storing a state both bank a and bank b need to be stored.
@code{G.L. (interleave l)}, the same as @code{<or-i>} but with the difference l is a list of lambdas typically made by @code{(</.> ...)}.
@code{G.L. (<or-union> p1 ...)}, this is like @code{<or-i>} but if @code{pk} has a success and if, the goal @code{pl}, l > k, succeses like in (<and> pk pl) then we will backtrack, this means that duplication of results is in a sense removed.
@code{G.L. (interleave-union l)}, see @code{interleave}.
@code{G.L. (<and-i> p1 p2 p3 ...)}, and interleaving! this is an and which will in parctice behave as
@verbatim
(<and-i> (<or> A B) (<or> C D))
......@@ -451,6 +465,19 @@ e.g. backtracking is shallow and we will backtrack all the first combinations, t
@code{G.L. (<succeeds> p)} will try @code{p} and if it succeeds undo any bindings and continue.
@section Guarded variables
@findex <letg>
@findex <set!>
@findex define-guarded
@code{G.L. (<letg> ((s v) ...) code ...)}, This will define s as a guarded variable, you can use set! and ref it as an ordinary variable. but it will play nice with continuational construct lik e@code{<state-set!>} and @code{<state-ref>}.
@code{G.L. (<set!> s v)}, basically the same as @code{(<code> (set! s v))}.
@code{Scm (define-guarded s v)}, defines a guarded variables s with initial value v. This will play nice with state storage and retrieving.
@section Unify Constructs
@findex let<>
@findex <=>
......@@ -543,6 +570,12 @@ This is a sugar for essentially, @code{(<define> (f a ...) (<match> [#:mode +] (
@findex <pp>
@findex <pp-dyn>
@findex <format>
@findex tr
@findex *gp-var-tr*
@code{Scm (tr x)}, translate unbound variables with a prefix governed by @code{*gp-var-tr*} fluid.
@code{Scm (tr pre x)}, the same as above but using @code{pre} as the prefix.
@code{G.L. (<pp> x)}, this will pretty-print @code{x} and print it as a list-version of the code
......
(export <next> <or> <and> <not> <bag-of> <cond> <if>
(export <next> <or> <and> <not> <cond> <if>
<with-guile-log> <eval> <if-some>
<cc> <fail> <let> <let*> <var> </.> <ask> <ret> <when>
<define> <cut> <pp> <pp-dyn> <set-cut>
bag-of/3 set-of/3 <run> <recur> <letrec>
<run> <recur> <letrec>
<lambda> <with-fail> <with-cut> <peek-fail>
<match> <=> <r=> <==> *r* <funcall>
<and!> <and!!> <succeds>
......
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