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
;; -*- mode: Lisp; lexical-binding: t; -*- | |
;; ---------------------------------------------------------------------- | |
;; HELPER FUNCTIONS | |
;; ---------------------------------------------------------------------- | |
(defvar electrify-return-match | |
"[\]}\)\"]" | |
"If this regexp matches the text after the cursor, do an \"electric\" | |
return.") |
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
static Assembly ResolveAssembly(object sender, ResolveEventArgs args) | |
{ | |
var name = args.Name.Split(',').FirstOrDefault(); | |
if (String.IsNullOrEmpty(name) || name.EndsWith(".resources")) return null; | |
name = name.Replace('.', '_'); | |
var data = (byte[])Properties.Resources.ResourceManager.GetObject(name); | |
return (data == null) ? null : Assembly.Load(data); | |
} |
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
public static void load(String relativePath) | |
{ | |
bool loadAsResource = EmbeddedAssembly(relativePath); | |
load(relativePath, true, loadAsResource); | |
} | |
private static bool EmbeddedAssembly(String relativePath) | |
{ | |
return (ResourceData(ResourceName(relativePath)) != null); | |
} |
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/g! nif (expr pos zero neg) | |
`(let ((,g!result ,expr)) | |
(cond ((plusp ,g!result) ,pos) | |
((zerop ,g!result) ,zero) | |
(t ,neg)))) |
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
(macroexpand | |
'(nif (random 100) 'positive 'zero 'negative)) | |
;; Expands to: | |
(LET ((#:RESULT3117 (RANDOM 100))) (COND ((PLUSP #:RESULT3117) 'LET-OVER-LAMBDA.G!.EXAMPLES::POSITIVE) ((ZEROP #:RESULT3117) 'LET-OVER-LAMBDA.G!.EXAMPLES::ZERO) (T 'LET-OVER-LAMBDA.G!.EXAMPLES::NEGATIVE))) | |
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 nif [expr pos zero neg] | |
`(let [~res# ~expr] | |
(cond (> ~res# 0) ~pos | |
(= ~res# 0) ~zero | |
:else ~neg))) |
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
;; -*- mode: Lisp; lexical-binding: t; -*- | |
(defun global-set-umlaut-keys () | |
(let ((gen-insert-key | |
(lambda (key) | |
(lambda () | |
(interactive) | |
(ucs-insert key))))) | |
(global-set-key (kbd "\C-co") (funcall gen-insert-key #xf6)) | |
(global-set-key (kbd "\C-cu") (funcall gen-insert-key #xfc)) |
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
(princ "Hello world!") | |
(terpri) | |
(quit) |
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
(ext:install-c-compiler) | |
(compile-file "hello.lisp" :system-p 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
(c:build-program "binary" :lisp-files '("hello.obj")) |