Skip to content

Instantly share code, notes, and snippets.

View wfarr's full-sized avatar
:shipit:
shipping

Will Farrington wfarr

:shipit:
shipping
View GitHub Profile
#!/usr/bin/env ruby1.9
require 'mathn'
A = Matrix[[4,2],
[3,5]]
b = Vector[1,
2]
def jacobi(matrix,vector)
wfarr@turing:~/Code/wfarr.github.com/_posts[master*]$ tail -n50 lisp-and-emacs.textile | grep "There"
There are other complicated softwares that are widely adopted, but Emacs doesn't have the good public face they do.
--[[
VPLanguage = lua
VPScriptMenuTitle = GitHub Commit
VPEndConfig
]]
-- we assume git is located in PATH
posix.chdir(document:fileName())
-- add new files
test_matr.LUdecomp
Order:
puts "#{cvs[j][j]} #{cvs[k][k]} #{cvs[j][k]}"
Matrix[*l_new].pretty_print
Matrix[*cvs.transpose].pretty_print
u_new.pretty_print
test_matr.LUdecomp
3 1 1
\documentclass[11pt,letterpaper]{article}
\usepackage{ifpdf}
\usepackage{mla}
\begin{document}
\begin{mla}{Will}{Farrington}{Some Prof}{Some Class}{\today}{Some Title}
Foo.
Bar.
#!/usr/bin/env ruby1.9
require 'mathn'
A = Matrix[[4,1],
[2,3]]
b = Vector[6,
8]
def jacobi(matrix,vector)
def gauss_seidel(matrix,vector)
a11 = matrix[0,0]
a12 = matrix[0,1]
a21 = matrix[1,0]
a22 = matrix[1,1]
b1 = vector[0]
b2 = vector[1]
x_1 = ->(x){ b1.fdiv(a11) - (a12.fdiv(a11) * x) }
x_2 = ->(x){ b2.fdiv(a22) - (a21.fdiv(a22) * x) }
;; works
(yql filter sampleQuery (yql desc flickr.places))
;; "select * from flickr.places where query=\"north beach\""
;; fails
(yql
filter item
(yql select title,pubDate rss (format "url='http://twitter.com/statuses/user_timeline/%s.rss'" "wfarr"))
)
;; error:
;; Works for (yql-filter 'sampleQuery (yql desc flickr.places))
(defmacro yql-filter (symbol list)
"Filters any JSON returned from a `yql-send-request' call for the value(s)
associated to `symbol', where the JSON is `list'."
`(let ((result (yql-search-for-symbol ,symbol ,list)))
(if (or (typep result 'list)
(typep result 'string)
(typep result 'number))
result
(defmacro yql (query &rest args)
"Constructs a function call based on `query', which should be one of
`show', `desc', `select', or `filter'."
(unless (member query '(show desc select filter))
(error "`query' must be one of `show', `desc', `select', or `filter'!"))
(cond ((eq query 'show)
(quote (yql-show)))
(args
(let ((query-args
(mapcar (lambda (x)