Skip to content

Instantly share code, notes, and snippets.

View littleli's full-sized avatar

Aleš Najmann littleli

View GitHub Profile
@littleli
littleli / log.txt
Created November 24, 2019 19:18
clj-kondo/windows-tests
==== Testing JVM version
==== Testing JVM version
lein test clj-kondo.analysis-test
lein test clj-kondo.compojure-test
lein test clj-kondo.core-test
lein test :only clj-kondo.core-test/run!-test
@littleli
littleli / transducers.md
Created April 17, 2019 16:59 — forked from pjstadig/transducers.md
The secret feature of transducers that no one talks about!

The Pledge

One thing that always made me a little sad about transducers was how map lost its ability to iterate multiple collections in parallel. This is actually my favorite feature of map. For example:

(map + (range 5) (range 5 10))
=> (5 7 9 11 13)

One somewhat practical use of this is if you want to compare two sequences, pairwise, using a comparator. Though I wish that every? took multiple collections, this is an adequate substitute:

(fn [input]
(if (coll? input)
(= input (reverse input))
(= input (clojure.string/join "" (reverse input)))))
(fn [num]
(take num (map first (iterate (fn [[a b]] [b (+' a b)]) [1 1]))))
(fn [coll]
(reduce conj '() coll))
;; Count a sequence
(fn [coll]
(reduce (fn [c _] (inc c)) 0 coll))
@littleli
littleli / truffle-material.md
Created December 28, 2017 16:39 — forked from smarr/truffle-material.md
Truffle: Languages and Material
@littleli
littleli / bicycle.ts
Last active May 17, 2017 23:09
Bicycle
class Bicycle {
constructor(public cadence: number, private _speed: number, public gear: number) {}
speed = this._speed
applyBrake = (decrement: number) => this._speed -= decrement
sppedUp = (increment: number) => this._speed += increment
toString = () => `Bicycle: ${this._speed} mph`
@littleli
littleli / README.md
Created January 24, 2017 00:39 — forked from polbins/README.md
Android Studio as default Git Diff Tool

Create Android Studio Command-line Launcher

  1. Open Android Studio
  2. Go to: Tools > Create Command-line Launcher
  3. Leave as default, Press OK

Configure Git to use Android Studio as default Diff Tool

  1. Add the following lines to your .gitconfig