This file contains hidden or 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 test.bmi | |
(:require [reagent.core :as reagent])) | |
(defonce bmi-data (reagent/atom { :height 180 :weight 80 })) | |
(defn- calc! [param value] | |
(swap! bmi-data assoc param value) | |
(let [{:keys [height weight bmi]} @bmi-data |
This file contains hidden or 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
(defproject helloworld "0.1.0-SNAPSHOT" | |
:description "FIXME: write this!" | |
:url "http://example.com/FIXME" | |
:license {:name "Eclipse Public License" | |
:url "http://www.eclipse.org/legal/epl-v10.html"} | |
:min-lein-version "2.7.1" |
This file contains hidden or 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
;; http://www.4clojure.com/problem/solutions/61 | |
(fn [ks vs] (reduce (fn [m [k v]] (assoc m k v)) {} (map vector ks vs))) | |
(fn [ks vs] (apply assoc {} (mapcat vector ks vs))) | |
(fn [ks vs] (apply assoc {} (interleave ks vs))) | |
(fn [ks vs] (apply hash-map (interleave ks vs))) |
This file contains hidden or 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
;; function execution | |
;; (func arg1 arg2 arg3 ... argN) | |
;; function defenition | |
;; (defn <name> <args> <body>) | |
'(1 2 3) | |
[1 2 3] | |
(defn hello [name] (println "Hello," name)) |
This file contains hidden or 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
from flask import request | |
from flask import Flask | |
import json | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" |
This file contains hidden or 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
(defn xxx [m] | |
(reduce | |
+ | |
(map | |
(fn [i] | |
(reduce + (take-while #(not= 0 %) (map #(get % i) m)))) | |
(range (count (first m)))))) |
This file contains hidden or 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
package parse; | |
import com.fasterxml.jackson.core.JsonFactory; | |
import com.fasterxml.jackson.core.JsonParser; | |
import com.fasterxml.jackson.core.JsonToken; | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import java.io.File; | |
import java.io.IOException; |
This file contains hidden or 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 react-fun.part1) | |
;;Deconstructing React | |
;; v = f (d) | |