Skip to content

Instantly share code, notes, and snippets.

@eholk
Created February 24, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eholk/2860c7a09b67170c637a to your computer and use it in GitHub Desktop.
Save eholk/2860c7a09b67170c637a to your computer and use it in GitHub Desktop.
arbitrary array index with backpermute
(generate [3 3] (lambda (x y) (* (get A x) (get B y))))
<=>
(let ((As (backpermute [3 3] (lambda (x y) x) A))
(Bs (backpermute [3 3] (lambda (x y) y) B)))
(zipWith (*) As Bs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment