;; try this form-by-form at a REPL | |
(require '[clojure.spec.alpha :as s]) | |
;; create an inline DSL to describe the FizzBuzz world | |
(defmacro divides-by | |
[nm n] | |
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n))))) | |
;; specify FizzBuzz | |
(divides-by ::fizz 3) |
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyleft (ↄ) 2016 jkirchartz <[email protected]> | |
# | |
# Distributed under terms of the NPL (Necessary Public License) license. | |
""" | |
Download all quotes from GoodReads by author's quote URL, print in fortune format |
\usepackage[scaled=0.95]{roboto} | |
\usepackage{mathpazo} | |
\linespread{1.05} | |
\usepackage{eulervm} | |
\usepackage[usenames]{xcolor} | |
%% footnote color | |
\renewcommand{\thefootnote}{\textcolor{Gray}{\arabic{footnote}}} | |
\makeatletter |
;;; -*- lexical-binding: t -*- | |
(require 'dash) | |
(defun var (c) (vector c)) | |
(defun var? (x) (vectorp x)) | |
(defun var=? (x1 x2) (= (elt x1 0) (elt x2 0))) | |
(defun assp (pred l) | |
(-first (lambda (i) (funcall pred (car i))) l)) |
; Douglas Hofstadter's MU puzzle from Gödel, Escher, Bach | |
; written in miniKanren | |
; | |
; https://github.com/miniKanren/miniKanren/blob/master/mk.scm | |
(load "mk.scm") | |
(define print | |
(lambda (exp) | |
(display exp) |
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.
Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
Your problem with Vim is that you don't grok vi.
You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).
The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:
0 go to the beginning of this line. y yank from here (up to where?)