Skip to content

Instantly share code, notes, and snippets.

@kahunamoore
kahunamoore / cljs-macro.adoc
Created May 7, 2018 21:33 — forked from philoskim/cljs-macro.adoc
How to enumerate the ClojureScript macros

How to enumerate the cljs.core macros in ClojureScript

I wanted to enumerate the macros of cljs.core in ClojureScript. In general, it would not be needed for everyday ClojureScrit programming but I need it to author my debux library.

At first, I asked a question about this problem in Google Clojure Group but got no answers.

I decided to find the way by myself and finally found a way to enumerate the macros of cljs.core in Clojure REPL, so I want to share the exprerience with others here.

The functions of cljs.core are defined in src/main/cljs/cljs/core.cljs and the macros of cljs.core are defined in src/main/clojure/cljs/core.cljc. So you have to evaluate the src/main/clojure/cljs/core.cljc file in Clojure REPL, not in ClojureScript REPL, to get a list of the macros of cljs.core.

@kahunamoore
kahunamoore / ∪_prob.clj
Created March 23, 2018 05:25 — forked from arnaudbos/∪_prob.clj
Inclusion–Exclusion Principle for probabilities in Clojure.
(require '[clojure.math.combinatorics :refer [combinations]])
(defn ∩-prob
[a & more]
(reduce * a more))
(defn ∪-prob [a b & more]
"https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle#In_probability"
(let [ps (concat [a b] more)
n (count ps)]
@kahunamoore
kahunamoore / spec_parsing.clj
Created February 19, 2018 08:09 — forked from thegeez/spec_parsing.clj
Parsing with clojure.spec for the Advent of Code challenge
(ns net.thegeez.advent.spec-parsing
(:require [clojure.string :as str]
[clojure.spec :as s]
[clojure.spec.gen :as gen]
[clojure.test.check.generators :as tgen]))
;; Dependencies:
;; [org.clojure/clojure "1.9.0-alpha14"]
;; [org.clojure/test.check "0.9.0"]
;; Advent of Code is a series of code challenges in the form of an advent
@kahunamoore
kahunamoore / week6.md
Created September 19, 2017 07:45
Week #6

Week 6

Debugging, Tools and Testing

Monday

Lecture

Lab

@kahunamoore
kahunamoore / week5.md
Created September 19, 2017 07:44
Week #5

Week 5

Server-side JavaScript & Databases

Monday

Lecture

Lab

@kahunamoore
kahunamoore / week4.md
Created September 19, 2017 07:43
Week #4

Week 4

Client-side JavaScript Frameworks

Monday

Lecture

  • JavaScript review (arrays, objects/maps)
  • Corrections/Ommisions: script end tag required
  • Array.size -> length
@kahunamoore
kahunamoore / week2.md
Created September 19, 2017 07:42
Week #2

Week 2

JavaScript Basics

Monday

Lecture

  • Tables
  • CSS Table Styling
@kahunamoore
kahunamoore / week1.md
Created September 19, 2017 07:41
Week #1

Welcome to Connected Communities Academy!

In the course we will cover the following subject areas:

Week 1

Introduction & HTML/CSS

Monday:

@kahunamoore
kahunamoore / Week #1
Created September 19, 2017 07:39
Week #1
Welcome to Connected Communities Academy!
In the course we will cover the following subject areas:
# Week 1
## Introduction & HTML/CSS
## Monday:
@kahunamoore
kahunamoore / index.html
Created August 18, 2017 06:28 — forked from anonymous/index.html
Kqrxae
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<input onkeydown="doit(event)" />
<div id="second-div">Second DIV</div>
<div data="x">Third div</div>