29.04.2014 Views

Presburger Arithmetic and Its Use in Verification

Presburger Arithmetic and Its Use in Verification

Presburger Arithmetic and Its Use in Verification

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APPENDIX B. SOURCE CODE OF EXPERIMENTS<br />

// Calculate lcm of a list of positive <strong>in</strong>teger.<br />

// Rewrite to use tail recursion.<br />

let lcms ls =<br />

let rec recLcms ls res =<br />

match ls with<br />

|[]−> res<br />

| l::ls’ −> recLcms ls’ (lcm(res, abs(l)))<br />

recLcms ls 1<br />

let lcma ls =<br />

Array.fold(fun acc l −> lcm(abs(l), acc)) 1 ls<br />

72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!