Skip to content

Commit bdd6f3e

Browse files
authored
Merge pull request #1 from Z80coder/doc-test
Doc test
2 parents 831254e + 2dcdf32 commit bdd6f3e

File tree

3 files changed

+118
-4
lines changed

3 files changed

+118
-4
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# datalog-cpp
2+
23
implementation of datalog (without negation, and semi-naive bottom-up evaluation) in C++
34

45
work-in-progress
56

67
not yet alpha!
8+
9+
## Documentation
10+
11+
- [Quick git how to](./docs/git-how-to.md)

docs/git-how-to.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Quick git how to
2+
3+
Quick instructions on how to contribute to this repo from the command line.
4+
5+
Please see link to other resources below.
6+
7+
## 1. Clone the repo on your local machine
8+
9+
```
10+
git clone git@github.com:Z80coder/datalog-cpp.git
11+
```
12+
13+
You should now have a `datalog-cpp` folder.
14+
15+
```
16+
cd datalog-cpp
17+
```
18+
19+
## 2. Update the master branch
20+
21+
22+
```
23+
git checkout master
24+
git pull
25+
```
26+
27+
## 3. Create a new branch for your work
28+
29+
You will develop your code in your own branch. First you need to create it.
30+
31+
```
32+
git checkout -b your_branch_name
33+
34+
git push --set-upstream origin your_branch_name
35+
```
36+
37+
## 4. Or switch to your existing branch for your work
38+
39+
If you already done the step above, then ensure you are in your branch when you write code.
40+
41+
```
42+
git checkout your_branch_name
43+
```
44+
45+
## 5. Do some coding
46+
47+
Work as normal
48+
49+
## 6. Commit your changes
50+
51+
Type
52+
```
53+
git status
54+
```
55+
to check which files you've added or changed. Note the files you want to commit at this time, then:
56+
```
57+
git add newfile1 newfile2
58+
```
59+
Then commit the changes
60+
```
61+
git commit
62+
```
63+
64+
## 7. Push your changes to GitHub
65+
66+
All you've done so far is declare some changes. You haven't yet pushed them to the GitHub repo. Let's do that now.
67+
68+
```
69+
git push
70+
```
71+
72+
You can keep adding, committing and pushing until you're ready to open a pull-request (with the intent of merging the changes in your branch into the `master` on the repo).
73+
74+
## 8. Open a pull-request
75+
76+
Go to https://github.com/Z80coder/datalog-cpp
77+
78+
Click on the `Branch` button and look for `your_branch_name`, and then click on it.
79+
80+
You should see a `New pull request` button. Click it and follow the user-interface prompts to create a pull-request.
81+
82+
Once reviewed, your branch will be merged. You can contribute a new collection of changes by returning to `Create a new branch for your work` above.
83+
84+
## Other resources
85+
86+
- Microsoft Visual Studio has git support built in, and there's a GitHub plugin for Visual Studio to enable direct cloning from GitHub repos.
87+
88+
- Microsoft Visual Code also has plug-in extensions that support Git
89+
90+
- https://guides.github.com/ has some useful guides.
91+
92+
- Also, there's a GitHub Desktop app: https://desktop.github.com/

src/Variable.h

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,47 @@ using namespace std;
1515
template <typename T>
1616
struct Variable : optional<T>
1717
{
18+
/**
19+
* @brief bind this variable to the supplied value (making it an unfree variable)
20+
*
21+
* @param value
22+
*/
1823
void bind(const T &value)
1924
{
2025
this->emplace(value);
2126
}
2227

28+
/**
29+
* @brief unbinds this variable (making it a free variable)
30+
*
31+
*/
2332
void unbind()
2433
{
2534
this->reset();
2635
}
2736

37+
/**
38+
* @brief checks whether this variable is free or bound
39+
*
40+
* @return true if bound to a value
41+
* @return false if free
42+
*/
2843
bool isBound() const
2944
{
3045
return this->has_value();
3146
}
3247

33-
const T &
34-
value() const
48+
/**
49+
* @brief returns the bound value (if not bound then throws an exception)
50+
*
51+
* @return const T&
52+
*/
53+
const T &value() const
3554
{
3655
return this->optional<T>::value();
3756
}
3857
};
3958

40-
// TODO: use auto more for return type of functions
41-
4259
template <typename T>
4360
Variable<T> *var()
4461
{

0 commit comments

Comments
 (0)