This file contains 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
(defun pb/shift-expression (delta) | |
(setq evil-shift-width 1) | |
(let ((p (point))) | |
(evil-shift-right (if (< delta 0) (- p 1) p) | |
(save-excursion (evil-jump-item)) | |
delta nil) | |
(goto-char (+ delta p)))) | |
(defun pb/shift-expression-right () | |
(interactive) |
This file contains 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
(require 'clj-http.client) | |
(def DURATION 10) | |
(def tics (atom 1)) | |
(def responses (atom [])) | |
(def start (System/currentTimeMillis)) |
This file contains 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
(require 'clj-http.client) | |
(def DURATION 10) | |
(def tics (atom [])) | |
(def start (System/currentTimeMillis)) |
This file contains 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
I'm wondering if a lisp can have only quasiquote and no regular quote. What would be the downsides ? (sorry if this message appears for the second time, I can't tell if it was posted or not) | |
beach | |
Do you mean "no reader macro '", or "no special operator QUOTE"? | |
_death | |
`(foo ',bar).. you don't need either of course, (list (quote foo) (list (quote quote) bar)) | |
beach | |
I think the former is definitely possible. Not so much the latter. |
This file contains 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 xp.rec) | |
(do :chapter1 | |
;; clojure | |
(defn f [x] | |
(if (zero? x) x (f (dec x)))) | |
;; without recursion | |
(def f1 |
This file contains 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
{ | |
"Blackhaw Viburnum": "https://caseytrees.org/wp-content/uploads/2017/01/primary_blackhaw_viburnum-293x172-c-default.jpg", | |
"Crape Myrtle": "https://caseytrees.org/wp-content/uploads/2017/01/primary_crepe_myrtle-293x172-c-default.jpg", | |
"Cryptomeria": "https://caseytrees.org/wp-content/uploads/2019/07/primary_cryptomeria-293x172-c-default.png", | |
"American Hornbeam": "https://caseytrees.org/wp-content/uploads/2017/01/primary_american_hornbeam-293x172-c-default.jpg", | |
"Nuttall Oak": "https://caseytrees.org/wp-content/uploads/2017/01/primary_nuttall_oak-293x172-c-default.jpg", | |
"Overcup Oak": "https://caseytrees.org/wp-content/uploads/2017/01/primary_overcup_oak-293x172-c-default.jpg", | |
"Loblolly Pine": "https://caseytrees.org/wp-content/uploads/2017/01/primary_loblolly_pine-293x172-c-default.jpg", | |
"Pawpaw": "https://caseytrees.org/wp-content/uploads/2017/01/primary_pawpaw-293x172-c-default.jpg", | |
"Bald Cypress": "https://caseytrees.org/wp-content/uploads/2017/01/primary_baldcypress-293x172-c-default |
This file contains 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 clj-to-md | |
(:require [clojure.string :as str])) | |
;; a very crude way to turn a commented clojure file into a markdown file | |
(defn blocks [s] | |
(str/split s #"\n\n")) | |
(defn lines [s] | |
(str/split s #"\n")) |
This file contains 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 cloroutine.conts | |
(:require [clojure.test :refer :all] | |
[cloroutine.core :refer [cr]])) | |
;; I'm trying to port code from https://en.wikipedia.org/wiki/Delimited_continuation | |
;; using delimited continuations cloroutine's implementation | |
(def ^:dynamic *coroutine*) | |
(def ^:dynamic *result*) |
This file contains 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 matching-records | |
(:require [clojure.core.match :as m] | |
[clojure.core.match.protocols :as mp] | |
[clojure.set :as set])) | |
;; utils | |
(defn mksym [& xs] | |
(symbol (apply str (map name xs)))) |
This file contains 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
(simple-benchmark [f (fn [a b c] (+ a b c))] | |
(f 1 2 3) | |
1000000) ;; 30ms | |
(simple-benchmark [f (fn [& xs] (apply + xs))] | |
(f 1 2 3) | |
1000000) ;; 1700 ms | |
(simple-benchmark [f (partial apply +)] | |
(f [1 2 3]) |
NewerOlder