This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://wordpress.org/support/topic/wp_get_archives-highlight-current-archive-please | |
/* Add a class to the archive link if it is the current one | |
so we can, e.g. highlight it */ | |
function theme_get_archives_link( $link_html ) { | |
global $wp; | |
static $current_url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import os | |
import csv | |
import string | |
if len( sys.argv ) < 2 : | |
sys.stderr.write( sys.argv[ 0 ] + | |
": usage - " + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;h(n) = 2^(h(n-1)) defined iteratively. | |
(define (h-iter-aux num prod count) | |
(if (= count 1) | |
prod | |
(h-iter-aux num (expt num prod) (- count 1)))) | |
(define (h-iter n) | |
(if (= n 0) | |
0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Recursively defined analogue of (h n) = (A 2 n) | |
(define (h-rec n) | |
(cond ((= n 0) 0) | |
((= n 1) 2) | |
(else (expt 2 (h-rec (- n 1)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (A x y) | |
(cond ((= y 0) 0) | |
((= x 0) (* 2 y)) | |
((= y 1) 2) | |
(else (A (- x 1) | |
(A x (- y 1)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (F n) | |
(cond ( (< n 3) n) | |
( else (+ (F (- n 1)) | |
(* (F (- n 2)) 2) | |
(* (F (- n 3)) 3))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (fib n) | |
(fib-iter 1 0 n)) | |
(define (fib-iter a b count) | |
(if (= count 0) | |
b | |
(fib-iter (+ a b) a (- count 1)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (fib n) | |
(cond ((= n 0) 0) | |
((= n 1) 1) | |
(else (+ (fib (- n 1)) | |
(fib (- n 2)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; f(n) = n if n < 3, | |
; f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n > 3 | |
; | |
; iterative (via tail recursion optimisation) | |
(define (F-iter a b c count) | |
(if (= count 0) | |
c | |
(F-iter (+ a (* 2 b) (* 3 c)) | |
a |