Skip to content

Instantly share code, notes, and snippets.

View lgaff's full-sized avatar
💭
Perpetual Procrastination

Lindsay Gaff lgaff

💭
Perpetual Procrastination
  • Sydney, Australia
View GitHub Profile
(defn ram [start length & {:keys [paged-in bank tag]
:or {paged-in false
bank 0}}]
;; I want to check here if :tag was added or not. But also i don't want to because style
(make-memory start length paged-in bank :text (vec (replicate length 0)) :writable true))
(defn- make-memory [start length paged-in bank & {:keys [text writable tag]}]
;; TODO: Maybe check that length and end - start are the same; fill with zeros if not.
{:start start
:end (+ start length)
@lgaff
lgaff / hsv-to-rgb.rkt
Created May 6, 2022 04:31
Convert HSV to RGB
(define (hsv-to-rgb hue saturation value)
(let* ([C (* saturation value)]
[A (abs (- (modulo (/ hue 60) 2)
1))]
[X (* (- 1 A))]
[m (- value C)]
[rgb-prime
(cond
[(<= 0 hue 59) `(,C ,X 0)]
[(<= 60 hue 119) `(,X ,C 0)]