trying not to leak memory

This commit is contained in:
FelixBrendel
2019-10-30 00:47:52 +01:00
parent 814cceaf3d
commit a790a38655
22 changed files with 204 additions and 78 deletions
+4
View File
@@ -0,0 +1,4 @@
(define a 10)
(define (get-a-1)
a)
+8
View File
@@ -0,0 +1,8 @@
(import "import1.slime")
(define (set-a-2 s)
(set! a s))
(define (get-a-2)
a)
+1 -1
View File
@@ -88,7 +88,7 @@
(define (range (:from 0) :to) :doc "Returns a sequence of numbers starting with the number defined\nby the key =from= and ends with the number defined in =to=." (when (< from to) (pair from (range :from (+ 1 from) :to to))))
(define (range-while (:from 0) to) :doc "Returns a sequence of numbers starting with the number defined\nby the key 'from' and ends with the number defined in 'to'." (define result (list (copy from))) (define head result) (mutate from (increment from)) (while (< from to) (begin (mutate head (pair (first head) (pair (copy from) nil))) (define head (rest head)) (mutate from (increment from)))) result)
(define (range-while (:from 0) :to) :doc "Returns a sequence of numbers starting with the number defined\nby the key 'from' and ends with the number defined in 'to'." (define result (list (copy from))) (define head result) (set! from (increment from)) (while (< from to) (begin (mutate head (pair (first head) (pair (copy from) nil))) (define head (rest head)) (set! from (increment from)))) result)
(define (map fun seq) :doc "Takes a function and a sequence as arguments and returns a new\nsequence which contains the results of using the first sequences\nelemens as argument to that function." (if (null? seq) seq (pair (fun (first seq)) (map fun (rest seq)))))
BIN
View File
Binary file not shown.
+8 -8
View File
@@ -89,13 +89,13 @@
;; :key2 value2,
;; :key1 value1))
(assert (= (length (first p)) 6))
(assert (= (ds::plist::get p :key1) 'value4))
;; (assert (= (length (first p)) 6))
;; (assert (= (ds::plist::get p :key1) 'value4))
(ds::plist::remove! p :key1)
;; p == ((:key2 value2,
;; :key1 value1))
;; (ds::plist::remove! p :key1)
;; ;; p == ((:key2 value2,
;; ;; :key1 value1))
(assert (= (length (first p)) 4))
(assert (= (ds::plist::get p :key1) 'value1))
(assert (= (ds::plist::get p :key2) 'value2))
;; (assert (= (length (first p)) 4))
;; (assert (= (ds::plist::get p :key1) 'value1))
;; (assert (= (ds::plist::get p :key2) 'value2))
+17
View File
@@ -0,0 +1,17 @@
(import "import1.slime")
(assert (= a 10))
(assert (= (get-a-1) 10))
(import "import2.slime")
(assert (= a 10))
(assert (= (get-a-1) 10))
(assert (= (get-a-2) 10))
(set-a-2 11)
(assert (= a 11))
(assert (= (get-a-1) 11))
(assert (= (get-a-2) 11))