- Introduction
- Functional Programming
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
/** | |
* query movie main character form movie name | |
* @constructor | |
* @param {string} name | |
* @param {function} success(characterArray) - success callback funtion return all record character | |
* @param {function} err(string) - error callback funtion return error string | |
*/ | |
function queryDB(name,success,err){ | |
var intern= { |
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
(def qs {1 [:a :b] 2 [:a] 3 [:b] 4 [:b :c] 5 [:a] 6 [:a :c]}) | |
(defn swap-sub [m] | |
(->> m | |
(mapcat (fn [[k v]] (zipmap v (repeat k)))) | |
(group-by first) | |
(map (fn [[k v]] [k (mapv second v)])) | |
(into {}))) | |
(swap-sub qs) ;=> {:a [1 2 5 6], :b [1 3 4], :c [4 6]} |
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
(def local | |
[{:province :a, :district :b, :amphoe :c} | |
{:province :a, :district :k, :amphoe :g} ]) | |
(defn group-by-fn | |
([func groupping] | |
(fn [hmap] | |
(group-by-fn func groupping hmap))) | |
([func groupping hmap] | |
(->> hmap |
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 tennis.tennis) | |
(def next-score | |
{0 15 | |
15 30 | |
30 40}) | |
(defn tennis [winner {:keys [score advantage] :as game-state}] | |
"kata from http://codingdojo.org/kata/Tennis/ | |
take winner and game state, return updated game state" |
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
local | |
local enter* | |
add new block -> local text | |
local text | |
edit -> local CRDT | |
finish edit -> remote text | |
local CRDT | |
edit -> local CRDT | |
no attention -> local text | |
update to remote -> remote CRDT |
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
#!/bin/bash | |
# work with ray cast script command https://github.com/raycast/script-commands | |
# Dependency: requires babashka (https://github.com/babashka/babashka) | |
# Install via bash: `bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)` | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title clj | |
# @raycast.mode compact |