Skip to content

Commit

Permalink
Docs tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNahabedian committed Feb 26, 2024
1 parent 68a0df8 commit d56d78e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "1.0.0-DEV"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"

[compat]
OrderedCollections = "1.6"
julia = "1"

[extras]
Expand Down
27 changes: 17 additions & 10 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,40 @@ CurrentModule = Rete

Documentation for [Rete](https://github.com/MarkNahabedian/Rete.jl).


## Facts

The *facts* in our reasoning system can be arbitrary Julia objects.
It's best to restrict facts to immutable objects though so that they
It's best to restrict *facts* to immutable objects though so that they
can't be altered once they're stored in the network or conclusions
have been made.


## The Network

The reasoning is performed by a network of nodes. *Facts* flow
through the network from node to node.

Some nodes filter the facts and only pass through those that satisfy
some predicate or are instances of a certain type.

Some nodes store *facts*.

Join nodes have two input streams and produce all possible
combinations of facts cming in from the two streams.

Each node has a set of input nodes (those that send it *facts*), and a
set of outputs (those nodes to which it sends *facts*).
[`connect`](@ref) is used to construct the network by linking nodes
together.

Some nodes filter the *facts* and only pass through those that satisfy
some predicate or are instances of a certain type.

Some nodes store *facts*.

Join nodes have two input streams. A function is applied to all
possible combinations of facts coming in from the two streams. The
function can call [`emit`](@ref) to assert a new *fact* to the
network.


That's the theory. In practice, its simpler if a given node performs
more than one of these roles. One such example is
[`IsaMemoryNode`](@ref), which filters *facts* that match a type
parameter and remember only those ^facts*.
parameter and remember only those *facts*.


## Flow of Facts through the Network
Expand All @@ -47,9 +50,13 @@ A node distributes a *fact* to its outputs using its [`emit`](@ref)
method, which calls [`receive`](@ref) for each of the node's outputs.


## Index

```@index
```

## Glossary

```@autodocs
Modules = [Rete]
```
12 changes: 12 additions & 0 deletions src/join_nodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,23 @@ end
# asserted. Adding inputs to a JoinNode doesn't cause existing facts
# from those inputs to be processed.


"""
connect_a(from::AbstractMemoryNode, to::JoinNode)
Connect a memory node to the *a* input of a JoinNode.
"""
function connect_a(from::AbstractMemoryNode, to::JoinNode)
push!(from.outputs, to)
push!(to.a_inputs, from)
end


"""
connect_b(from::AbstractMemoryNode, to::JoinNode)
Connect a memory node to the *b* input of a JoinNode.
"""
function connect_b(from::AbstractMemoryNode, to::JoinNode)
push!(from.outputs, to)
push!(to.b_inputs, from)
Expand Down

0 comments on commit d56d78e

Please sign in to comment.