This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Sqlite3 | |
module ExtList = struct | |
include List | |
let iteri f list = | |
let rec iteri f n = function | |
| [] -> () | |
| x::xs -> f n x; iteri f (n+1) xs | |
in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun f () :foo) | |
(defun g () (funcall #'f)) | |
(setf (symbol-function 'f) (lambda () :bar)) | |
(g) ; => :FOO or :BAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CCL_HOME="$HOME/opt/ccl" | |
OS="$(uname -s)" | |
MARCH="$(uname -m)" | |
if [ "$OS" = Linux ]; then | |
if [ "$MARCH" = x86_64 ]; then | |
bin=lx86cl64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :cl-user) | |
(declaim (optimize (speed 3))) | |
(defconstant n 1000000) | |
(defconstant m 10000) | |
;; Use alexandria:define-constant if you have a problem | |
(defconstant enum-const (loop repeat 1000 collect (random m))) | |
(defvar enum-var enum-const) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module OList = struct | |
type 'a recv = { | |
send : 'b. < | |
iter : ('a -> unit) -> unit; | |
map : ('a -> 'b) -> 'b recv | |
> | |
} | |
type 'a t = 'a recv | |
let rec of_list : 'a. 'a list -> 'a t = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Camlp4 | |
open PreCast | |
open Ast | |
open Pa_type_conv | |
let pp_ctyp = | |
let module PP = Camlp4.Printers.OCaml.Make (Syntax) in | |
let pp = new PP.printer () in pp#ctyp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ksprintf f fmt = | |
let buf = Buffer.create 16 in | |
Format.kfprintf | |
(fun ppf -> | |
Format.pp_print_flush ppf (); | |
f (Buffer.contents buf)) | |
(Format.formatter_of_buffer buf) | |
fmt | |
let () = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun anything-kill-buffers () | |
"Preconfigured `anything' to kill buffer you selected." | |
(interactive) | |
(anything | |
'(((name . "Kill Buffers") | |
(type . buffer) | |
(candidates . anything-c-buffer-list) | |
(action | |
("Kill Buffer" . (lambda (candidate) | |
(kill-buffer candidate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro with-open-file-atomically-1 ((var filename . args) &body body) | |
(alexandria:once-only (filename) | |
(alexandria:with-gensyms (tempfile stream done) | |
`(let ((,tempfile (merge-pathnames ".tem" ,filename)) ,stream ,done) | |
(unwind-protect | |
(multiple-value-prog1 | |
(let ((,var (setq ,stream (open ,tempfile :if-exists :error ,@args)))) | |
,@body) | |
(setq ,done t)) | |
(when ,stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-package :cl-user) | |
#+(or sbcl openmcl) | |
(progn | |
(declaim (optimize (debug 3))) | |
(when (find-package :quicklisp) | |
(defun :qa (&rest args) | |
(apply (find-symbol "SYSTEM-APROPOS" :ql) args)) |