Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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
; Quick miniKanren-like code | |
; | |
; written at the meeting of a Functional Programming Group | |
; (Toukyou/Shibuya, Apr 29, 2006), as a quick illustration of logic | |
; programming. The code is really quite trivial and unsophisticated: | |
; it was written without any preparation whatsoever. The present file | |
; adds comments and makes minor adjustments. | |
; | |
; $Id: sokuza-kanren.scm,v 1.1 2006/05/10 23:12:41 oleg Exp oleg $ |
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 schejule.core | |
(:require [clojure.core.logic :as lg] | |
[clojure.core.logic.pldb :as pldb])) | |
;; Declare database relations | |
(pldb/db-rel tasko ^:index id) | |
(pldb/db-rel precedo ^:index id other-id bool) | |
;; Make example db |
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
; Church Numerals in Clojure | |
; | |
; Church numerals use anonymous functions to represent numbers. | |
; | |
; ((zero f) x) -- returns x | |
; ((one f) x) -- return (f x) | |
; ((two f) x) -- return (f (f x)) | |
; ... | |
(def zero (fn [f] (fn [x] x))) |
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 toe.core | |
(:gen-class) | |
(:require [clojure.string :as str])) | |
;; # Create board | |
(defn new-board [size] | |
(vec (repeat size (vec (repeat size :-))))) | |
;; # Draw board on screen | |
(defn int->char [i] |
I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.
What I decided on was the following: put your secret information into a vars
file, reference that vars
file from your task
, and encrypt the whole vars
file using ansible-vault encrypt
.
Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.
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 lazy.partition) | |
;; returns tuple: [(take-while pred coll) rest-of-coll] | |
(defn split-with [acc pred coll] | |
(lazy-seq | |
(let [h (first coll)] | |
(if (and h (pred h)) | |
(split-with (lazy-cat acc [h]) pred (rest coll)) | |
[acc coll])))) |
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
(function webpackUniversalModuleDefinition(root, factory) { | |
if(typeof exports === 'object' && typeof module === 'object') | |
module.exports = factory(require("react"), require("react-dom")); | |
else if(typeof define === 'function' && define.amd) | |
define(["react", "react-dom"], factory); | |
else if(typeof exports === 'object') | |
exports["ReactDataGrid"] = factory(require("react"), require("react-dom")); | |
else | |
root["ReactDataGrid"] = factory(root["React"], root["ReactDOM"]); | |
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_6__) { |
A beginner-friendly REPL that combines
I hereby claim:
- I am daveduthie on github.
- I am daveduthie (https://keybase.io/daveduthie) on keybase.
- I have a public key whose fingerprint is F9BA 7DBA 1883 7562 7626 9146 9312 1846 0BD0 1150
To claim this, I am signing this object:
OlderNewer