-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (29 loc) · 1.03 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="js/brython.js"></script>
<script type="text/javascript" src="js/brython_stdlib.js"></script>
<script src="https://github.com/tonsky/datascript/releases/download/0.18.10/datascript-0.18.10.min.js"></script>
</head>
<body onload="brython(1)">
<script type="text/python">
from browser import window, alert
datascript = window.datascript
from mercylog_datascript import DataScriptV1
datascript = window.datascript
m = DataScriptV1()
db = datascript.empty_db()
db1 = datascript.db_with(db, [[":db/add", 1, "name", "Ivan"],
[":db/add", 1, "age", 17]])
db2 = datascript.db_with(db1, [{":db/id": 2,
"name": "Igor",
"age": 35}])
N, A, E = m.variables('n', 'a', 'e')
query = m.query(find=[A], where=[[E, "name", "Igor"], [E, "age", A]])
q = query.code()
result = datascript.q(q, db2)
alert(result)
</script>
</body>
</html>