Mercurial > urweb
comparison src/core_env.sml @ 1080:a4979e31e4bf
Another try at reasonable Especialize, this time with a custom traversal
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 20 Dec 2009 15:17:43 -0500 |
parents | 0657e5adc938 |
children | c316ca3c9ec6 |
comparison
equal
deleted
inserted
replaced
1079:d069b193ed6b | 1080:a4979e31e4bf |
---|---|
366 | PPrim _ => 0 | 366 | PPrim _ => 0 |
367 | PCon (_, _, _, NONE) => 0 | 367 | PCon (_, _, _, NONE) => 0 |
368 | PCon (_, _, _, SOME p) => patBindsN p | 368 | PCon (_, _, _, SOME p) => patBindsN p |
369 | PRecord xps => foldl (fn ((_, p, _), count) => count + patBindsN p) 0 xps | 369 | PRecord xps => foldl (fn ((_, p, _), count) => count + patBindsN p) 0 xps |
370 | 370 |
371 fun patBindsL (p, loc) = | |
372 case p of | |
373 PWild => [] | |
374 | PVar (x, t) => [(x, t)] | |
375 | PPrim _ => [] | |
376 | PCon (_, _, _, NONE) => [] | |
377 | PCon (_, _, _, SOME p) => patBindsL p | |
378 | PRecord xps => rev (ListUtil.mapConcat (rev o patBindsL o #2) xps) | |
379 | |
371 end | 380 end |