“Paper late!” cried a voice in the crowd,
“Old man dies!” The note he left was signed,
‘Old Kiczales’ - it seems he’s drowned!
| (defpackage #:snippets/inheritance-graph | |
| (:use #:cl) | |
| (:import-from #:sb-mop | |
| #:class-direct-subclasses)) | |
| (in-package #:snippets/inheritance-graph) | |
| (defstruct digraph | |
| (strict-p t) | |
| (name "unnamed") |
RUTILS is split into two parts: core (package rutils) and contrib (package rutilsx). These are aggregate packages that just re-export the symbols that are provided by the specific packages like rutils.anaphora or rutils.list. Overall, there are 17 parts of the core, which are described, in more detail, in this tutorial. They include (with some changes and additions) 3 facilities, which are also available from separate libraries: SPLIT-SEQUENCE, ITERATE, and ANAPHORA. Besides, it defines 2 lightweight wrapper data structures: pair and hash-set.
There's also the package rtl that includes the core plus short names for a lot of basic Lisp operations.
Contrib holds "experimental" stuff (in the sense that it's not totally conventional even for me) that, gradually, migrates to core. I won't talk more about it in the tutorial: those who are interested can check on their own or ask questions.
| #include <gdnative_api_struct.gen.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ecl/ecl.h> | |
| /*************/ | |
| /* Setup ecl */ | |
| /*************/ |
| #| | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; CFFI LZMA Wrapper | |
| ;; © Michał "phoe" Herda 2017 | |
| ;; public domain | |
| ;; Use the attached lzma.so file, which is a x64 Linux shared | |
| ;; object. To compile the shared library file yourself: | |
| ;; 1. Install the official LZMA SDK from Igor Pavlov. |
| listen l1 | |
| bind 0.0.0.0:443 | |
| mode tcp | |
| timeout connect 4000 | |
| timeout client 180000 | |
| timeout server 180000 | |
| server srv1 host.example.com:9443 |
| // note: -D_7ZIP_ST is required when compiling on non-Windows platforms | |
| // g++ -o lzma_sample -std=c++14 -D_7ZIP_ST lzma_sample.cpp LzmaDec.c LzmaEnc.c LzFind.c | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| #include <memory> | |
| #include "LzmaEnc.h" | |
| #include "LzmaDec.h" |
| (defun normal-random (mean std-dev) | |
| "Normal random numbers, with the given mean & standard deviation." | |
| (do* ((rand-u (* 2 (- 0.5 (random 1.0))) (* 2 (- 0.5 (random 1.0)))) | |
| (rand-v (* 2 (- 0.5 (random 1.0))) (* 2 (- 0.5 (random 1.0)))) | |
| (rand-s (+ (* rand-u rand-u) (* rand-v rand-v)) | |
| (+ (* rand-u rand-u) (* rand-v rand-v)))) | |
| ((not (or (= 0 rand-s) (>= rand-s 1))) | |
| (+ mean | |
| (* std-dev | |
| (* rand-u (sqrt (/ (* -2.0 (log rand-s)) rand-s)))))))) |
| On why stateful code is bad | |
| =========================== | |
| STUDENT: Sir, can I ask a question? | |
| TEACHER: Yes! | |
| STUDENT: How do you put an elephant inside a fridge? | |
| TEACHER: I don't know. | |
| STUDENT: It's easy, you just open the fridge and put it in. I have another question! | |
| TEACHER: Ok, ask. | |
| STUDENT: How to put a donkey inside the fridge? |