Skip to content

Instantly share code, notes, and snippets.

import java.lang.RuntimeException
import java.util.Arrays
object VariantWorld2 {
class Greet : World.Visitor {
fun visit(subject: Dog, arg: String): String {
return "$arg is greeted"
}
fun visit(subject: Cat, arg: String): String {
@fiddlerwoaroof
fiddlerwoaroof / extend.js
Last active June 13, 2019 17:32
Static typable EP solution
//
// Two kinds of animals: dogs and cats
//
// I want greet and leave to be defined such that there are four
// different behaviors corresponding to each combination of dog and
// cat
//
class Animal {
receive_operation(operation) {
console.log("the animal is unresponsive");
(uiop:define-package :fwoar.zipfile
(:mix :cl :fwoar.lisputils)
(:export ))
(in-package :fwoar.zipfile)
(defun read-bytes (n s)
(with (seq (make-array n :element-type 'serapeum:octet))
(values seq
(read-sequence seq s))))
(ns oop-with-inheritance)
(defn start [arg]
(println "starting: " arg))
(defn stop [sys]
(println "stopping:" sys))
(defn server-system-local [& args]
(apply println "making server system:" args)
(defpackage :fwoar.mc-web
(:use :cl )
(:export ))
(in-package :fwoar.mc-web)
(defclass myway-server (hunchentoot:acceptor)
((%mapper :initform (myway:make-mapper) :reader mapper)))
(defvar *current-route*)
(define-method-combination routing
;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Package: ASDF-USER -*-
(in-package :asdf-user)
(defsystem :my-new-system
:description ""
:author "Ed L <edward@elangley.org>"
:license "MIT"
:depends-on (#:alexandria
#:uiop
#:serapeum
(defpackage :clos-browser
(:use :clim-lisp :clim)
(:export
#:main))
(in-package :clos-browser)
(define-application-frame class-browser ()
((classes :initarg :classes :reader classes)
(visible-classes :initform nil :accessor visible-classes)
(current-class :initform nil :accessor current-class))
@fiddlerwoaroof
fiddlerwoaroof / zipfile.lisp
Last active July 9, 2018 08:25
Simple zipfile decoding
;; Presupposes the binary parser from fwoar.lisputils/bin-parser: https://github.com/fiddlerwoaroof/fwoar.lisputils/blob/master/bin-parser.lisp
(uiop:define-package :fwoar.zipfile
(:mix :cl :fwoar.lisputils :fwoar.bin-parser)
(:export ))
(in-package :fwoar.zipfile)
(defparameter *zip-local-file-header*
'((signature 4) (version 2) (flags 2) (compression 2 le->int) (mod-time 2) (mod-date 2) (crc-32 4)
(compressed-size 4 le->int)
@fiddlerwoaroof
fiddlerwoaroof / demo.hs
Created February 27, 2018 00:44
Unit-testing IO in Haskell
module Main where
import Data.IORef
import Data.Time.Clock.POSIX
realIoUnderTest :: IORef Int -> IORef [[Char]] -> IORef Int -> IORef String -> IO ()
realIoUnderTest a b c d = do
b' <- readIORef b
putStrLn $ Prelude.unlines b'

Keybase proof

I hereby claim:

  • I am fiddlerwoaroof on github.
  • I am fiddlerwoaroof (https://keybase.io/fiddlerwoaroof) on keybase.
  • I have a public key ASAjpoHMAvokBJ0hUrLDdCiYI9w63MumLlgXyWQvTYLOdwo

To claim this, I am signing this object: