Skip to content

Commit

Permalink
Refactor prelude (#2101)
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe authored Feb 17, 2025
1 parent 9b20b75 commit 6b78374
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions prelude.scm
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@
fold-left
fold-right
reduce-right
member-position
memq-position
memv-position
member-position
list-copy

bytevector?
Expand Down Expand Up @@ -1001,6 +1002,9 @@
(else
(loop (cdr xs) (+ index 1))))))

(define (memq-position x xs)
(member-position x xs eq?))

(define (memv-position x xs)
(member-position x xs eqv?))

Expand Down Expand Up @@ -1274,7 +1278,7 @@
(list-set! (rib-cdr record) index value))))

(define (field-index type field)
(memv-position field (cdr type)))
(memq-position field (cdr type)))

;; Tuple

Expand Down Expand Up @@ -1516,8 +1520,6 @@
fold-left
fold-right
reduce-right
member-position
memv-position
list-copy

bytevector?
Expand Down Expand Up @@ -2563,7 +2565,7 @@
(scheme base)
(scheme cxr)
(scheme repl)
(only (stak base) data-rib filter list-head memv-position pair-type procedure-type rib))
(only (stak base) data-rib filter list-head memq-position pair-type procedure-type rib))

(begin
(define eval
Expand Down Expand Up @@ -3097,7 +3099,7 @@

; If a variable is not in environment, it is considered to be global.
(define (compilation-context-resolve context variable)
(or (memv-position variable (compilation-context-environment context)) variable))
(or (memq-position variable (compilation-context-environment context)) variable))

;; Procedures

Expand Down

0 comments on commit 6b78374

Please sign in to comment.