-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement open-ended reasoning #14
Conversation
} | ||
} | ||
|
||
/// Attempt to forward translate a quad. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be really useful for future maintainers to have a high level comment of what forward means
(even if it seems redundant from translator.rs)
btw does forward mean find the index of each of s,p,o, and g ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 55978e7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translator is a bi-directional dictionary from one language to another. One language is T
and the other is usize
.
forall t in T
if trans.forward(t) == Some(u)
then trans.back(u) == Some(t)
btw does forward mean find the index of each of s,p,o, and g ?
If you want to call members of the second language (usize
) indices then sure.
The fact that they are indices is an implementation detail. Translator currently looks like this:
pub struct Translator<T> {
widdershins: Box<[T]>,
}
But a less efficient version of Translator might look like this:
pub struct Translator<T> {
widdershins: BtreeMap<usize, T>,
deosil: BtreeMap<T, usize>,
}
src/common.rs
Outdated
) | ||
} | ||
|
||
/// Reverse of forward. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
and does this mean replace each index with the actual corresponding item ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 55978e7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and does this mean replace each index with the actual corresponding item ?
yes? I think? See above comment.
@@ -19,6 +27,87 @@ where | |||
ret | |||
} | |||
|
|||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize I should have pointed that out in the previous PR,
Could you add doc-comments for both highlighting the difference between Rule, LowRule, LowRuleApplication, and what it means to lower()/raise() a rule and why it's used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On it.
Unrelated observation, lower
is kinda doing two separate things here. It both changes the way the rule is represented, and it translates elements from T
to usize
. Maybe lower
simplified in the future by separating the two steps. The refactor would be a little tricky though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 55978e7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to add docs for LowRuleApplication
. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 26debb6
@@ -184,4 +186,75 @@ mod tests { | |||
let expected: [[&str; 4]; 0] = []; | |||
assert_eq!(&inferences, &expected); | |||
} | |||
|
|||
#[test] | |||
fn sum_of_consecutive_ints_is_odd() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this.
Thanks for the explanations and comments. |
Tagged and pushed changes to https://www.npmjs.com/package/rify and https://crates.io/crates/rify |
This pr adds a new function.
infer
infer
doesn't have a goal in mind likeprove
does.Unlike
validate
,infer
thinks for itself. It generates its own conclusions.infer
is an open minded individual who won't stop until it groks its universe in full.:)