Skip to content

Instantly share code, notes, and snippets.

(use 'clojure.core.async)
(def output (atom []))
(defn producer [ctrl k]
(go (loop [i 0]
(when-let [c (<! ctrl)]
(>! c [k i])
(>! ctrl c)
(recur (inc i))))))
@erikprice
erikprice / breadth_first.py
Created March 23, 2022 00:22
Illustration of breadth-first search for Hack.Diversity Learning Labs 2022-03-22
#!/usr/bin/env python
class Node:
def __init__(self, value=None, children=None):
self.value = value
self.children = children or []
self.visited = False
def make_graph():
graph = {}
@erikprice
erikprice / depth_first.py
Created March 23, 2022 00:22
Illustration of depth-first search for Hack.Diversity Learning Labs 2022-03-22
#!/usr/bin/env python
class Node:
def __init__(self, value=None, children=None):
self.value = value
self.children = children or []
self.visited = False
def make_graph():
graph = {}