This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/16386793/datomic-query-function-that-filters-and-binds | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attribute definiton | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [;; Article | |
{:db/id #db/id [:db.part/db] | |
:db/ident :article/title | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
# este es la lista vacia | |
temperaturas = [] | |
# el usuario ingresa la cantidad de dias | |
num_dias = int(input(f"¿Cuantos días se van a promediar?: ")) | |
# el ciclo del array | |
for i in range(0, num_dias): | |
temperatura = float(input(f"Ingrese la temperatura del dia {i + 1}: ")) | |
temperaturas.append(temperatura) | |
print(f"\nLas temperaturas son: {temperaturas}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/17190334/getting-the-id-of-an-inserted-entity-in-diatomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; create an atribute | |
(d/transact conn [{:db/id #db/id[:db.part/db] | |
:db/ident :some/attribute | |
:db/valueType :db.type/string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; see http://stackoverflow.com/questions/14724991/modelling-multiple-many-to-many-relationships-in-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [ ;; User | |
{:db/id #db/id [:db.part/db] | |
:db/ident :user/username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [{:db/id #db/id [:db.part/db] | |
:db/ident :enum/ns | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db/doc "Enum's namespace. Help enforce fk constraints on :db.type/ref enum references" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download | |
wget http://downloads.datomic.com/0.8.3848/datomic-pro-0.8.3848.zip | |
unzip datomic-pro-X.X.zip & cd datomic-pro-X.X | |
# install as a maven artifact | |
./bin/maven-install | |
# configure transactor.properties | |
cp config/samples/sql-transactor-template.properties transactor.properties | |
# protocol=sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w:"I"$first .z.x | |
c:{[w] | |
warehouse:w*9; | |
stock:100000*18; | |
item:100000*5; | |
region:5*3; | |
supplier:10000*7; | |
nation:25*4; | |
orderline:w*300000*10; | |
neworder:w*9000*3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\c 30 300 | |
/ KDB built-in types | |
/ default values | |
STORAGE_VALUES:(0b;0Ng;0x00;0h;0i;0;0e;0.0;" ";`;0Np;2000.01m;2000.01.01;2000.01.01T00:00:00.000;0Nn;00:00;00:00:00;00:00:00.000;0) | |
STORAGE_VALUES,:enlist each STORAGE_VALUES | |
/ char aliases | |
STORAGE_CHARS:"bgxhijefcspmdznuvtr" / scalar char aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\c 15 300i | |
/ c: count | th: table handle | ht: historical table | st: snapshot table | rt: realtime table | tx: transaction | |
/ source: "abcdefghijklmnopqrstuvwxyz" (size=26) | |
/ input: (# of groups) 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 | |
/ output (# of handles): 676 169 81 49 36 25 16 16 9 9 9 9 4 4 4 4 4 4 4 4 4 4 4 4 4 1 | |
getHdbTableHandles:{[crossProductAlphabetSize]`$(":hdb/",/:raze g,\:/:g:cut[crossProductAlphabetSize;"abcdefghijklmnopqrstuvwxyz"]),'"/"} | |
getAllHdbTableHandles:{ | |
/:raze getHdbTableHandles each 1+til 26 / all tables ~1200 |
NewerOlder