11 Apr 2008 tampe   » (Apprentice)

Somtimes you do not need music, you are music!!!

Oh well, have had an excellent dinner and thoughts are flowing. First of if I have not state this before I will do that know, I speak often of my tool of choise, Qi. If you read their home page they will as usually try their best to market itself, nothing strange. But I speak of Qi because it's my tool of choise, I have to be polite to it and be constructive. My main intention though is to speak generally and if there is any good in this creativity others can copy as they like, no need to cite and comment and so on this is just a monolog of my creativity - no rules, just music.

I guess that this has been discussed forever. But the question is, what syntactic sugar shall be used. A general API that will give you power to do what you want, no artificial limit's. This creature is in one corner, the other one nice short readable syntax for a larger set of common cases to make sure that they will not be the one that stand's in your way. If you like, free text versus structured text with predefined set'd of choises.

Just now my brain floods over by examples. But let's refere to the pattern that I'm currently exploring. In one corner a general yield statment or plain for and while loops and in the other corner a syntactic suger of operators helping patterns of iterator constructs.

Doing things like (for i in (times N) summing i) can trivially be expressed in a yield statement and all other of my effort can easally be expressed with that style (and of cause common standard iterations). If people start using iterators common iterating pattern will be modelled and abstracted. On the other hand if every project defines their own name and syntax for an abstraction of iterators we will have portability issues, communication issues, new people will have a harder time to go from one project to another. Student's have to learn more by hand and so on.

So my observation is that in this light there might be room for standardizing a few patterns in iterations and make a more delicate model of iteration. I'm not beliving in these words (I generally do not beleve in anyone) just state them and take my keybord with me in this direction to see what I get

for example this mashup iterator could be interesting

(for I in ([.li tree 
            (li o tree) 
            (+ ar c-code (| python perl))] Data) 
   summing I.length )
e.g. take the data treat it as a list with the first element beeing a tree that we walk into, after that go to the next element that is a list of trees that we the dive into. The third part is a iteratative pattern of one or more iterator patterns that holds first an array, then some c-code and finally a python or perl section.

Take any idea of regex and parsers, you can port it to a generator context like above. Quite powerful? yes, you can make parsers. Useful? perhaps might be slow. New?, nyes, the patterns are old, not usually stated in a iterator context though.

The standard OO way is of cause to state common iteration patterns is to attach the iterators to standardized bins and then use a sequence of for loops. This is actually a very smart idea. Hmm, Oh well, let's stop the music and let the keybord play...

Latest blog entries     Older blog entries

New Advogato Features

FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!