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
(define apply-in-underlying-scheme apply) | |
(define (eval exp env) | |
(cond ((self-evaluating? exp) exp) | |
((variable? exp) | |
(lookup-variable-value exp env)) | |
((quoted? exp) | |
(text-of-quotation exp)) | |
((assignment? exp) | |
(eval-assignment exp env)) |
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
#include <iostream> | |
void display_hello_world() { | |
std::cout << "Hello World" << std::endl; | |
} | |
int main() { | |
std::cout << "Silly little example" << std::endl; | |
display_hello_world(); |
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
const { | |
createStore, | |
bindActionCreators | |
} = Redux; | |
const { | |
Provider, | |
connect | |
} = ReactRedux; | |
const { | |
render |
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
(define simple-func | |
(lambda () | |
(display "Script called, now I can change this") (newline))) | |
(define quick-test | |
(lambda () | |
(display "Adding another function, can modify without recompilation") | |
(newline) | |
(adding-without-recompilation))) |
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
(defvar *hashfunctions* 2) | |
(defvar *m* 2500000) | |
(defvar *bloom* (make-array *m* :initial-element nil)) | |
(defun add-word (word) | |
(let ((downcase-word (string-downcase word))) | |
(setf (elt *bloom* (mod (sax-hash downcase-word) *m*)) t) | |
(setf (elt *bloom* (mod (sdbm-hash downcase-word) *m*)) t))) | |
(defun contains-word (word) |
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
;; This is based on the solution given here http://programmingpraxis.com/2009/04/21/probabilistic-spell-checking/2/ | |
;; just ported to common lisp | |
(defvar *k* 7) | |
(defvar *m* 1000000) | |
(defvar *bloom* (make-array *m* :initial-element nil)) | |
(defun key (i word) | |
(let* ((c (string (code-char (+ i 96)))) |
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
package main | |
import ( | |
"net/http" | |
"fmt" | |
) | |
func main() { | |
http.HandleFunc("/", indexHandler) | |
http.HandleFunc("/about", aboutHandler) |
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
import sqlite3 | |
import os.path | |
import tornado.httpserver | |
import tornado.ioloop | |
import tornado.web | |
class TestApplication(tornado.web.Application): | |
def __init__(self): | |
handlers = [ |
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
#lang racket | |
(define (my-sum-1 lst) | |
(cond | |
((null? lst) 0) | |
(else (+ (car lst) (my-sum-1 (cdr lst)))))) | |
(define (my-sum-2 lst) | |
(define (my-sum-iter res lst) | |
(cond |
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
import curses | |
import time | |
class Direction(object): | |
NORTH=0 | |
EAST=1 | |
SOUTH=2 | |
WEST=3 | |
class Position(object): |
NewerOlder