Skip to content
This repository has been archived by the owner on Jan 28, 2018. It is now read-only.

Commit

Permalink
gensym memroizeeq memorize1eq mal:atom?
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoqi committed Oct 29, 2017
1 parent dadbe2c commit c9d8b89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions mal.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
[number->string 'str]
string->number ; 没有实现
[equal? '=]
atom?
[atom! 'atom]
[atom-get 'deref]
[atom-set! 'reset!]
Expand Down
6 changes: 5 additions & 1 deletion zscm.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@
'()
(cons (cons (car xs) (cadr xs)) (%hash (cddr xs)))))
(define (hash . xs) (make-immutable-hash (%hash xs)))
(define (memorize1 f) f) ; zaoqil-core
(define (memroizeeq f) f) ; zaoqil-core
(define (memorize1eq f) f) ; zaoqil-core

(define (zero? x) (eq? x 0))
(define (positive? x) (> x 0))
Expand Down Expand Up @@ -326,6 +327,9 @@
(car xs)
(assf f (cdr xs)))))
(define (assoc x xs) (assf (λ (y) (equal? x y)) xs))

(define gensym% (atom! 0))
(define (gensym) (atom-map! (λ (x) (+ x 1)) gensym%))
))

(prelude
Expand Down

0 comments on commit c9d8b89

Please sign in to comment.