On 23/09/2013, at 9:26 PM, john skaller wrote: And a slight variation:
/////////// bits = true, /**/ true, false, true, /**/ true; var q = bits :>> (2 * 2^3 * 2); println$ (q . 0) :>> int; println$ (q . 1) :>> int; println$ (q . 2) :>> int; println$ q . 1; ///////////////// 1 5 1 (true, false, true) //////////////// Notice the different type: 2^3 rather than 8. 8 is just 8 choices. There's no print for that. But 2^3 is an array of 3 bits! So that's printable. One of the things to get used to is that for types all the familiar index laws are FALSE as equalities, but TRUE as isomorphisms. Thus 2 + 2 != 4 != 2^2. But they're all isomorphic. The intent of the type coercion operator :>> is to effect these isomorphisms. Note NOT all of them: 2 * 3 is isomorphic to 3 * 2 but we don't want to allow that: the isomorphism just swaps the first and second values in the tuple. We only want to allow isomorphisms that are also reinterpret casts, not ones that actually require moving data around. [Note, record coercions move data around, different fish but the same coercion symbol .. should fix, but imagination lacking :] -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language