Skip to content

Instantly share code, notes, and snippets.

View pelletier's full-sized avatar

Thomas Pelletier pelletier

View GitHub Profile
@pelletier
pelletier / gist:1023181
Created June 13, 2011 16:58
Example of git configuration
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:pelletier/foo.git
[remote "production"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:www/foo/.git
;;; Idp
;;; Identity predicate. Test if all members of the vector are equals.
;;;
;;; CL-USER> (idp (list 2 3 4 5))
;;; NIL
;;; CL-USER> (idp (list 2 2 2 2))
;;; T
(defun idp (v)
(if (null v)
t
(:section "8.5 Limits of Rule-Based Approaches")
"In this section we return to some examples that pose problems."
"For the following, we would prefer (2 * (x + y))"
((simp '(x + y + y + x)) => (X + (Y + (Y + X))))
"For the following, we would prefer (7 * X) and (Y + (8 * X)), respectively:"
((simp '(3 * x + 4 * x)) => ((3 * X) + (4 * X)))
((simp '(3 * x + y + x + 4 * x)) => ((3 * X) + (Y + (X + (4 * X)))) )
(:section "8.5 Limits of Rule-Based Approaches")
"In this section we return to some examples that pose problems."
"For the following, we would prefer (2 * (x + y))"
((simp '(x + y + y + x)) => (X + (Y + (Y + X))))
"For the following, we would prefer (7 * X) and (Y + (8 * X)), respectively:"
((simp '(3 * x + 4 * x)) => ((3 * X) + (4 * X)))
((simp '(3 * x + y + x + 4 * x)) => ((3 * X) + (Y + (X + (4 * X)))) )
"In chapter 15, we develop a new version of the program that handles this problem."
(defexamples 8 "Symbolic Mathematics: A Simplification Program"
"'Symbolic mathematics' is to numerical mathematics as algebra is to"
"arithmetic: it deals with variables and expressions, not just numbers."
"This chapter develops a program that simplifies algebraic expressions."
"We then show that differentiation and even integration can be seen as"
"special cases of 'simplification.' (Note that we replace calls to the"
"interactive function SIMPLIFIER with calls to the function SIMP.)"
(:section "8.2 Simplification Rules")
((requires "macsymar"))
((simp '(2 + 2)) => 4 @ 245)
(defexamples 8 "Symbolic Mathematics: A Simplification Program"
"'Symbolic mathematics' is to numerical mathematics as algebra is to"
"arithmetic: it deals with variables and expressions, not just numbers."
"This chapter develops a program that simplifies algebraic expressions."
"We then show that differentiation and even integration can be seen as"
"special cases of 'simplification.' (Note that we replace calls to the"
"interactive function SIMPLIFIER with calls to the function SIMP.)"
(:section "8.2 Simplification Rules")
((requires "macsymar"))
((simp '(2 + 2)) => 4 @ 245)
@pelletier
pelletier / backup_bookmarks.py
Created May 26, 2011 17:39
Backup your Read It Later bookmarks with CouchDB
#!/usr/bin/env python
import simplejson as json
import urllib
import httplib
import restkit
from restkit.resource import Resource
# ReadItLater credentials
@pelletier
pelletier / Makefile
Created May 25, 2011 13:49
Monotone chain algorithm implementation in OCaml
RESULT = drawconvexhull
SOURCES = convexhull.ml drawconvexhull.ml
LIBS = graphics
PACKS = extlib
THREADS = true
OCAMLLDFLAGS = -cclib "-framework Cocoa"
LDFLAGS = -arch x86_64
include OCamlMakefile
@pelletier
pelletier / GoogleMarksLater.py
Created May 7, 2011 12:36
Import your Google Chrome booksmarks to readitlaterlist.com
import json
import urllib
import httplib
KEY = "AAA"
USER = "BBB"
PASS = "CCC"
PATH = "/Users/thomas/Library/Application Support/Chromium/Default/Bookmarks"
@pelletier
pelletier / scratch.vim
Created April 26, 2011 16:21
Add ScratchToggle to scratch.vim
" File: scratch.vim
" Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com)
" Version: 1.1
" Last Modified: April 26, 2011
" Modified By: Thomas Pelletier (thomas AT pelletier DOT im)
"
" Changes
" -------
" Added the ScratchToggle command.
"