Search the web
Sign In
New User? Sign Up
KR-language
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
$0 has explanation;   Message List  
Reply | Forward Message #289 of 712 |
When the meaning of a method is interpreted, $0 is set equal to
the name of the event (this instance of execution of the method).
Likewise, when the meaning of a relation is interpreted, $0 is
set equal to the name of the infon (this instance of the relation
tuple).

This permits you to record customized information whenever the
meaning of the method or relation is interpreted.

Here is a simple example (suggested by Adrian Apollo) which
records explanations for the failures of the "increase" method.

# increase.mkr
# Aug/30/2005

# NumberList relations
precedes isu VERB with ctype=relation;
succeeds isu VERB with ctype=relation;
1 precedes 2; 2 succeeds 1;
2 precedes 3; 3 succeeds 2;
# ...
19 precedes 20; 20 succeeds 19;

increase iss method with
# Product = next number in NumberList
format=[number:1],
local=[y],
meaning={
set echo=off;
if $1 is nonexistent;
then y := nonexistent;
$0 has explanation = "fail($1): invalid input";
else
# precedes is faster than succeeds
#y := ? succeeds $1;
y := $1 precedes ? ;
if $y is [];
then y := nonexistent;
$0 has explanation = "fail($1): answer not in NumberList";
else $0 has explanation = "ok($1)";
fi;
fi;
set echo=on;
return Product=$y;
};

# test
x := do increase od 2 done;
y := do increase od 20 done;
z := do increase od nonexistent done;
every event isa increase {
$event has explanation=?;
};

increase_704 has explanation = "ok(2)";
increase_714 has explanation = "fail(20): answer not in NumberList";
increase_725 has explanation = "fail(nonexistent): invalid input";


Dick McCullough
knowledge := man do identify od existent done;
knowledge haspart proposition list;
http://rhm.cdepot.net/
Dick McCullough
knowledge := man do identify od existent done;
knowledge haspart proposition list;
http://rhm.cdepot.net/




Wed Aug 31, 2005 6:21 am

rhmcc
Offline Offline
Send Email Send Email

Forward
Message #289 of 712 |
Expand Messages Author Sort by Date

When the meaning of a method is interpreted, $0 is set equal to the name of the event (this instance of execution of the method). Likewise, when the meaning of...
Richard H. McCullough
rhmcc
Offline Send Email
Aug 31, 2005
6:27 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help