Skip to content

Instantly share code, notes, and snippets.

@lxmonk
lxmonk / session.py
Created June 10, 2012 07:11
session.ipy
# this is an Ipython session (http://ipython.org/)
%run code/hw2.py
# generating the scatter plot for generateDataset(50,sin,0.03):
from numpy import sin; import pylab
data = generateDataset(50,sin,0.03)
scatter(data[0],data[1], marker='+', facecolor='g')
grid()
@lxmonk
lxmonk / easyfirst.py
Created August 25, 2012 15:48
easyfirst parser by Yoav Goldberg
## Copyright 2010 Yoav Goldberg
##
## This file is part of easyfirst
##
## easyfirst is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## easyfirst is distributed in the hope that it will be useful,
@lxmonk
lxmonk / ml.pyx
Created September 1, 2012 07:46
the file ml.pyx from the easy-first parser
## Copyright 2010 Yoav Goldberg
##
## This file is part of easyfirst
##
## easyfirst is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## easyfirst is distributed in the hope that it will be useful,
(declaim (optimize (speed 3) (debug 0) (space 0) (safety 0)))
(defun build-btree (item depth)
(declare (fixnum item depth))
(if (zerop depth) (list item)
(let ((item2 (+ item item))
(depth-1 (1- depth)))
(declare (fixnum item2 depth-1))
(cons item
(cons (build-btree (the fixnum (1- item2)) depth-1)