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
PKGCONFIG_DIR = /usr/local/lib/pkgconfig | |
foxc.pc: foxc.pc.erb | |
echo "generate .pc.erb -> .pc" | |
erb foxc.pc.erb > foxc.pc | |
clean: | |
rm foxc.pc | |
distclean: clean |
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
default: | |
echo "(+ 1 2) (+ 10 3)" | ruby tlisp.rb |
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> | |
#include <stdlib.h> | |
void f(int *cands, int *tmp, int life, int i, int size){ | |
if(life==0){ | |
for(int i=0;i<size;i++){ | |
printf("%d", tmp[i]); | |
putchar(i==size-1 ? '\n' : ','); | |
} | |
} |
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
task :graph do | |
sh <<SH | |
gosh indented-to-dot.scm indented.txt > a.dot | |
dot -Tpng a.dot > a.png | |
SH | |
end | |
task :default => [:graph] |
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
(use gauche.experimental.ref) | |
(use util.match) | |
(use gauche.experimental.lamb) | |
(use file.filter) | |
(define-class <node> () | |
[(item :init-keyword :item) | |
(children :init-keyword :children)]) | |
(define (make-node e) |
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
(use srfi-42) | |
(sum-ec (: i 1 1000) (if (or (zero? (modulo i 3)) (zero? (modulo i 5)))) i) |
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
(use srfi-1) | |
(use srfi-42) | |
(define (f n) | |
(let1 sources (list-ec (: a 2 (+ n 1)) (: b 2 (+ n 1)) (expt a b)) | |
(length (delete-duplicates sources)))) | |
(f 5) ; => 15 | |
(f 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
(use gauche.experimental.lamb) | |
(define (flatten* tree :optional (r '())) | |
(fold (^ (x r*) (if (list? x) (flatten* x r*) (cons x r*))) | |
r tree)) | |
(define flatten (compose reverse flatten*)) | |
(flatten '((((1 ((2 (((3 ((4)))))))))))) ; => (1 2 3 4) |
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
(use util.combinations) | |
(use gauche.experimental.lamb) | |
(use srfi-1) | |
(load "./util.scm") | |
;;; util | |
(define (uniq? xs) | |
(let1 u (delete-duplicates xs) | |
(and (= (length xs) (length u)) u))) |
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-syntax snlet | |
(syntax-rules (=) | |
[(_ x = val rest ...) | |
(let ((x val)) | |
(snlet rest ...))] | |
[(_ body) | |
body])) | |
(snlet foo = 1 | |
bar = 2 |