From f7f814b4a1d314595cf6444c15066aca42cc14dc Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Fri, 27 Nov 2015 12:12:11 -0800 Subject: [PATCH] Fix some more things related to control key weirdness --- dotfiles/Xresources | 4 ++++ dotfiles/emacs.d/init.el | 9 --------- dotfiles/tmux.conf | 4 ++-- sicp-2.5-notes | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 sicp-2.5-notes diff --git a/dotfiles/Xresources b/dotfiles/Xresources index 2f169b0..ebc2165 100644 --- a/dotfiles/Xresources +++ b/dotfiles/Xresources @@ -127,6 +127,10 @@ URxvt.tabbed.title: no ! URxvt.keysym.Control-Left: \033[1;5D ! URxvt.keysym.Control-Right: \033[1;5C +! URxvt doesn't nicely send C-S- to the underlying app so they have to be +! added here as they become necessary. +! URxvt.keysym.C-S-0: + Xft.dpi: 96 Xft.antialias: 1 Xft.hinting: 1 diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index 7179a48..aa14130 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -216,7 +216,6 @@ (require 'fill-column-indicator) -(setq fci-rule-width 1) (setq fci-rule-color "black") (setq fci-rule-column 120) (add-hook 'after-change-major-mode-hook 'fci-mode) @@ -306,14 +305,6 @@ (projectile-global-mode) ;;------------------------------------------------------------------------------------- -;; Rainbow Delimiters (on most programming modes) -;;------------------------------------------------------------------------------------- - -(require 'rainbow-delimiters) - -(add-hook 'prog-mode-hook 'rainbow-delimiters-mode) - -;;------------------------------------------------------------------------------------- ;; Neotree Configuration ;;------------------------------------------------------------------------------------- diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index 778cea8..bb7f65c 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -87,5 +87,5 @@ bind p paste-buffer # Enable vi-like keybindings set-window-option -g mode-keys vi -# Pass-through C- -#set-window-option -g xterm-keys on +# Pass-through C- +set-window-option -g xterm-keys on diff --git a/sicp-2.5-notes b/sicp-2.5-notes new file mode 100644 index 0000000..941bc3b --- /dev/null +++ b/sicp-2.5-notes @@ -0,0 +1,41 @@ +(car (cons x y)) + +(car (lambda (m) (m x y))) + +((lambda (m) (m x y)) (lambda (p q) p))) + +(lambda (x y) x))) + +x + +(define (cdr z) (z (lambda (x y) y))) + + + +2.5 - Given that we know the bases - 2, and 3, we only need to find the exponents. + +For example, 6 can only be represented one way - 2^1 3^1, meaning our pair of numbers a and b are 1 + +So, cons is simple: + +(define (cons x y) (* (expt 2 x) (expt 3 y))) + +Now we're left solving for a and b + +log(2^a * 3^b) = alog(2) + blog(3) + +call our "cons" value x + +Because integer factorizations are unique we only need to find the biggest power of two and three that +go into the number. + +(define (power-of-x value base) + (define (iter current-power) + (if (< ((expt base current-power) value) + (iter (+ current-power 1)) + (current-power)))) + +Then with this we can write car and cdr as + +(define (car int) (power-of-x int 2)) +(define (cdr int) (power-of-x int 3))