background preloader

Clojure

Facebook Twitter

A slice of React, Clojurescript and Om | Lexically scoped, Fredrik Dyrkell. Update 2014-01-16 Since I wrote this article, Om has undergone a few API changes. For consistency I have kept the original code in this article and put an updated version, using Om 0.1.6, that you can find here. Also note that you must use a compatible Clojurescript version (0.0-2138) for Om to work – this was something I missed which gave me really weird errors when using lookups on the cursors. React React has sparked a lot of interest in the Clojure community lately (and perhaps, hopefully the other way around as well), and for good reasons.

At the very core, React lets you build up your DOM representation in a functional fashion by composing pure functions and you have a simple building block for everything: React components. “React components implement a render() method that takes input data and returns what to display.” David Nolen’s Om library About a week ago, David Nolen (@swannodette) presented a small Clojurescript library on top of React in a post on his blog. Clojure Koans. The Clojure Toolbox. Schema for Clojure(Script) Data Shape Declaration and Validation. Tl;dr: We open-sourced Schema to get many of the benefits of type systems in Clojure with less hassle. In the future, we will use Schema declarations to do awesome things like auto-generate Objective-C classes (take a peek). Join the discussion on Hacker News and tell us what you think One of the touted benefits of functional programming is that it produces easier to understand and more reusable code.

The reasoning behind this claim goes as follows: well-written functional code consists of many small pure functions. This is a pure function. Now, the author of this function could definitely have written a doc-string for the function, explaining the 'shape' that share-counts and updates ought to have: This is less than ideal for a number of reasons: In order to easily understand this function, it's not only nice to know it's free of side-effect or mutation, we also want to understand how to use this function: what kind of data should I provide it and what will it give me back. Light Table. Schema 0.2.0: back with Clojure(Script) data coercion. Tl;dr: Schema 0.2.0 is here, adding support for data coercion and 5x faster validation. We've also added Schema support in Plumbing and Graph 0.2.0.

Join the discussion on Hacker News and let us know what you think. Back in September, Prismatic released the first version of Schema, and we've been blown away by the interest and contributions from the community since. Schemas are declarative descriptions of data shapes that make it easy to document and validate Clojure(Script) data. We use Schemas all over our codebase, and others seem to share our finding that Schemas can make Clojure development clearer, faster, and more fun. In addition to a variety of small bugfixes, improvements, and a huge performance boost (see the Changelog), version 0.2.0 brings something new to the party: transformations, which provide a way to perform structured manipulation of data using rules cued by Schemas.

Why Transformations? And the fun doesn't stop at coercion. Show Me The Code Coercion Under The Hood. Hoplon • A simpler way to program the web with Clojure and ClojureScript. Clojure | Strategies for Building Semantic Web Applications. Datomic - Home. Prismatic Blog. Prismatic's "Graph" at Strange Loop. At last month's Strange Loop conference, I gave a talk about "Graph", a library developed at Prismatic to simplify some of our complex software systems.

This post will briefly summarize the main ideas behind Graph; if you're left wanting more, the talk slides go into considerably more detail, including real-world examples, and we'll be answering questions in the Hacker News thread. And if you're exited about working with us to release some great (soon to be) open source Clojure libraries like Graph, please ping us -- we're hiring! Motivation Software engineering is very important to us at Prismatic. We've written about our fondness for fine-grained, composable abstractions (FCAs). However, in a number of our real systems, we've relentessly refactored and modularized according to these principles, but still found ourselves left with complex top-level compositions like these: At left is our production API service, and at right is our real-time newsfeed builder pipeline.

A simple example Graph.