Skip to content

Instantly share code, notes, and snippets.

View sritchie's full-sized avatar

Sam Ritchie sritchie

View GitHub Profile
;; # Evolving Foucault's Pendulum
^{:nextjournal.clerk/visibility {:code :hide}}
(ns examples.simulation.foucault
:exclude [+ - * / = zero? compare numerator denominator
ref partial infinite? abs run!])
(:require [emmy.env :as e :refer :all :exclude [phi]]
[emmy.clerk :as ec]
[emmy.viewer :as ev]
;; Composing viewers!
;; - something like clerk/sync
;; - take requires from namespace form and set up corresponding SCI namespace
(defn func [x]
(if (= x 3)
sritchie / algebra.swift
Created June 9, 2014 02:57
Typeclasses in Swift
// Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
// Here's take 1. First, I defined the algebra like I would in
// Scala, as separate protocols:
protocol Semigroup {
typealias T
(ns examples.simulation.toroid
:exclude [+ - * / = zero? compare
numerator denominator ref partial
infinite? abs])
(:require [emmy.env :as e :refer :all]
[emmy.expression.compile :as xc]
[nextjournal.clerk :as clerk]
[examples.manifold.pq-knot :as pq]))
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<description>A port of the scmutils computer algebra/mechanics system to Clojure.</description>
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8" />
<title>MathLive Basic Example</title>
body {
color: #444;
background-color: #f9f9f9;
(ns demo.bench
(:require [sci.core :as sci]))
(def sci-context
{:classes {'Math js/Math}}))
(defn sci-eval [f-form]
(sci/eval-form (sci/fork sci-context) f-form))
🌐 Establishing connection…
🗂 Fetching git repository
⏬ Downloading deps
Checking out: at f18afd7e6165748765ea43c23604cc1965f20e35
Downloading: reagent/reagent/1.1.1/reagent-1.1.1.pom from clojars
Downloading: thheller/shadow-cljs/2.20.7/shadow-cljs-2.20.7.pom from clojars
Checking out: at 1aaedea7709611cbb393add4c85c7a2dd551260e
(def ^{:doc "Docstring."}
(fn [props ref]
(let [[mf set-mf] (react/useState nil)
{:strs [children value options defaultValue onChange
soundsDirectory fontsDirectory] :as props}
(js->clj props)]
# bash_completion - programmable completion functions for bash 3.x
# (backwards compatible with bash 2.05b)
# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
# Copyright (C) Ian Macdonald <>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)