Skip to content

Instantly share code, notes, and snippets.

;; differences from scheme unfold
;; even initial value is lazy
;; predicate sense reversed
;; internal state == produced value, no special mapper-fn
;; no tail-gen
(defn series
"Produces a sequence of values.
`f` is a function that given a value, returns the next value.
`continue?` is a predicate that determines whether to produce
@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)
@michiakig
michiakig / three.cljs
Created August 19, 2011 20:53
three.js demo in ClojureScript
(ns three.demo)
(def camera (THREE.Camera. 75 (/ window/innerWidth
window/innerHeight) 1 10000))
(set! (.z (.position camera)) 1000)
(def scene (THREE.Scene.))
(def geometry (THREE.CubeGeometry. 200 200 200))
(def obj (js/Object.))
(set! (.color obj) 0xff0000)
(set! (.wireframe obj) true)
(def material (THREE.MeshBasicMaterial. obj))