Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

Usage

$ git clone https://gist.github.com/5480012.git chapter1
$ cd chapter1

# create new file
$ make new TARGET=q1
$ ls
0-My-SICP-Template-README.md Makefile README.md q1.scm template.scm utils.scm

# solve
$ vim q1.scm

# check
$ make q1
gosh q1.scm
q1========================================

q1========================================/

$ make new TARGET=q2
$ vim q2.scm

$ make q2
gosh q2.scm
q2========================================

q2========================================/

# check all
$ make
gosh q1.scm
q1========================================

q1========================================/

gosh q2.scm
q2========================================

q2========================================/
test:
new: $(TARGET).scm
$(TARGET).scm:
sed -i "" "1s/^\(test:.*\)$$/\1 $(TARGET)/" Makefile
sed -e "s/q\.num/$(TARGET)/g" ./template.scm > $(TARGET).scm
echo '\n$(TARGET):\n\tgosh $(TARGET).scm' >> Makefile
; ====== q.num
(load "./utils.scm")
(start "q.num")
(finish "q.num")
; ======/q.num
(define false #f)
(define true #t)
(define (p a)
(print a))
(define (pb a)
(print a)
(print ""))
(define (start a)
(display a)
(pb "========================================"))
(define (finish a)
(display a)
(pb "========================================/"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.