> Message: 2 > Date: Tue, 29 Sep 2009 13:10:55 +0900 > From: Jon Harper <[email protected]> > Subject: Re: [Factor-talk] trash list, but keep symtab > To: [email protected] > Message-ID: > <[email protected]> > Content-Type: text/plain; charset=ISO-8859-1 > > Have you looked at these articles ? > http://docs.factorcode.org/content/article-sequences-destructive.html > http://docs.factorcode.org/content/article-sequences-destructive-discussion.html
No I hadn't, so thanks for the tip. I agree that making new sequences is generally better than modifying existing sequences because programming without side-effects is a virtue. What I had found cumbersome is that some sequence operations do it one way, and some the other way, whereas my lists had only supported in-place modification and required clone-list to be be called explicitely to make a new list. I'm pretty much getting the hang of sequences now though, and have put aside list. I was primarily confused because I didn't realize that in Factor some datums (tuples) are passed by reference, and some datums (numbers) are passed by value. This confused the heck out of me because I am accustomed to languages such as C in which passing by reference is specified explicitely (with the &), but is not implicitely implied by the data type being used. A sequence with numbers in it would not be easily modified in place, but a sequence with tuples in it would be easilty modified in place because the datums are all references to the original data that is someplace else. A sequence with a mixture of numbers and tuples in it would be "corrupted" by the numbers in it, which would prevent it from being modified in place. It seems to me that having the data type imply whether the datum is by reference or value is in contradiction to the philosophy of dynamic typing in which the programmer supposedly doesn't have to worry about what types his datums are. With Factor's system, the programmer has to know the type of the datum so that he can know if it is a reference or a value. Is there anyway to know (other than by experimentation) which data types are passed by reference and which by value? ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
