On Mon, Feb 16, 2009 at 12:57 AM, Mike Moretti <[email protected]> wrote:
>
> Speaking of functional style, in languages such as Clean, one can implement 
> functional data structures that are always persistent, that is, an update of 
> these structures does not destroy the existing version, instead a new version 
> is created which is coexistent with the previous version. This allows for 
> sharing of common data. A common example would be the concatenate operation 
> on lists where the first and last cell of the list are maintained in order to 
> support an 0(1) time. In a functional data structure one would make a copy of 
> the first list changing the next pointer (or equivalent) of the last cell to 
> point to the second list, thus sharing the second list, and the two lists 
> still exist in their original form. Is this something that is easily 
> achievable in Factor?

Yes, in Factor we make heavy use of functional idioms, for example we
prefer to construct new sequences instead of modifying inputs, and so
we use words like 'map' a lot more than 'change-each', and 'append'
more than 'push-all'. Some of this is expained at
http://docs.factorcode.org/content/article-sequences-destructive.html.

While sequences and assocs do support mutation, we also have
persistent versions which share structure on updates in the
persistent.vectors and persistent.hashtables vocabularies. These two
were based on the PersistentVector and PersistentHashMap data types in
the Clojure language.

There are also persistent deques in persistent.deques, and persistent
linked lists in the lists vocabulary. Data structures are one of
Factor's strong points, take a look at
http://docs.factorcode.org/content/tag-collections.html to see what
types and algorithms are available.

> I am quite impressed with the whole Factor environment, the language, the UI, 
> emacs integration and the extremely large number of very useful libraries.

Thanks! There is still a lot of work to be done but we're making good progress.

Let me know if you have further questions.

Slava

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to