MemCPs native access technology is the scheme scripting language.
In scheme, you can do functional programming with scheme. This is an example scheme terminal session in MemCP:
carli@launix-MS-7C51:~/projekte/memcp$ make && ./memcp go build memcp Copyright (C) 2023 Carl-Philip Hänsch This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; Welcome to memcp Hallo World MySQL server listening on port 3307 (connect with mysql -P 3307 -u user -p) listening on http://localhost:4321 > (createdatabase "test") = "ok" > (createtable "test" "foo" '('("bar" "int" '() ""))) = "ok" > (insert "test" "foo" '("bar" 12)) = "ok" > (scan "test" "foo" (lambda () true) (lambda (bar) (print "bar=" bar))) bar=12 = "47.631µs" >
As you can see, MemCP has some functions like
scan. Whereof which the first three are straight forward while
scan is the interesting part:
The interface of
scan is the following:
(scan schema table filterfn mapfn [reducefn [default]])
The interesting part is
filterfn. In the filter function, you specify the condition that must apply on a dataset in order to be scanned. An example for a filter function might be
(lambda (ID) (equal? ID 34)). This would only scan entries that have an
ID equal to
The arguments of the filter function represent the columns of the table. This means, in a columnar storage, in order to find out the items whose conditions fit the scan condition, only the specified columns have to be opened.
The same applies for the map function. Inside the map function, you can compute whatever you want to take away from the scanned row. This might be a single value, this might be stitching together a JOIN dataset … whatever you want.
Map and reduce are made to be completely parallelizable, so you cannot rely on their execution order – which does not matter because our scheme dialect is pure functional.
Finally, the reducefn will do aggregation.