This paper:
Finding the number of clusters in a data set: An information theoretic approach
CATHERINE A. SUGAR AND GARETH M. JAMES
>Marshall School of Business, University of Southern California
#!/bin/bash | |
# | |
# Purpose: manually associate missed renames in merge conflicts | |
# | |
# Usage: git merge-associate <our-target> <base> <theirs> | |
# | |
# Example: After a failed rename detection A/a -> B/b which results | |
# in CONFLICT (delete/modify) for A/a and corresponding "deleted by us" | |
# messages in git status, the following invocation can be used to manually | |
# establish the link: |
(comment | |
This is the easiest and most concise way of calling an external process in Java. The inheritIO methods causes the command to output stdout and errout to the same place as your current process (which most of the times is the console), no need to create mechanisms for reading asynchronously from input streams to get at the information. | |
http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html | |
) | |
(def ret (.waitFor (-> (ProcessBuilder. ["gzip" "-t" "g.txt.gz"]) .inheritIO .start))) | |
(defn flip [function] | |
(fn | |
([] (function)) | |
([x] (function x)) | |
([x y] (function y x)) | |
([x y z] (function z y x)) | |
([a b c d] (function d c b a)) | |
([a b c d & rest] | |
(->> rest | |
(concat [a b c d]) |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
(ns specter-idea | |
(:require [com.rpl.specter :as specter :refer [setval ALL | |
NONE multi-path | |
selected? | |
pred | |
]])) | |
(def data ;; only x and y are allowed | |
[{:name "x" :rels ["x" "y"]} ;=> fine, keep as is | |
{:name "y" :rels ["x" "y" "z"]} ;=> keep only allowed rels: {:name "y" :rels ["x" "y"]} |
(ns aoc21-01 | |
(:require [clojure.string :as str])) | |
(def input (map parse-long (str/split-lines (slurp "input.txt")))) | |
(defn answer-01 [input] | |
(count (filter true? (map < input (rest input))))) | |
(def three-sliding-window | |
(map + input (next input) (nnext input))) |
#!/usr/bin/env bb | |
;; lein2deps | jet --pretty > deps.edn | |
(require '[clojure.string :as str] | |
'[clojure.edn :as edn]) | |
(defn read-project-clj [] | |
(-> "project.clj" | |
slurp |
;;; search-with-llama.el --- Find an answer to your query using llama! -*- lexical-binding: t; -*- | |
;; Copyright (C) 2023 Kiran Gopinathan | |
;; Author: Kiran Gopinathan | |
;; Keywords: | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |