Skip to content

Instantly share code, notes, and snippets.

View iku000888's full-sized avatar
🤣
Having fun coding

Ikuru K iku000888

🤣
Having fun coding
View GitHub Profile
;; it's very rough (no line info displayed yet, no return value, no filter etc.)
;; but I believe this is the most comprehensive tracing for Clojure
user=> (trace #(reduce + (range 5)))
> user$eval144$fn__145 / invoke
> clojure.lang.Var / getRawRoot
< clojure.lang.Var / getRawRoot
> clojure.lang.Var / getRawRoot
< clojure.lang.Var / getRawRoot
> clojure.lang.Var / getRawRoot

The case example in ClojureScript Case Constants is now an order of magnitude faster in ClojureScript master, due to a change by David Nolen to inline constants!

Old:

cljs.user=> (def ^:const n 3)
#'cljs.user/n
cljs.user=> (def ^:const m 4)
#'cljs.user/m
cljs.user=> (defn foo []
@yogthos
yogthos / gallery.cljs
Last active March 30, 2024 17:36
script to download walpapers from windowsonearth.org
@stuarthalloway
stuarthalloway / clojure_spec_missing_piece.clj
Created March 17, 2017 01:11
Clojure spec's missing piece
;; clojure.spec's missing piece, work in progress
;; this is only halfway done, somebody else will need to do the other 95%
(require
'[clojure.spec :as s]
'[clojure.spec.test :as test])
(defn naive-english-explain
"Copy and paste this into your app. Figure out what it does by
trying it in production."
@reborg
reborg / rich-already-answered-that.md
Last active May 12, 2025 12:44
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@fasiha
fasiha / learn_datalog_today.clj
Created May 10, 2016 03:32
Learn Datalog Today ported to DataScript & Clojure (JVM)
; Learn Datalog Today (http://www.learndatalogtoday.org) is a great resource for
; reading but its interactive query interface is broken. Below is how we can
; load the same data into a Clojure REPL and play with it using DataScript.
; After running the code below, many/most/all? of the queries on Learn Datalog
; Today should be functional.
;
; Create a new lein project, add `[datascript "0.15.0"]` to `project.clj`'s
; `dependencies`, run `lein deps && lein repl` and copy-paste the following in
; chunks, inspecting the outputs as needed.
{
"width": 400,
"height": 200,
"padding": {"top": 10, "left": 30, "bottom": 20, "right": 10},
"data": [
{
"name": "table",
"values": [
{"category":"A", "amount":28},
@fddcddhdd
fddcddhdd / header_search.js
Created August 25, 2015 05:32
javascriptで、kintoneのヘッダ部分に検索窓を付けてみた。
/*
※kintoneでの検索の注意点!!
1, 1文字では検索出来ない(最低でも2文字以上)
2, 英数字検索が単語単位(cyで、cybozeがヒットしない!)
https://help.cybozu.com/ja/k/user/search_details.html
*/
// 設定値
const FIELD_CODE1 = "company_name_a";
const FIELD_CODE1_NAME = "会社名A";
@fukamachi
fukamachi / common-lisp-scripting-with-roswell.md
Last active April 10, 2021 16:39
Common Lisp Scripting with Roswell (Draft)

Common Lisp Scripting with Roswell

"Roswell Script" is implementation-independent Common Lisp scripting program which uses Roswell. Although Roswell itself is a unified interface to Common Lisp implementations, it also encourages writing scripts with it.

To start writing it, run ros init in your terminal:

$ ros init
Usage: ros init [template] name [options...]