Skip to content

Instantly share code, notes, and snippets.

View jjsullivan5196's full-sized avatar
🍉
free

John Sullivan jjsullivan5196

🍉
free
View GitHub Profile
;; Okasaki's red-black insert in guile scheme
;; https://www.cs.tufts.edu/comp/150FP/archive/chris-okasaki/redblack99.pdf
(use-modules (ice-9 match) ;; pattern matching
(srfi srfi-1) ;; functional procedures
(srfi srfi-9) ;; records
(srfi srfi-9 gnu)) ;; record extensions
(define-immutable-record-type <rb-node>
(make-rb-node color value left right)
@jjsullivan5196
jjsullivan5196 / async_iterators.cljs
Last active March 18, 2020 19:20
JavaScript async iterators in core.async
(ns async-iterators
"Functions and procedures for using JavaScript `AsyncIterable`s with
`core.async`. Find out more about async iteration at
https://github.com/tc39/proposal-async-iteration and
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
Kudos to @paul931224 on clojurians for trying this out w/me."
(:require [cljs.core.async :as async :refer [go >! close!]]))
(defn get-iterator
"Create an async iterator object from `iterable`. `iterable` must have a method
@jjsullivan5196
jjsullivan5196 / integer_range.h
Created March 16, 2018 21:15
Generate an integer_sequence by range
#pragma once
#include <utility>
#include <array>
namespace ext {
/* Generate a compile-time sequence of Integers from Start to End
*
* typename IntegralType : the type of the sequence
* End: end of the sequence
* Start(0): beginning of the sequence