User loginNavigation |
archivesOptimal map APIThis has just crossed my mind: Functional APIs and imperative ones often differ in the way that functional ones make use of function-passing as a way to manipulate data. For example, in Haskell, there's filter: filter :: (a -> Bool) -> [a] -> [a] Used like this: filter somecondition oldlist For lists, this can be simulated in say, Java by using: ListIterator<E> it = list.listIterator(); while(it.hasNext()) { if(!somecondition(it.next())) { it.remove(); } } While it is possible to implement this and other operations on lists equally fast, it doesn't seem to be the case for maps. Consider the following task: alter :: (Maybe a -> Maybe a) -> k -> Map k a -> Map k a In this case: alter (\x -> case x of Just v -> if v < n then Nothing else Just (v+n) Nothing -> Just n) str oldmap This traverses the tree exactly once, while my Java implementation Integer value = map.get(str); if(value==null) { map.put(str,n); } else { if(value<n) { map.remove(str); } else { map.put(str,n+value); } } traverses the map twice(once for retrieval, once for insertion/deletion). Lambda expressions in VB.NETI thought folks might be interested to see that lambda expressions are coming to Visual Basic .NET. http://www.panopticoncentral.net/archive/2006/12/08/18587.aspx There's an interesting discussion going on concerning the proposed syntax. By Michael Dorfman at 2006-12-11 08:58 | LtU Forum | login or register to post comments | other blogs | 11072 reads
excitement in language research?I'm starting grad school in computer science next year and I'm hoping to focus on languages. Needless to say, LtU is a daily favorite. The contributors here have introduced me to many interesting papers and discussions. I'm curious to hear from people who are working in the field, going to conferences, etc... What are some active areas in language research today? What do you think are the most exciting recent developments? What about visual programming? Multi-paradigm programming (or programming 'paradigms' period)? Compiler design and optimization? Language support for concurrency? Formalisms for computation, translation, type-systems... I hope this isn't too intense. Thanks in advance. |
Browse archivesActive forum topics |
Recent comments
28 weeks 1 day ago
28 weeks 1 day ago
28 weeks 1 day ago
50 weeks 3 days ago
1 year 2 weeks ago
1 year 4 weeks ago
1 year 4 weeks ago
1 year 6 weeks ago
1 year 11 weeks ago
1 year 11 weeks ago