I'm getting super confused by a function I'm writing in Racket. I may be too used to the let ... in
syntax from OCaml.
(define/public (get-rects)
(let wrap-edge ([(coords '()) (append coords tetramino-wh)])
(case current-type
[(0) (vector
(wrap-edge (list 0 0))
(wrap-edge (list tetramino-w 0))
(wrap-edge (list (* 2 tetramino-w) 0))
(wrap-edge (list (* 3 tetramino-w) 0)))])))
I am trying to do something along the lines of this in something like OCaml:
let wrap_edge = ... in
// Create a vector using wrap-edge
I can't wrap my head around what the best way to do this is. I know it would be easy to define wrap-edge as a sibling but if I wanted to to a "let in" kind of thing, define is not the right choice... Though I may just be making this arbitrarily harder on myself. Should it be something more like:
(let ([wrap-edge (lambda (coords) (append coords tetramino-wh))]))
Is this the only option? It just seems so bloated to do it this way.