Mercurial > urweb
comparison src/sqlcache.sml @ 2239:f70a91f7810d
Add limited support for parsing SQL arithmetic.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Tue, 07 Jul 2015 00:07:24 -0700 |
parents | e79ef5792c8b |
children | 88cc0f44c940 |
comparison
equal
deleted
inserted
replaced
2238:7f92d70a326e | 2239:f70a91f7810d |
---|---|
408 val mergeEqs : (atomExp IntBinaryMap.map option list | 408 val mergeEqs : (atomExp IntBinaryMap.map option list |
409 -> atomExp IntBinaryMap.map option) = | 409 -> atomExp IntBinaryMap.map option) = |
410 List.foldr (fn (SOME eqs, SOME acc) => SOME (IM.unionWith #1 (eqs, acc)) | _ => NONE) | 410 List.foldr (fn (SOME eqs, SOME acc) => SOME (IM.unionWith #1 (eqs, acc)) | _ => NONE) |
411 (SOME IM.empty) | 411 (SOME IM.empty) |
412 | 412 |
413 val simplify = | |
414 map TS.listItems | |
415 o removeRedundant (fn (x, y) => TS.isSubset (y, x)) | |
416 o map (fn xs => TS.addList (TS.empty, xs)) | |
417 | |
413 fun dnf (fQuery, fDml) = | 418 fun dnf (fQuery, fDml) = |
414 let | 419 normalize simplify negateCmp Disj (Combo (Conj, [markQuery fQuery, markDml fDml])) |
415 val simplify = | |
416 map TS.listItems | |
417 o removeRedundant (fn (x, y) => TS.isSubset (y, x)) | |
418 o map (fn xs => TS.addList (TS.empty, xs)) | |
419 in | |
420 normalize simplify negateCmp Disj (Combo (Conj, [markQuery fQuery, markDml fDml])) | |
421 end | |
422 | 420 |
423 val conflictMaps = List.mapPartial (mergeEqs o map eqsOfClass o equivClasses) o dnf | 421 val conflictMaps = List.mapPartial (mergeEqs o map eqsOfClass o equivClasses) o dnf |
424 | 422 |
425 end | 423 end |
426 | 424 |