Skip to content

Instantly share code, notes, and snippets.

@burtonsamograd
burtonsamograd / save-lisp-tree-shake-and-die.lisp
Last active February 10, 2025 22:32
A quick and dirty tree shaker for SBCL, giving about a 40% reduction in dump size.
;; -*- mode: lisp -*-
;;
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the
;; package system and does a gc before saving the lisp image. Gives
;; about a 40% reduction in image size on a basic hello world test.
;; Would like to hear how it works on larger projects.
;;
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ
;;
;; Burton Samograd
@apskii
apskii / Bounce
Last active August 29, 2015 14:13
Bounce
// run here: http://jsfiddle.net/6mt3ffpe/
module Bounce where
import DOM
import Graphics.Canvas
import Control.Monad.Eff
import Control.Monad.Eff.Ref
import Control.Monad.Trans
import Control.Monad.RWS
# Tabimages plugin for Tkabber
# Written by Renji
# jabber id: [email protected]
# e-mail: [email protected]
namespace eval tabimages {
set space [namespace current]
::msgcat::mcload [file join [file dirname [info script]] msgs]
(defmacro $ (&rest rest) `(funcall ,@rest))
(defstruct builder
combine
bind
return
return-from
yield
yield-from
using
(defmacro monadic (&body statements)
`(let ((m *monad*))
(statements-of (monad m) ,@statements)))
(defun monad-example (ma mb)
(monadic
(get x ma)
(get y mb)
(val z (+ x y))
(ret (list x y z))))
module KV where
open import Data.Nat hiding (_⊔_)
open import Data.Unit
open import Data.List using (List; []; _∷_)
open import Data.Empty
open import Data.Maybe
open import Data.Product
open import Function
open import Relation.Binary.Core
@siguremon
siguremon / split-str.l
Created August 27, 2011 04:38
split string function in common lisp
(defun split-str (string &optional (separator " "))
(split-str-1 string separator))
(defun split-str-1 (string &optional (separator " ") (r nil))
(let ((n (position separator string
:from-end t
:test #'(lambda (x y)
(find y x :test #'string=)))))
(if n
(split-str-1 (subseq string 0 n) separator (cons (subseq string (1+ n)) r))