Skip to content

Instantly share code, notes, and snippets.

@soegaard
Created June 10, 2014 17:55
Show Gist options
  • Save soegaard/022bfc32366983d72f99 to your computer and use it in GitHub Desktop.
Save soegaard/022bfc32366983d72f99 to your computer and use it in GitHub Desktop.
Vector product
(define (cross-product a b)
(for/matrix 3 1 ([n 3])
(define (ref c i) (matrix-ref c (modulo (+ n i) 3) 0))
(- (* (ref a 1) (ref b 2)) (* (ref a 2) (ref b 1)))))
(cross-product (col-matrix [1 0 0])
(col-matrix [0 1 0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment