Skip to content

Instantly share code, notes, and snippets.

View dprelec's full-sized avatar

Darko Prelec dprelec

  • Zagreb, Croatia
View GitHub Profile
@dprelec
dprelec / permutations.clj
Last active February 14, 2021 21:48
Implementation of lexical permutation algorithm
;; Knuth's algorithm for lexical permutations.
;; For now works on numerical vectors only.
;;
;; Description of the algorithm:
;; http://www-cs-faculty.stanford.edu/~uno/fasc2b.ps.gz
;;
;; dprelec, 2014-05-28
(defn find-j [nums]
(loop [j (- (count nums) 2)]
@dprelec
dprelec / autoswap_linux.vim
Created December 20, 2013 13:03
Fixes to Damian Conway's autoswap_mac.vim to work on Linux. Uses xdotool for raising windows.
" Vim global plugin for automating response to swapfiles
" Maintainer: Damian Conway
" License: This file is placed in the public domain.
"#############################################################
"## ##
"## Note that this plugin only works for Vim sessions ##
"## running in Terminal on MacOS X. And only if your ##
"## Vim configuration includes: ##
"## ##
#!perl6
# math_permutation_lexical.pl6
# - simple perl6 experiments
# - dprelec, 2010
# Algorithm for lexical permutations taken from mr. Donald Knuth's
# Pre-fascicle 2b of "The Art of Computer Programming"
# http://www-cs-faculty.stanford.edu/~uno/fasc2b.ps.gz