This file contains 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://www.artima.com/weblogs/viewpost.jsp?thread=101605 | |
@multimethod(int, int) | |
def foo(a, b): | |
return a + b | |
@multimethod(float, float): | |
def foo(a, b): | |
return int(a+b) | |
@multimethod(str, str): | |
def foo(a, b): |
This file contains 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
; originally posted on https://github.com/rodricios/eatiht/issues/2#issuecomment-67769343 | |
(import | |
[collections [Counter]] | |
[cookielib [CookieJar]] | |
[lxml.etree [HTML tostring]] | |
[urllib2 [build-opener HTTPCookieProcessor]]) | |
(def *min-length* 20) | |
(def *text-xpath* (+ "//body//*[not(self::script or self::style or self::i or self::b or self::strong or self::span or self::a)]/text()[string-length(normalize-space()) > " (str *min-length*) "]/..")) |
This file contains 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
(defmacro update-in* | |
"'Updates' a value in a nested associative structure, where ks is a | |
sequence of keys and f is a function that will take the old value | |
and any supplied args and return the new value, and returns a new | |
nested structure. If any levels do not exist, hash-maps will be | |
created." | |
([m [k & ks] f & args] | |
(if ks | |
`(let [m# ~m k# ~k] (assoc m# k# (update-in* (get m# k#) ~ks ~f ~@args))) | |
`(let [m# ~m k# ~k] (assoc m# k# (~f (get m# k#) ~@args)))))) |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
#main{ | |
padding:4px; | |
cursor: pointer; |
This file contains 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
module Main where | |
import Control.Monad.Writer | |
import System(getArgs, getProgName) | |
data Column = LeftCol | MiddleCol | RightCol | |
instance Show Column where | |
show LeftCol = "left" | |
show MiddleCol = "middle" | |
show RightCol = "right" |
This file contains 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
extern mod std; | |
fn lt<T: Ord>(a: Option<T>, b: Option<T>) -> bool { | |
match (a, b) { | |
(None, None) => false, | |
(None, Some(_)) => true, | |
(Some(_), None) => false, | |
(Some(a), Some(b)) => a < b | |
} | |
} |
This file contains 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
// Works as expected... if one gets it to compile | |
#include <libzfs.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int zp_iter(zpool_handle_t *z, void *a) { | |
printf("name:\t%s\n", zpool_get_name(z)); | |
return 0; | |
} |
This file contains 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
import numpy as np | |
# The Fibonacii matrix | |
M = np.array([[0, 1], [1, 1]], dtype=np.float32) | |
# Compute the eigendecomposition of the matrix | |
w, v = np.linalg.eig(M) | |
inv_v = np.linalg.inv(v) | |
base_case = np.array([0, 1]).T # base case as a column vector |
This file contains 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 (cc k) (call-with-current-continuation k)) | |
(display (format ">>> ~s\n" (- 10 (cc (lambda (k) (+ 1 (+ 2 (k 10)))))))) | |
(let ((k (cc (lambda (bind) (lambda (x) (+ 1 (cc (lambda (k) (bind k))))))))) (k 10)) | |
(let ((k (cc (lambda (bind) | |
(lambda (x) | |
(+ 1 (cc (lambda (k) | |
(bind k))))))))) | |
(k 10)) |
This file contains 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
From welch@thor.oar.net Thu Oct 20 16:53:41 EDT 1994 | |
Article: 15160 of comp.lang.lisp | |
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!usenet.eel.ufl.edu!usenet.cis.ufl.edu!caen!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ns.mcs.kent.edu!kira.cc.uakron.edu!malgudi.oar.net!malgudi.oar.net!welch | |
From: welch@thor.oar.net (Arun Welch) | |
Newsgroups: comp.lang.lisp | |
Subject: CL History (was Re: Why do people like C?) | |
Date: 20 Oct 94 15:34:10 | |
Organization: OARnet | |
Lines: 3244 | |
Message-ID: <WELCH.94Oct20153410@thor.oar.net> |
OlderNewer