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
(* | |
CM.make "$/regexp-lib.cm"; | |
*) | |
val getc: string -> (char, int) StringCvt.reader = | |
fn s => fn i => | |
if (i < String.size s) | |
then SOME(String.sub(s, i), i+1) | |
else NONE |
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
- val tree = Node("a",Node("b",Leaf,Leaf),Node("c",Leaf,Leaf)); | |
val tree = Node ("a",Node ("b",Leaf,Leaf),Node ("c",Leaf,Leaf)) : string tree | |
- printTree tree; | |
a | |
/ \ | |
b c | |
val it = () : unit | |
- val tree' = Node("x",Node("y",Leaf,Leaf),Node("z",Node("q",Leaf,Leaf),Node("w",Leaf,Leaf))); |
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
- printTree t; | |
a | |
/ \ | |
b c | |
/ \ / \ | |
d e x y | |
/ \ | |
q w | |
val it = () : unit |
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
(require 'org-publish) | |
(setq org-publish-project-alist | |
'(("org-notes" | |
:base-directory "~/scratch/org/" | |
:base-extension "org" | |
:publishing-directory "~/scratch/public_html/" | |
:recursive t | |
:publishing-function org-publish-org-to-html | |
:headline-levels 4 ; Just the default for this project. | |
:auto-preamble 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
(defun deep-rev (list) | |
(if (or (null list) (not (listp list))) list | |
(reverse (mapcar 'deep-rev list)))) |
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 ext (cmd args) | |
(with-temp-buffer | |
(let ((exit (funcall 'call-process cmd nil (current-buffer) nil args))) | |
(cons exit (buffer-substring (point-min) (point-max)))))) |
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
#!/usr/bin/emacs --script | |
(princ (format "batch mode: %s\n" noninteractive)) |
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
utahraptor:~ aki$ rlwrap ocaml | |
Objective Caml version 3.12.1 | |
# #use "topfind";; | |
- : unit = () | |
Findlib has been successfully loaded. Additional directives: | |
#require "package";; to load a package | |
#list;; to list the available packages | |
#camlp4o;; to load camlp4 (standard syntax) | |
#camlp4r;; to load camlp4 (revised syntax) |
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
#lang eopl | |
;(module lang (lib "eopl.ss" "eopl") | |
(require "drscheme-init.scm") | |
(provide (all-defined)) | |
;;;;;;;;;;;;;;;; grammatical specification ;;;;;;;;;;;;;;;; | |
(define the-lexical-spec |
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
type 'a monoid = {zero : 'a; plus : 'a -> 'a -> 'a} | |
let sum (m : 'a monoid) (l : 'a list) : 'a = List.fold_left m.plus m.zero l | |
let string_summer = sum {zero = ""; plus = (^)} | |
let int_summer = sum {zero = 0; plus = (+)} |