Skip to content

Commit

Permalink
Remove alloc-str in Hustle.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvanhorn committed Dec 2, 2024
1 parent c9e147c commit 167e539
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions hustle/heap.rkt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#lang racket
(provide alloc-box alloc-cons alloc-str heap-ref heap-set)
(provide alloc-box alloc-cons heap-ref heap-set)

;; Value* Heap -> Answer*
(define (alloc-box v h)
Expand All @@ -11,11 +11,6 @@
(cons (cons v2 (cons v1 h))
(list 'cons (length h))))

;; String Heap -> Answer*
(define (alloc-str s h)
(cons (append (reverse (string->list s)) (list (string-length s)) h)
(list 'str (length h))))

;; Heap Address -> Value*
(define (heap-ref h a)
(list-ref h (- (length h) (add1 a))))
Expand Down

0 comments on commit 167e539

Please sign in to comment.