[racket] Is there a functional "array-set" for math/array?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Mon Jul 14 19:19:49 EDT 2014

Is there a functional "array-set" for math/array?

And if there isn’t, then would this be a good definition for it?:
(: array-set : (All (a) [(Array a) In-Indexes a -> (Array a)]))
(define (array-set arr update-pos val)
  ((inst build-array a)
   (array-shape arr)
   (lambda ([pos : Indexes])
     (cond [(equal? pos update-pos) val]
           [else (array-ref arr pos)]))))


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140714/5b5900f2/attachment.html>

Posted on the users mailing list.