(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.
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
(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.
Using JavaScript libraries from ClojureScript involves two distinct concerns:
Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs
, and so that is what I favor. In paricular, shadow-cljs
lets you install npm modules using npm
or yarn
and uses the resulting package.json
to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.
#!/usr/bin/env bash | |
#! top-of-file comments can be written using more #! lines, which | |
#! is a valid comment in both clojure and bash | |
":";# alternately this works too | |
#! The construction below uses cross-language syntactic hackery to | |
#! specify the -Sdeps arg in a part of the file that's interpreted | |
#! by clojure as clojure syntax (i.e., not a line comment), so it |
(require '[re-frame.core :as re-frame]) | |
(require '[reagent.ratom :as reagent]) | |
(require '[re-graph.core :as re-graph]) | |
(require '[martian.re-frame :as martian]) | |
;; handler for storing things when they arrive | |
(re-frame/reg-event-db | |
::on-things | |
(fn [db [_ things]] | |
(assoc db ::raw-things things))) |
So you’d like to contribute to Clojure, great! Let’s talk about what that involves.
The first thing you’ll want to make sure is that your idea is valid, and that you won’t spend a ton of time working on something that won’t make into master. To do this, you should create a JIRA ticket. For example, let’s say we want to improve how core.async handles channel closing propagation. It’s not a super complex problem, but there are some design questions about which of the various semantics currently in place should be the default, and if some semantics should be configurable.
So start by making a JIRA ticket and stating what the problem is you’re trying to solve, what the possible options for solving the problem. Now hit save and wait for the ticket to be triaged. Alex Miller will take a look when he can, and that can take a few days to a few weeks, depending on the time of the year (he has other responsibilities). Alex may out-right reject the idea if he knows Rich would never approve the ticket, but otherwise h
(defn heredoc [] | |
(let [delim (.readLine *in*)] | |
(->> (repeatedly #(.readLine *in*)) | |
(take-while #(not= delim %)) | |
(interpose \newline) | |
(apply str)))) | |
; The following lines are read (by the reader) as: | |
; "Look )(\"\\T\na here doc!\n" | |
#=(heredoc)""" |
(ns scratch | |
(:require [clojure.spec.alpha :as s])) | |
(def cards | |
[{:suite :diamonds | |
:value :king} | |
{:suite :clubs | |
:value 4}]) | |
(def cards-sorted |