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 scheme | |
; sudoku solver | |
; sample: | |
;+-------+-------+-------+ | |
;| 6 7 . | . 2 1 | . 4 . | | |
;| . . . | 7 . . | . 3 . | | |
;| . 5 . | 8 . . | 6 . . | | |
;+-------+-------+-------+ | |
;| 7 . 6 | 1 . 2 | 9 . . | |
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 scheme | |
; http://www.dailysudoku.com/sudoku/archive/2012/02/2012-02-10.shtml | |
(define easy-game "020580000093600007001007000609102300180030059005908104000800500200009760000015080") | |
(define (to-number char) | |
(- (char->integer char) 48)) | |
(define (to-vector string) | |
(list->vector (map to-number (string->list string)))) |
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
(def ^{:private true} empty-string "") | |
(def ^{:private true} single-comma ",") | |
(def ^{:private true} l-or-st #"(((L|ST)=\w*)| )") | |
(def ^{:private true} multiple-commas #"(,{2,}|,*\z)") | |
(def ^{:private true} lost-commas #"(\A,*|,*\z)") | |
(defn- remove-local [issuer-name] | |
(reduce | |
(fn[a b] | |
(replace a (first b) (second b))) |
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
(defn setup [] | |
println "Yes, we have setup!") | |
(defmacro run-if-exists [name] | |
`(if (clojure.test/function? '~name) | |
((println "Calling function") | |
~name) | |
(println "Function not found"))) | |
(macroexpand '(run-if-exists setup)) |
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
; I need to write code to make this pass: | |
; https://github.com/pbalduino/north/blob/master/test/north/test/core.clj | |
; First I wrote that | |
(defn be-true [result] | |
(assert (= result true) (format "Assertion failed. %s was expected to be true" result))) | |
; So I added be-false and slightly changed be-true | |
; Then I noticed there's duplication of code there |
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
$ lein test north.test.result | |
Running tests | |
Feature name: In some strange context it should do this | |
--> Uhu! | |
OK | |
Feature name: In some strange context and it should do that | |
--> Another test | |
OK |
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
Before all - root | |
Before each - root | |
Test - root before | |
After each - root | |
Before each - root | |
Test - root after | |
After each - root | |
Before all - context | |
Before each - root | |
Before each - context |
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 "FirstClass.h" | |
@implementation FirstClass | |
-(NSString *) meh; | |
{ | |
NSLog(@"meh"); | |
return @"meh"; | |
} | |
-(NSString *) foo: (int)bar; |
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 <Foundation/Foundation.h> | |
@interface FirstClass : NSObject { | |
NSString* name; | |
} | |
-(NSString*) meh; | |
-(NSString*) foo: (int)bar; | |
@end |
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
# lista de compras | |
lista = [] | |
lista << meia.duzia * cenoura | |
lista << meia.duzia * cebola | |
lista << 1.saco_cheio * batatas | |
if ovo.price <= 2.5 | |
lista << 1.bandeja * ovo |