This file contains hidden or 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
| // Very Tiny Language T. Nakagawa 2004/05/23 2004/06/26 | |
| #include <uart.h> | |
| #include <avr/io.h> | |
| #define F_CPU 16000000UL // define the clock frequency as 16MHz | |
| #define BAUD 115200*2 | |
| #include <util/setbaud.h> // Set up the Uart baud rate generator |
This file contains hidden or 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
| (defn update-keys-naive | |
| "m f => {(f k) v ...} | |
| Given a map m and a function f of 1-argument, returns a new map whose | |
| keys are the result of applying f to the keys of m, mapped to the | |
| corresponding values of m. | |
| f must return a unique key for each key of m." | |
| {:added "1.11"} | |
| [m f] | |
| (let [ret (with-meta |
This file contains hidden or 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
| (ns ded | |
| "Structural Data EDitor for Clojure with zippers. Inspired by Interlisp: http://larry.masinter.net/interlisp-ieee.pdf" | |
| (:require [clojure.zip :as z]) | |
| (:use [clojure.pprint :only (with-pprint-dispatch code-dispatch pprint)] | |
| [clojure.repl :only (source-fn)])) | |
| (defn print-hr | |
| "Prints 30 dashes and a newline." | |
| [c] | |
| (println (apply str (repeat 30 c)))) |
This file contains hidden or 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
| (deflinked abclink [a b c]) | |
| ;; expands to | |
| (defn abclink [params] | |
| (let [[to] (when-let [t (:to params)] (clojure.tools.build.api/qualify-fn-symbols [t]))] | |
| (loop [parms params | |
| remaining-tasks [build/a build/b build/c]] | |
| (let [task (first remaining-tasks)] | |
| (if task |
This file contains hidden or 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
| <canvas id="c" width="1024" height="1024"> | |
| <script> | |
| // https://js.do | |
| const context = c.getContext('2d'); | |
| for (let x = 0; x < 256; x++) { | |
| for (let y = 0; y < 256; y++) { | |
| if ((x ^ y) % 9) { | |
| context.fillRect(x*4, y*4, 4, 4); | |
| } | |
| } |
This file contains hidden or 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
| (ns com.manigfeald.http2.cont) | |
| (defn bind% [m f] | |
| (fn [kont bundle] | |
| (m (fn [value] ((f value) kont bundle)) bundle))) | |
| (defmacro return% [value] | |
| `(fn [kont# bundle#] | |
| ((try | |
| (let [v# ~value] |
This file contains hidden or 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
| (comment | |
| ;; original emit on RHS of map destructure form | |
| (if (seq? kvs) | |
| (clojure.lang.PersistentHashMap/create (seq kvs)) | |
| kvs) | |
| ) | |
| (defn create-bl [& kvs] | |
| ;; replacement code for RHS of map destructure form |
This file contains hidden or 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
| (defn add [& {:keys [:a :b]}] | |
| (+ a b)) | |
| (add :a 1 :b 2) | |
| ;;=> 3 | |
| (add :a) | |
| ;;= No value supplied for key: :a | |
| (add {:a 1 :b 2}) |
This file contains hidden or 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
| ;; Basis | |
| (fn [& {:keys [a b]}] (+ a b)) | |
| ;; gen param lists approach | |
| (defn param-gen-style | |
| ([a-map] | |
| (let [{:keys [a b]} a-map] |
This file contains hidden or 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
| /******************************************************************************* | |
| * | |
| * A minimal Forth compiler in C | |
| * By Leif Bruder <[email protected]> http://defineanswer42.wordpress.com | |
| * Release 2014-04-04 | |
| * | |
| * Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial | |
| * | |
| * PUBLIC DOMAIN | |
| * |