Skip to content

Instantly share code, notes, and snippets.

@dszakallas
dszakallas / kleene.md
Last active February 10, 2018 14:39
Kleene blogpost

Recently I've been writing a graph query engine at Fault Tolerant System Research Group at uni. The frontend is Cypher, a language popularized by Neo Technology shipped OOTB with their graph database Neo4j.

Recently Cypher is getting standardized in an open source and open government initiative under the name openCypher; and other DB vendors, such as the RDBMS giant Oracle are starting to support it.

The language itself is similar to SQL augmented with syntax for graph pattern matching. One of the similarities is the handling of NULL values.

@dszakallas
dszakallas / BidirectionalMultiMap.scala
Last active June 30, 2017 09:44
BidirectionalMultiMap.scala
/*
Immutable bidirectional multimap with unique set of values and keys.
*/
case class BiMultiMap[K, V](
forward: Map[K, Set[V]] = Map.empty,
backward: Map[V, Set[K]] = Map.empty
) {
import BiMultiMap._
def +(kv: (K, Set[V])): BiMultiMap[K, V] = {
val (nextForward, nextBackward) = kv match {
@dszakallas
dszakallas / universal.cpp
Created July 12, 2017 20:19
universal reference
template<typename T> void f(T&& param); // param is now a universal reference
int x = 27;
const int cx = x;
const int& rx = x;
f(x); // x is lvalue, so T is int&,
// param's type is also int&
f(cx); // cx is lvalue, so T is const int&,
// param's type is also const int&
f(rx); // rx is lvalue, so T is const int&,
// param's type is also const int&
@dszakallas
dszakallas / fixedCapQueue.scala
Created August 25, 2017 09:57
FixedCapacityQueue
import scala.reflect.ClassTag
class FixedCapQueue[A: ClassTag](size: Int) {
val queue: Array[A] = new Array(size)
var start: Int = 0
var end: Int = 0
var empty = size > 0
def take(): A = {
if (end == start && empty) throw new Exception("Queue empty")
@dszakallas
dszakallas / my_first_clojure_go_routine.clj
Created October 29, 2017 12:09
clojure.async examples
(ns my-first-clojure-go-routine
(:require [clojure.core.async :refer :all]))
(defn ping [name chan & [start?]]
(go (when start? (>! chan 0))
(loop [i (<! chan)]
(println name i)
(>! chan (inc i))
(if (< i 100) (recur (<! chan)) i))))
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dszakallas
dszakallas / keybase.md
Created June 25, 2022 09:34
keybase.md

Keybase proof

I hereby claim:

  • I am dszakallas on github.
  • I am david_szakallas (https://keybase.io/david_szakallas) on keybase.
  • I have a public key whose fingerprint is 38F9 8FCE 7CED FA3C 04D9 B6FE 9E63 257F 2A73 97BB

To claim this, I am signing this object:

@dszakallas
dszakallas / a
Created November 10, 2023 08:37
a