An FRP application has the following properties
- Functional, pure, immutable.
- Reactive, your application is a DAG, you react to "core" inputs and from new outputs.
If your application is an immutable DAG it has certain properties
| #!/bin/bash | |
| set -eu | |
| umask 0022 | |
| if [[ $# -lt 1 ]]; then | |
| echo "Usage: $0 role_name [AWS ACCOUNT NUMBER]" >&2 | |
| exit 1 | |
| fi |
| The MIT License (MIT) | |
| Copyright (c) 2014 Tomas Kafka | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| (require '[clojure.core.async :as a]) | |
| (def xform (comp (map inc) | |
| (filter even?) | |
| (dedupe) | |
| (flatmap range) | |
| (partition-all 3) | |
| (partition-by #(< (apply + %) 7)) | |
| (flatmap flatten) | |
| (random-sample 1.0) |
| // If the ES6 Promise is available, it uses that, else: | |
| Rx.config.Promise = RSVP.Promise; | |
| // To promise with success | |
| Rx.Observable | |
| .just(42) | |
| .toPromise(/* Optional Promise ctor like RSVP.Promise */) | |
| .then( | |
| result => console.log('Result', result), | |
| reason => console.log('Reason', reason)); |
| This just got linked to by the Y combinator news account, without proper context, | |
| so a brief introduction: A month ago (end of May / early June 2014) I had a | |
| Twitter conversation with a bunch of acquaintances. One tweet in the middle | |
| of that thread, with obligatory hyperbole, was me saying that I think VR is | |
| bad news. | |
| Well, that part of the thread (but not the rest that provides context) recently | |
| got retweeted, and then someone asked me if I could explain what I mean by that, | |
| and because Twitter is a great platform for delivering 140 character slogans and | |
| not so great for lengthy explanations, I wrote this. So, obligatory disclaimer: |
(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.
| (ns reagent-test.core | |
| (:require [reagent.core :as reagent :refer [atom]] | |
| [datascript :as d] | |
| [cljs-uuid-utils :as uuid])) | |
| (enable-console-print!) | |
| (defn bind | |
| ([conn q] | |
| (bind conn q (atom nil))) |
| (ns om-data.core | |
| (:require [om.core :as om :include-macros true] | |
| [om.dom :as dom :include-macros true] | |
| [datascript :as d])) | |
| (enable-console-print!) | |
| (def schema {}) | |
| (def conn (d/create-conn schema)) | |
| /** | |
| * Copyright 2013 Facebook, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |