Skip to content

Instantly share code, notes, and snippets.

@spacebat
spacebat / critter.lisp
Created April 27, 2016 04:31
CLOS append method combination example
;; An example of append method combination to form a projection of an object's slots
(defclass odour-mixin ()
((odour :initarg :odour :initform nil :reader odour)))
(defclass colour-mixin ()
((colour :initarg :colour :initform nil :reader colour)))
(defclass sound-mixin ()
((sound :initarg :sound :initform nil :reader sound)))
@nikodemus
nikodemus / bt.lisp
Last active July 14, 2022 05:46
Showing why conditions are a bad match for doing backtracking -- all you need is CATCH/THROW and a special variable.
;;;; In response to:
;;;;
;;;; http://www.reddit.com/r/lisp/comments/3710zq/directed_procrastination_backtracking_with_the/
;;;; http://directed-procrastination.blogspot.se/2011/05/backtracking-with-common-lisp-condition.html
;;;;
;;;; Demonstrating why one should not use conditions for this kind of stuff,
;;;; instead using the dynamic binding and unwinding facilities on which the
;;;; condition system is built. The author's backtracking system doesn't compare
;;;; badly to Screamer because his is simple: it compares badly because using
;;;; conditions is a bad match for the task.
@debasishg
debasishg / gist:8172796
Last active July 5, 2024 11:53
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@owainlewis
owainlewis / Treap.hs
Created December 11, 2013 22:07
Treap in Haskell
import Control.Monad
import Data.Char
import qualified Data.List.Key as K
import System.Random
data Treap k a = Nil | Node Int k a (Treap k a) (Treap k a)
priority :: Treap k a -> Int
priority Nil = -1
priority (Node p _ _ _ _) = p
Where to Live (Du Fu)
West of the Flower Washing Stream,
not far downstream from the bridge,
the master has chosen a quiet spot
here in the woods by the river.
Living apart from the city crowds,
the world loosens its grip;
murmuring of this clear water dissolves
@sshirokov
sshirokov / fsm.lisp
Created May 14, 2012 23:51
CLOS FSM with MOP Sauce (requires :closer-mop)
(defpackage :fsm
(:use :cl)
(:export :standard-state-machine
:standard-state-machine-event
:state
:defstate
:deffsm))
(in-package :fsm)
;; Basic copy-pasta protection