I use my list (www.rosycrew.org/list.factor) rather than sequences because I 
have trouble doing what I want with sequences.

For example, I want to find a node in the list and split the list into two 
lists at that point. With sequences, the function find returns an index into 
the sequence. None of the spliting functions take an index however. All of 
them are splitting on a particular subsequence. For me to use these, I would 
have to actually create a subsequence that is a model for what I'm looking 
for. That is complicated. Besides that, it will likely not work anyway, as I 
only want to test for some particular aspect of the node, rather than for a 
complete match. What I do with the lists is find my node by giving traverse 
a quotation that tests each node and stops on the one that I want. I then 
give split the head of the list and the middle node, and I get my two lists.

Also, sometimes I want to insert a list into the middle of another list at a 
certain point. This is easily done with my insert function. The problems 
with inserting into sequences are very similar to the problems with 
splitting sequences. Also, sometimes I want to remove a portion of a list 
from a list. This is also cumbersome with sequences.

Sequences are nice because they can be written as literals in the 
source-code using the curly brackets. Also, they print out in a nice visual 
manner, whereas my lists are a big unreadable mess. I find sequences to be 
difficult to manipulate though. It is possible that I just haven't learned 
enough about sequences. As I've said before, I'm not very good at learning 
OPC (other people's code), and it is generally easier for me to just write 
what I need from scratch. The downside though, is that my programs aren't 
idiomatic.

I had programmed in Forth for all of my life, and I had never even heard the 
word "idiomatic" until I started learning Factor. Most Forth programmers 
would be completely baffled by the suggestion that there is virtue in doing 
things the way that other people do them. They would consider that to be a 
most bizarre superstition.


------------------------------------------------------------------------------
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
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to