Felix now has an increasing number of available data structures,
and I'm gradually expanding the pervasiveness of type classs.

With this technology, a statically typed language can gain much of
the look and feel of dynamic languages without sacrificing safety or 
performance.

A simple example of this is already implements. The expression:

        elt in set

is transformed to

        mem (elt, set)

which is now represented by typeclass:

typeclass Set[c,t] {
  virtual mem: t * c -> bool;
}

This basically means you can say

        x in a

where a is an array, list, Judy1Set, regexp, or any data structures providing
an instance of Set.

So lets examine something else we might want .. I'm fishing for ideas here .. :)

Consider:

var i: int; forall i in 0 upto len a - 1 do ... done

This is special syntax that only works for an integer range.
But is is basically an "iter" function. clearly it could work with any STL
container with a begin() and end() method. 

We could do this:

union range_t = Range of int * int;
fun begin (x:range_t) => match x with Range (?b,_) => b;
fun end (x:range_t) => match x with Range (_,?e)=> e;

and provide iterators, roughly we would say now:

var i: int; forall i in Range(0,len a -1) do .. done

instead. Using JudyL we can provide RangeSet (a set of non-overlaping ranges).

The usual function syntax for this is of course:

iter (fun (i:int) => .... ) data;

which is more or less modellable by

forall var i : int in data do .. done;


SImilarly, with some notion of iterable set, instead of using

map (fun (i:int) => .. ) data;

we might use a comprehension:

  set ( i+2 forall i in data)

The question is what syntax to use for which class models?
 


--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to