Skip to content

Commit 33b4023

Browse files
committed
demo notebook
1 parent c9170cc commit 33b4023

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ examples/test/*
1515
examples/migrations/*
1616
examples/truffle-config.js
1717
examples/test/TestPysnark.sol
18+
notebooks/.ipynb_checkpoints/test-checkpoint.ipynb

notebooks/test.ipynb

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from pysnark.runtime import PrivVal"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": 2,
15+
"metadata": {},
16+
"outputs": [
17+
{
18+
"data": {
19+
"text/plain": [
20+
"{30}"
21+
]
22+
},
23+
"execution_count": 2,
24+
"metadata": {},
25+
"output_type": "execute_result"
26+
}
27+
],
28+
"source": [
29+
"PrivVal(10)*PrivVal(3)"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": 3,
35+
"metadata": {},
36+
"outputs": [
37+
{
38+
"data": {
39+
"text/plain": [
40+
"{120}"
41+
]
42+
},
43+
"execution_count": 3,
44+
"metadata": {},
45+
"output_type": "execute_result"
46+
}
47+
],
48+
"source": [
49+
"from pysnark.branching import if_then_else, BranchingValues, _if, _range, _endfor\n",
50+
"\n",
51+
"_=BranchingValues()\n",
52+
"_.ret=1\n",
53+
"n=PrivVal(5)\n",
54+
"for i in _range(2,n+1,max=8):\n",
55+
" _.ret=_.ret*i\n",
56+
"_endfor()\n",
57+
"_.ret"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {},
64+
"outputs": [],
65+
"source": []
66+
}
67+
],
68+
"metadata": {
69+
"kernelspec": {
70+
"display_name": "Python 3",
71+
"language": "python",
72+
"name": "python3"
73+
},
74+
"language_info": {
75+
"codemirror_mode": {
76+
"name": "ipython",
77+
"version": 3
78+
},
79+
"file_extension": ".py",
80+
"mimetype": "text/x-python",
81+
"name": "python",
82+
"nbconvert_exporter": "python",
83+
"pygments_lexer": "ipython3",
84+
"version": "3.7.4"
85+
}
86+
},
87+
"nbformat": 4,
88+
"nbformat_minor": 2
89+
}

0 commit comments

Comments
 (0)