Michael, I think that calls for a type-class! <div>(though I imagine theres a slicker way of writing it)</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 11, 2012 at 11:18 PM, Michael Orlitzky <span dir="ltr"><<a href="mailto:michael@orlitzky.com" target="_blank">michael@orlitzky.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11/10/2012 06:59 AM, Aleksey Khudyakov wrote:<br>
> Hello cafe!<br>
><br>
> I want to announce library for the small vectors of fixed length<br>
> fixed-vector[1]. Fixed means that vector's length is determined<br>
> by its type.<br>
><br>
> Generic API can work with both ATD-based vector like complex or<br>
> Vec written below and array-based ones.<br>
><br>
>> data Vec a = Vec a a a<br>
><br>
> It's based on post by Roman Leschinsiy[2].<br>
><br>
><br>
> Library also provide array-based vectors with memory<br>
> representation similar to onves from vector package. It's more<br>
> compact though because there is no need to store lengh and and<br>
> offset to first element.<br>
><br>
> [1] <a href="http://hackage.haskell.org/package/fixed-vector" target="_blank">http://hackage.haskell.org/package/fixed-vector</a><br>
> [2] <a href="http://unlines.wordpress.com/2010/11/15/generics-for-small-fixed-size-vectors/" target="_blank">http://unlines.wordpress.com/2010/11/15/generics-for-small-fixed-size-vectors/</a><br>
<br>
<br>
</div>I have a lot of one-off code where I've defined these myself. Is it<br>
possible to e.g. define vectors in R^2 and R^3, and write the p-norm<br>
functions only once?<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>