Jump to content

Vector products: Difference between revisions

m
→‎{{header|Factor}}: whitespace/style tweaks
m (→‎{{header|Factor}}: whitespace/style tweaks)
Line 1,024:
=={{header|Factor}}==
Factor has a fantastic <tt>math.vectors</tt> vocabulary, but in the spirit of the task, it is not used.
<lang factor>USING: arrays io locals math prettyprint sequences ;
<lang factor>
USING: arrays io locals math prettyprint sequences ;
IN: rosetta-code.vector-products
 
: dot-product ( a b -- dp ) [ * ] 2map sum ;
Line 1,055 ⟶ 1,053:
"a . (b x c): " write a b c scalar-triple-product .
"a x (b x c): " write a b c vector-triple-product .
]</lang>
]
</lang>
{{out}}
<pre>
1,827

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.