This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns levenshtein | |
^{:doc "A purely functional implementation of the levenshtien distance in clojure"}) | |
(defn- compute-next-row | |
"computes the next row using the prev-row current-element and the other seq" | |
[prev-row current-element other-seq pred] | |
(reduce | |
(fn [row [diagonal above other-element]] | |
(let [update-val | |
(if (pred other-element current-element) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Thing = (props) => ( | |
<div>look {props.name}! no state!</div> | |
) | |
render(<Thing name="Ma"/>, el) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* WHY? - BECAUSE EXCEPTIONS/TRY/CATCH IS A GLOBAL HORRIBLE MESS :-( | |
* Check out error handling in golang: https://blog.golang.org/error-handling-and-go | |
*/ | |
/** | |
* Wrap an "unsafe" promise | |
*/ | |
function safePromise(promise) { | |
return promise |