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
;; finds the sqrt of a number using newton's method | |
(define sqrt | |
(lambda (x) | |
(sqrt-iter 1.0 x))) | |
(define sqrt-iter | |
(lambda (guess x) | |
(if (good-enough? guess x) | |
guess |
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
;; finds the cube root of a number using newton method | |
(define cube | |
(lambda (x) | |
(cube-iter 1.0 x))) | |
(define cube-iter | |
(lambda (guess x) | |
(if (good-enough? guess x) | |
guess |
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
;;A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n -3) | |
;;if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure that | |
;;computes f by means of an iterative process. | |
(define (f n) | |
(cond | |
((< n 3) 0) | |
(else | |
(iter-fun n 0 1 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
;;How many different ways can we make change of $ 1.00, given half-dollars, quarters, | |
;;dimes, nickels, and pennies? More generally, can we write a procedure to compute | |
;;the number of ways to change any given amount of money? | |
(define (count-change amount) | |
(cc amount 5)) | |
(define (cc amount kinds-of-coins) | |
(cond | |
((= 0 amount) 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
# grabs all the post from steve-yegge blog | |
require 'net/http' | |
require '/home/ananth/.gem/ruby/1.8/gems/xml-simple-1.0.12/lib/xmlsimple' | |
blog = 'www.blogger.com' | |
out_dir = '/home/ananth/steve-yegge/' | |
proxy_host = 'proxy.karunya.edu' | |
proxy_port = 3128 |
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
;; style your emacs with css | |
(setq source " | |
frame { | |
foreground-color : wheat; | |
background-color: darklategrey; | |
background-mode : dark | |
} |
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
require 'rubygems' | |
require 'hpricot' | |
require 'net/http' | |
blog = 'www.paulgraham.com' | |
out_dir = '/home/ananth/paul/' | |
url = URI.parse('http://paulgraham.com/articles.html') |
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
def time_taken | |
start_time = Time.now | |
yield | |
Time.now - start_time | |
end | |
def fib(n) | |
if n < 2 | |
n | |
else |
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
Gems included by the bundle: | |
* activesupport (2.3.8) | |
* bcrypt-ruby (2.1.2) | |
* beanstalk-client (1.1.0) | |
* bson (1.0.7) | |
* bson_ext (1.0.7) | |
* builder (2.1.2) | |
* bundler (1.0.0) | |
* compass (0.8.17) | |
* crack (0.1.8) |
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
;;; haml-mode.el --- Major mode for editing Haml files | |
;; Copyright (c) 2007, 2008 Nathan Weizenbaum | |
;; Author: Nathan Weizenbaum | |
;; URL: http://github.com/nex3/haml/tree/master | |
;; Version: 3.0.13 | |
;; Created: 2007-03-08 | |
;; By: Nathan Weizenbaum | |
;; Keywords: markup, language, html |