// // Title: Concepts of Programming Languages // Number: CAS CS 320 // Semester: Fall 2012 // Class Time: TR 12:30-2:00 // Instructor: Hongwei Xi (hwxiATcsDOTbuDOTedu) // Teaching Fellow: Alex Ren (arenATcsDOTbuDOTedu) // (* // // Assignment #2 // Due Thursday, January 31, 2013 at 11:59pm // *) (* ****** ****** *) // // Problem 1: 30 points // (* ****** ****** *) abstype point_type typedef point = point_type (* ****** ****** *) fun point_make (x: double, y: double): point fun point_get_x (p: point): double fun point_get_y (p: point): double (* ****** ****** *) abstype color_type typedef color = color_type fun color_make (r: double, g: double, b: double): color fun color_get_r (clr: color): double fun color_get_g (clr: color): double fun color_get_b (clr: color): double (* ****** ****** *) // // HX: // this function will be provided to you later. // It draws a triangle whose 3 vertices are located // at [p1], [p2], and [p3] and then paints the inside // of the triangle with the given color [clr] // fun draw3 ( p1: point, p2: point, p3: point, clr: color ) : void // end of [draw3] (* ****** ****** *) // // HX: // this function draws a Sierpinski triangle of level [n] // such that the 3 vertices of the triangle are located at // [p1], [p2] and [p3], and the two colors employed in the // drawing are clr1 and clr2. // fun // 30 points draw3_sierpinski ( p1: point, p2: point, p3: point, clr1: color, clr2: color, n: int ) : void // end of [draw3_sierpinski] (* ****** ****** *) (* end of [assignment2_draw.sats] *)