User loginNavigation |
Type system that can type list structure?I'm looking for example type systems that can type list structure. For a simple example... (Sorry, I think in code) // Map two elts at a time, not two lists def map2(alist:List, f(*,* -> 'u) -> 'u List) // f(*,*) is not good def mklis(nl: 'u List, rest: List) match rest | a :: b :: r -> mklis(f(a,b) :: nl, r) // types of a and b? | else -> reverse(nl) in mklis(nil, alist); def plist2alist(plist:List -> <List>List) map2(plist, fn(a,b) a :: b :: nil); plist2alist('(A, 1, B, 2, C, 3)) => ((A,1),(B,2),(C,3)) It would be very nice to type plist's internal structure, thus allowing for typing the map2 function, plist2alist()'s resulting internal structure, etc. I can sort of imagine some kind of regex typing construct, but I have no clear ideas on this. Any languages out there do a good job of typing repeating internal patterned structure like this? If this is impossible for any theoretical reason, I'd love to know that too :-) Many thanks. Scott By scottmcl at 2008-06-27 00:10 | LtU Forum | previous forum topic | next forum topic | other blogs | 4609 reads
|
Browse archivesActive forum topics |
Recent comments
7 weeks 1 day ago
7 weeks 3 days ago
7 weeks 4 days ago
14 weeks 4 days ago
20 weeks 2 days ago
20 weeks 3 days ago
21 weeks 2 days ago
24 weeks 18 hours ago
25 weeks 3 days ago
25 weeks 4 days ago