Skip to content

Instantly share code, notes, and snippets.

: fizz? ( n -- ? )
3 mod 0 = ;
: buzz? ( n -- ? )
5 mod 0 = ;
: fizzbuzz? ( n -- ? )
(asdf:oos 'asdf:load-op :contextl)
(in-package :contextl-user)
(defclass grouped-layer (standard-layer-class) ())
(defgeneric group-root (layer))
(defgeneric default-layer (layer))
(define-layered-method adjoin-layer-using-class
@et4te
et4te / gist:1063831
Created July 4, 2011 19:34
Reference
;;
;;(in-package :3d-engine)
(in-package :cl-user)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INIT
;;(pushnew "/home/malune/.sbcl/systems/" asdf:*central-registry*)
;;
(asdf:operate 'asdf:load-op :cl-glut)
(asdf:operate 'asdf:load-op :split-sequence)
@et4te
et4te / example.factor
Created July 3, 2011 08:09
example factor
USING: assocs byte-arrays.hex io io.binary io.encodings.binary
io.sockets kernel sequences ;
IN: riak
! ----------------------------------------------------------------------------
CONSTANT: rpb-ping-req HEX{ 00 00 00 01 01 }
: decode-ping-response ( -- n )
0 ;
@et4te
et4te / riak.factor
Created July 2, 2011 17:21
Bit too easy to do in this lang...
USING: io io.encodings.binary io.sockets byte-arrays.hex ;
IN: riak
! ----------------------------------------------------------------------------
CONSTANT: rpb-ping-req HEX{ 00 00 00 01 01 }
CONSTANT: rpb-ping-resp HEX{ 00 00 00 01 02 }
CONSTANT: rpb-get-client-id-req HEX{ 00 00 00 01 03 }
CONSTANT: rpb-get-client-id-resp HEX{ 00 00 00 07 04 0A 04 01 65 01 B5 }
: request ( req -- resp )
@et4te
et4te / csv.factor
Created July 2, 2011 16:09
lol-concise
USING: csv grouping io io.encodings.utf8 io.files namespaces sequences
;
IN: csv-test
! ---------------------------------------------------------------------------
: sample-data ( data -- )
utf8 file-lines 4 group output-stream get write-csv ;
@et4te
et4te / dependent-typed.lisp
Created June 18, 2011 17:36
Dependent typing in common lisp
;;--------------------------------------------------------------------
;;-- Types
;; slot-number type
(defun within-slot-number-rangep (n)
(not (or (< n 0) (> n 255))))
(deftype slot-number ()
`(and fixnum (satisfies within-slot-number-rangep)))
@et4te
et4te / gist:1021681
Created June 12, 2011 15:39
happy days
etate@etate-K61IC:~/snap-extension-riak-example$ mkdir config
etate@etate-K61IC:~/snap-extension-riak-example$ touch config/site-key.txt
etate@etate-K61IC:~/snap-extension-riak-example$ snap-extension-riak-example -p 8080
Initializing Heist/Impl... done.
Initializing Session/CookieSession... done.
Initializing Riak/Riak... done.
Initializing Timer/Timer... done.
Listening on http://0.0.0.0:8080/
{-# LANGUAGE OverloadedStrings #-}
module MapReduce (
queryGetMany
, queryGetBucket
, queryAuthUsers
, queryAuthPToken
) where
import Data.Aeson
import Data.Aeson.Types
;;-- abstract state machine model
;; types
defclass state
defclass input
def transition (state input)
documentation: "Transition from a state to another state"
defmacro defstate { ?:name } =>