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
Var *classpath* not marked :dynamic true, setting to :dynamic. You should fix this before next release! | |
Exception in thread "main" java.io.FileNotFoundException: Could not locate mire/server__init.class or mire/server.clj on classpath: | |
at clojure.lang.RT.load(RT.java:412) | |
at clojure.lang.RT.load(RT.java:381) | |
at clojure.core$load$fn__4389.invoke(core.clj:5308) | |
at clojure.core$load.doInvoke(core.clj:5307) | |
at clojure.lang.RestFn.invoke(RestFn.java:409) | |
at clojure.core$load_one.invoke(core.clj:5132) | |
at clojure.core$compile$fn__4394.invoke(core.clj:5319) | |
at clojure.core$compile.invoke(core.clj:5318) |
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
#include <stdio.h> | |
displayword(char *word1) | |
{ | |
printf("the man will %s",word1); | |
} | |
int main(void) | |
{ | |
char verb1[100]; |
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
def Unit(pygame.sprite.Sprite): | |
images = None | |
def __init__(self, sprite_map): | |
if Unit.images == None: | |
Unit.images = load_images(sprite_map) | |
self.images = Unit.image.convert(Unit.images) | |
def load_assests(self, sprite_map): |
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
# This is meant to show trivial examples of currying. | |
# I know there are way more effective methods of doing this | |
# but this is meant to be illustrative, I also want to add | |
# a few non-trivial examples to show how its useful. | |
import operator | |
def curry(func, var): | |
y = var | |
def f(x): | |
return func(x, y) |
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
;;; forsight.scm | |
;;; by Justin Hamilton | |
;;; last updated May 20th 2011 (currently not done) | |
;;; released under BSD 2-clause license | |
;;; Global variables | |
(define *prompt* "forsight> ") | |
(define *dictionary* '((+ add-f) (- sub-f) (* mul-f) (/ div-f) (mod mod-f) | |
(/mod mod-div-f) (and and-f) (or or-f) (= eq-f) | |
(> gt-f) (< lt-f) (swap swap-f) (dup dup-f) |
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
#lang racket | |
(define *prompt* "> ") | |
(define *dictionary* '(("+" add-f))) | |
(define (push item stack) | |
(cons item stack)) | |
(define (pop stack) | |
(rest stack)) |
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
; Write a function which packs consecutive duplicates into a list | |
; (pack [1 1 2 1 1 1 3 3]) => '((1 1) (2) (1 1 1) (3 3))) | |
; (pack [[1 2] [1 2] [3 4]]) => '(([1 2] [1 2]) ([3 4]))) | |
(defn pack [n] | |
(letfn [(pack-iter [seen col curr out] | |
(cond | |
(empty? curr) (reverse (cons col out)) | |
(= seen (first curr)) (pack-iter seen (cons (first curr) col) (rest curr) out) | |
:else (pack-iter (first curr) '() curr (cons col out))))] |
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
; Write a function that drops every nth item from a sequence | |
(fn drop-nth [lat n] | |
(flatten (map #(if (= (count %) n) (drop-last %) %) | |
(partition-all n lat)))) |
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
;; Flatten a Sequence: Write a function which flattens a sequence. | |
(defn flat [n] | |
(let [x (first n) | |
xs (rest n)] | |
(cond | |
(empty? n) '() | |
(coll? x) (concat (flat x) (flat xs)) | |
:else (cons x (flat xs))))) |
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
;; Compress a sequence: Write a function which removes consecutive duplicates from a sequence. | |
;; old way | |
(defn comp-seq-old [n] | |
(cond | |
(empty? (rest n)) n | |
(= (first n) (first (rest n))) (comp-seq-old (cons (first n) (rest (rest n)))) | |
:else (cons (first n) (comp-seq-old (rest n))))) | |
;; new way |
OlderNewer