;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix | |
;; and optionally can refer functions to the current ns. | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; | |
;; * :refer-clojure affects availability of built-in (clojure.core) | |
;; functions. |
;; Datomic example code | |
(use '[datomic.api :only (db q) :as d]) | |
;; ?answer binds a scalar | |
(q '[:find ?answer :in ?answer] | |
42) | |
;; of course you can bind more than one of anything | |
(q '[:find ?last ?first :in ?last ?first] | |
"Doe" "John") |
;; based on core.logic 0.8-alpha2 or core.logic master branch | |
(ns sudoku | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
(defn get-square [rows x y] | |
(for [x (range x (+ x 3)) | |
y (range y (+ y 3))] | |
(get-in rows [x y]))) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This describes how I setup Atom for an ideal Clojure development workflow. This fixes indentation on newlines, handles parentheses, etc. The keybinding settings for enter (in keymap.cson) are important to get proper newlines with indentation at the right level. There are other helpers in init.coffee and keymap.cson that are useful for cutting, copying, pasting, deleting, and indenting Lisp expressions.
The Atom documentation is excellent. It's highly worth reading the flight manual.
We're building Style.com to be the most sophisticated ecommerce platform in the world. We use the latest technology, not just because it's fun (although it is!), but because the best tools help us put together the best team and deliver a great experience for our customers worldwide.
Here's a taste of the tech you'll be working with:
- Single-page frontend applications based on a ClojureScript/Reagent/React stack
- Neural net-driven recommendation and search systems in Clojure
- Automatic curation tools using tag hierarchies in Datomic
- Containerised deployments on AWS/Docker/Kubernetes
;; implementing a React component in pure cljs, no reagent necessary | |
;; using goog.object.extend to create a ES6 class that inherits from | |
;; React.Component | |
;; credit to @thheller | |
(defn MyReact [props context updater] | |
(this-as this | |
(js/React.Component.call this props context updater))) |
(defn vec-remove | |
"Remove elem in coll by index." | |
[coll pos] | |
(vec (concat (subvec coll 0 pos) (subvec coll (inc pos))))) | |
(defn vec-add | |
"Add elem in coll by index." | |
[coll pos el] | |
(concat (subvec coll 0 pos) [el] (subvec coll pos))) |