Skip to content

Instantly share code, notes, and snippets.

@aamedina
aamedina / cover.lisp
Last active December 25, 2018 15:15
The COVER system: Determining the Coverage of a Test Suite
;-*-syntax:COMMON-LISP; Mode: LISP-*-
;This is the September 15, 1991 version of
;the on-line documentation for Richard Waters' test case coverage checker.
;; The COVER system: Determining the Coverage of a Test Suite
;; Richard C. Waters
;; MIT AI Laboratory
@aamedina
aamedina / defsys-example.clj
Last active August 4, 2019 18:12
a simple pattern for data-driven reloadable systems with Clojure
;;; deps.edn
{:deps
{org.clojure/clojure {:mvn/version "1.10.0-beta7"}
;; this version is required for clojure.tools.deps.alpha.repl/add-lib
org.clojure/tools.deps.alpha {:git/url "https://github.com/clojure/tools.deps.alpha.git"
:sha "f6c080bd0049211021ea59e516d1785b08302515"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
com.walmartlabs/schematic {:mvn/version "1.1.0"}
reloaded.repl {:mvn/version "0.2.4"}
;;---------------------------------------------------------------------
;;
;; examples/capi/applications/maze.lisp
;;
;; This example creates a 3d maze game.
;;
;; To try it, compile and load this file and then execute:
;;
;; (CL-USER::MAZE)
;;
@aamedina
aamedina / deps.edn
Last active October 18, 2018 13:18
Clojure LWJGL3 deps.edn with latest tools.deps.alpha with support for Vulkan RT extensions
{:deps
{org.clojure/clojure {:mvn/version "1.10.0-beta3"}
org.clojure/tools.deps.alpha {:mvn/version "0.5.460"}
org.clojure/data.xml {:mvn/version "0.2.0-alpha5"}
org.clojure/data.json {:mvn/version "0.2.6"}
org.lwjgl/lwjgl {:mvn/version "3.2.1-SNAPSHOT"
:classifier [""
"natives-linux"
"natives-macos"
"natives-windows"]}
#!/bin/bash -e
frame=`emacsclient -a "" -e "(member \"$DISPLAY\" (mapcar 'terminal-name (frames-on-display-list)))"`
if [ "$frame" == "nil" ]
then
exec emacsclient -c -n -a "" "$@"
fi
if [ "$frame" == "(\"$DISPLAY\")" ]
(defvar *local-type-declarations* '())
(defmacro local-type-declare (declarations &body forms)
`(compiler-let ((*local-type-declarations*
(append ',declarations *local-type-declarations*)))
,@forms))
(defmacro typed-var (var)
(let ((type (assoc var *local-type-declarations*)))
(if type `(the ,(cadr type) ,var) var)))
@aamedina
aamedina / defrecord.clj
Last active January 13, 2017 19:41
deftype/defrecord Object usage
(defrecord A []
Object
(toString [x] "A")
(myMethod [this])
(myMethod2 [this x y]))
@aamedina
aamedina / triangle.clj
Last active October 31, 2023 02:26
Drawing a Triangle with Vulkan in Clojure
;; Based on the 01_InitRaytracing.cpp example from VkRayTutorials
;; Copyright (c) 2018 Adrian Medina
(ns vk.ray.tutorials.init-raytracing
(:gen-class)
(:require
[vk.ray.tutorials.util :as util])
(:import
(java.nio ByteBuffer FloatBuffer IntBuffer LongBuffer)
(org.lwjgl PointerBuffer)
(ns clojurecast.actions
(:require [clojure.pprint :as pp]
[clojure.string :as str]
[clojure.tools.logging :as log]
[com.stuartsierra.dependency :as dep]))
(def ^:dynamic *action-lists*
(ref {}))
(def ^:dynamic *handle-existing-action-list*
@aamedina
aamedina / service.clj
Last active March 27, 2016 20:02
WIP Service protocol
(ns clojurecast.service)
(defprotocol Service
(start-service [service]
"Starts the local service. Returns an updated service record.")
(stop-service [service]
"Stops the local service. Returns an updated service record.")
(service-defaults [service]
"Returns a map with the default configuration for this service.")
(service-state [service]