Data Bases
Custom Term Papers
Free Term Papers
Free Research Papers
Free Essays
Free Book Reports
Plagiarism?
Links
Top 100 Term Paper Sites
Top 25 Essay Sites
Top 50 Essay Sites
Search 97,000 Papers @ DirectEssays.com
Search 101,000 Papers @ ExampleEssays.com
Search 90,000 Papers @ MegaEssays.com
Free Essays
Term Paper Sites
Chuck III's Free Essays
Free College Essays
TermPaperSites.com
Free Essays
My Term Papers
Essay World
Planet Papers
Search Lots of Essays
Back to Subjects
-
Computers
ML
ML (* example input for polynomial 1 is 2.3,4.4,5.5,6.6 polynomial # 2 3.3,4.4,6.6,7.7,8.8,9.7 *) (* program add two polynomials together *) (* to run you must have SML installed for windows pc and save this file as a on c: drive run sml and type use("filename.txt"); *) else h::deleteall v t; swrite "********* ENTER 1ST POLYNOMIAL *********** "; val poly1 = map convert1(deleteall #"n"(deleteall #","(deleteall #"."(explode(t))))); swrite "********* ENTER 2ND POLYNOMIAL *********** "; val poly2 = map convert1(deleteall #"n"(deleteall #","(deleteall #"."(explode(s))))); val polyodd1 = map convert2(odd(poly1)); val polyodd2 = map convert2(odd(poly2)); val polyeven1 = map convert3(even(poly1)); val polyeven2 = map convert3(even(poly2)); fun map2 f (h1::t1) (h2::t2) = f h1 h2::map2 f t1 t2 | val First_Polynomial = add2 (polyodd1) (polyeven1); val Second_Polynomial = add2 (polyodd2) (polyeven2); | padd((p:real)::ps, q::qs) = (p+q)::padd(ps,qs); val The_Sum_of_Two_Polynomials = padd((First_Polynomial), (Second_Polynomial)); fun answer(nil) = print("**********") swrite "***************************************************"; swrite "*************** THE OUTPUTS ARE *******************"; swrite "*********** THE FIRST POLYNOMIAL ******************"; swrite "********* ORDERED FROM LOW TO HIGH ***************"; swrite "***************************************************"; swrite "*********** THE SECOND POLYNOMIAL *****************"; swrite "********* ORDERED FROM LOW TO HIGH ***************"; swrite "***************************************************"; swrite "********* THE SUM OF BOTH POLYNOMIALS *************"; swrite "*********** TERM BY TERM ADDITION *****************"; swrite "***************************************************"; Bibliography: Greg Michaelson, "Elementary Standard ML" Jeffery D Ullman "Elements of ML Programming", Prentice Hall, ML97 edition
Word Count: 463
Copyright © 1998-2008
College Term Papers
, INC All Rights Reserved.
DMCA Notifications and Requests