Self-hosted:
$ plk
ClojureScript 1.10.597
cljs.user=> (require '[foo.core :refer [defnmy]])
nil
cljs.user=> (defnmy FOO clojure.string/lower-case [x]
#_=> (inc x))
#'cljs.user/foo
Self-hosted:
$ plk
ClojureScript 1.10.597
cljs.user=> (require '[foo.core :refer [defnmy]])
nil
cljs.user=> (defnmy FOO clojure.string/lower-case [x]
#_=> (inc x))
#'cljs.user/foo
| (ns simple.core | |
| (:require [reagent.core :as r] | |
| [re-frame.core :as rf])) | |
| (rf/reg-event-db | |
| :initialize | |
| (fn [_ _] | |
| {:loading? true})) | |
| (rf/reg-event-db |
| (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." | |
| ([] (naive-english-explain (ex-data *e))) | |
| ([spec-explain-data] | |
| (let [p1 (-> spec-explain-data ::s/problems first)] |
| ; the SET game in clojure.spec | |
| ;; inspired by https://github.com/jgrodziski/set-game | |
| (require '[clojure.spec :as s]) | |
| (require 'clojure.test.check.generators) | |
| (require '[clojure.spec.impl.gen :as gen]) | |
| (s/def ::shape #{:oval :diamond :squiggle}) | |
| (s/def ::color #{:red :purple :green}) | |
| (s/def ::value #{1 2 3}) |
| (ns foo-test | |
| (:require [cljs.spec :as s] | |
| [cljs.spec.test :as stest] | |
| [clojure.pprint :as pprint] | |
| [cljs.test :refer [run-tests deftest is]])) | |
| ;; Sample function and a function spec | |
| (defn fooo [i] (+ i 20)) | |
| (s/fdef fooo |
| (ns tic.tac.toe | |
| (:require [reagent.core :as r])) | |
| (enable-console-print!) | |
| (defn vanilla-state [] | |
| (r/atom {:squares (vec (repeat 9 nil)) | |
| :x-is-next true | |
| :winner nil})) |
| ;; Live demo with klipse - http://app.klipse.tech/?cljs_in.gist=viebel/54a9699398205a3ed41fc881a4232e08&eval_only=1 | |
| (ns twentyfour.core | |
| (:require [clojure.math.combinatorics :refer [partitions]])) | |
| (def ops ['+ '- '* '/]) | |
| (def commutative #{'+ '*}) | |
| ;; We can generate all the possible expressions efficiently with combinatorics' partitions | |
| ;; partitions automatically handles duplicates for us, which keeps the process efficient |
| function limitEval(code, fnOnStop, opt_timeoutInMS) { | |
| var id = Math.random() + 1, | |
| blob = new Blob( | |
| ['onmessage=function(a){a=a.data;postMessage({i:a.i+1});postMessage({r:eval.call(this,a.c),i:a.i})};'], | |
| { type:'text/javascript' } | |
| ), | |
| myWorker = new Worker(URL.createObjectURL(blob)); | |
| function onDone() { | |
| URL.revokeObjectURL(blob); |
| ; I'm hoping to find a common name for a particular operation over sets that I've | |
| ; been thinking of as a "join" of sorts. | |
| ; | |
| ; It's _not_ a relational join -- the values involved aren't relations (for me | |
| ; at the moment, they're actually graphs essentially representing | |
| ; disjoint recursive sets, but I think that's probably irrelevant | |
| ; detail) -- but it feels like it's in the spirit of a full outer join | |
| ; | |
| ; Given N sets, recursively produce all unions of those sets that are disjoint. |
| (ns om.next.spec | |
| (:require [cljs.spec :as s])) | |
| (s/def ::ident (s/and vector? (s/cat :ident keyword? :value #(not (coll? %))))) | |
| (s/def ::join-key (s/or :prop keyword? :ident ::ident)) | |
| (s/def ::join (s/and (s/map-of ::join-key ::query) #(= (count %) 1))) | |
| (s/def ::union (s/and (s/map-of keyword? ::query) #(> (count %) 1))) | |
| (s/def ::param-expr | |
| (s/cat :query-expr ::query-expr |