On 7 April 2014 09:58, Waldek Hebisch <[email protected]> wrote: > Bill Page wrote: >> >> Why did you choose List SingleInteger as the return type of uentries? >> it seems a little none standard. I see that ucodeToString has Integer >> -> String and >> ord$Character returns Integer and char has Integer -> Character. > > One reason is to make it potentially more efficient. You > can cheaply and safely convert SingleInteger to Integer > (in fact, in many cases compiler will do this automatically > for you), but safely going in the opposite direction requires > a test (if you are sure that number are in reange you can > use 'qconvert'). Also, the result is codepoints, so > SingleInteger helps to remaid users that they are not > arbitrary integers. Overall, reasons are not strong...
OK. Perhaps it would also be nice if ucodeToString took SingleInteger as input? > > I see that compiler forced you to write things like '120537::SI'. > I admit that I forgot about this, we probably should modify > compiler to accept integer literals as SingleInteger. > +1 >> I wrote: >> >> cork(x) == >> for i in Cork repeat >> if ord(i.unicode.1)::SingleInteger = x then return i.corkcode >> char(x::Integer)::String >> >> but maybe that should be >> >> cork(x) == >> for i in Cork repeat >> if ord(i.unicode.1)::SingleInteger = x then return i.corkcode >> ucodeToString(x::Integer) >> >> I am not sure. > > IIUC the translation table is supposed to contain all nontrivial > unicode characters appearing in the output. So the last > line of 'cork' should be executed only for ASCII characters. > If that is the case, then both variants are equivalent. > The difference is if there are untranslated unicode characters. > 'char' in such case may send complete garbage. 'ucodeToString' > will send valid UTF-8. What Texmacs will do with UTF-8 is > another story, but in the second variant we will send > something sensible, so it looks better. > OK -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/fricas-devel. For more options, visit https://groups.google.com/d/optout.
