Skip to content

Instantly share code, notes, and snippets.

View ympbyc's full-sized avatar
💭
Lisping in the mountains.

Minori Yamashita ympbyc

💭
Lisping in the mountains.
View GitHub Profile
@ympbyc
ympbyc / slime-external-timeout.el
Last active March 13, 2019 18:03
Every n seconds check if slime repl is actively updated. if not, interrupt and call a restart that gives up on current operation that's causing the hangup e.g. sockets
;; every 60 seconds check if slime repl buffer has been updated
;; if not intterupt and call restart-1
;; which should abort whatever is causing the hungup and continues
(defvar *slime-repl-last-output* "")
(defvar *slime-repl-watchdog-timer* nil)
(defun handle-sldb-restart ()
(sldb-invoke-restart-1) ;; change here
(message "Invoked restart-1 upon detecting a hungup."))
@ympbyc
ympbyc / .TalkingLisps.md
Last active February 19, 2019 18:12
Talking REPL. Experimental interaction of different Lisp implementations. In this case CL, elisp and Scheme.

Talking Lisps

My lisp terminal

This is a sketch illustrating dynamic interactions between three different implementations of Lisp.
Common Lisp, Emacs Lisp, and an very old Scheme are engaged in a conversation and producing a very crude talking REPL.

It's by no means complete nor useful at this point but it's a good starting point.

@ympbyc
ympbyc / selection-restart.lisp
Last active January 10, 2019 12:52
Use restart mechanism to let user select from options.
(define-condition selection-required (simple-error)
((message :initarg :message :reader message))
(:report (lambda (c s) (format s "Selection required: ~A" (message c)))))
(defmacro selection-restarts (options message)
"Generates restart-case from given list of options. Useful for interactive selection."
(let ((x (gensym))
(rpt (gensym))
(i (gensym))
(name (gensym)))
@ympbyc
ympbyc / cepl-sdfs.lisp
Last active January 17, 2019 13:35
Easily composable signed distance functions for CEPL. Mostly untested.
(defpackage :distance-fns
(:use :cl :cepl :rtg-math :vari)
(:nicknames :df))
(in-package :df)
(defun-g rand ((co :vec2))
(fract (* (sin (dot co (v! 12.98 78.23))) 43758.54)))
@ympbyc
ympbyc / mirai-emacs-init.lisp
Created December 10, 2018 09:21
Archiving a historic piece of code. .emacs that allows emacs to interface with Mirai.
;; Original file can be found here: https://web.archive.org/web/20030317235658/http://www.snowcrest.net:80/dpriest/x.emacs
;; to start type alt-0 alt-x, then (hi-i:say-hi) at the prompt
;;(setq load-path (append load-path (list "x:/mirai-1-1/eli")))
(setq load-path (append load-path (list "d:/mirai-1-1/eli")))
(load "fi-site-init")
(setf fi::common-lisp-first-time nil)
"use strict";
document.addEventListener("DOMContentLoaded", function () {
var mainEl = document.getElementById("main");
//add page unique class to #main
mainEl.classList.add("page-" + location.href.split(/\/|\#|\?\&/)[3].replace("-copy", ""));
if (mainEl.classList.contains("page-architecture")) setTimeout(tagcloud, 100);
function qs (x) { return document.querySelector(x); }
document.addEventListener("DOMContentLoaded", ()=>{
var mainEl = document.getElementById("main");
//add page unique class to #main
var slug = location.href.split(/\/|\#|\?\&/)[3];
mainEl.classList.add("page-" + (slug || "ambientdesigns").replace("-copy", ""));
if (mainEl.classList.contains("page-architecture"))
(use srfi-1)
(define (mlf-symbol sym)
(string->symbol (string-append "$" (symbol->string sym))))
(define (compile expr)
(cond
[(number? expr) expr]
[(string? expr) (string-append "\"" expr "\"")]
[(symbol? expr) (mlf-symbol expr)]
@ympbyc
ympbyc / crazy-macro.lisp
Last active April 4, 2017 18:00
Carrot3 idea #1. Caller transforming macro rough sketch.
;;Strip down the core language to its bones and provide a really powerful macro facility.
;;Just skim over. Don't read carefully.
;;It's just an idea. I'm not happy with this yet.
;; Macros with ability to scan and transform callers of a function
(defmacro (deflazy fname . rest)
(let ((expr (last rest))
(params (butlast rest)))
`(= ,fname ,@params
@ympbyc
ympbyc / ctyp-323-cljs-memo.md
Last active January 23, 2017 23:35
Getting started with Typed Clojure's cljs checker!