This file contains hidden or 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 get () = | |
| shift (fun k -> fun s -> k s s) | |
| ;; | |
| let modify f = | |
| shift (fun k -> fun s -> k () (f s)) | |
| ;; | |
| let run_state f s = | |
| reset |
This file contains hidden or 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
| (when (require 'paredit nil t) | |
| (dolist (map (list lisp-mode-map emacs-lisp-mode-map)) | |
| (define-key map (kbd "M-(") 'paredit-wrap-round) | |
| (define-key map (kbd "C-M-f") 'paredit-forward) | |
| (define-key map (kbd "C-M-b") 'paredit-backward) | |
| (define-key map (kbd "C-)") 'paredit-forward-slurp-sexp) | |
| (define-key map (kbd "C-M-)") 'paredit-forward-barf-sexp) | |
| (define-key map (kbd "C-(") 'paredit-backward-slurp-sexp) | |
| (define-key map (kbd "C-M-(") 'paredit-backward-barf-sexp) | |
| (define-key map (kbd "M-s s") 'paredit-split-sexp) |
This file contains hidden or 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
| (when (require 'autopair nil t) | |
| (setq autopair-autowrap 'sexp | |
| autopair-skip-whitespace 'chomp | |
| autopair-blink nil) | |
| (autopair-global-mode t) | |
| (when (boundp 'ac-modes) | |
| ;; reuse ac-modes to decide what buffers should use autopair-mode | |
| (setq-default autopair-dont-activate | |
| (lambda () (not (memq major-mode ac-modes)))))) |
This file contains hidden or 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)) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) |