User Tools

Site Tools


cs330_f2016:labhppint

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
cs330_f2016:labhppint [2016/10/12 14:50]
wingated created
cs330_f2016:labhppint [2021/06/30 23:42] (current)
Line 1: Line 1:
 +=====BYU CS330 - Concepts of Programming Languages - HP Int Lab=====
 +
 ====Objective:​==== ====Objective:​====
  
Line 29: Line 31:
 The primary deliverable for this lab is a new Julia module. ​ Your module should export ''​parse'',​ ''​calc'' ​ ''​analyze''​ functions, and three return types, ''​NumVal'',​ ''​ClosureVal'',​ and ''​MatrixVal''​. The primary deliverable for this lab is a new Julia module. ​ Your module should export ''​parse'',​ ''​calc'' ​ ''​analyze''​ functions, and three return types, ''​NumVal'',​ ''​ClosureVal'',​ and ''​MatrixVal''​.
  
-Your module should be able to do everything that the three previous interpreters. ​ You are welcome to examine the code we developed in class. ​ The ''​CI8.jl''​ module is available on LearningSuite,​ under "​Content -> Julia -> High Performance Primitives"​.+Your module should be able to do everything that the three previous interpreters ​could do.  You are welcome to examine the code we developed in class. ​ The ''​CI6.jl''​ module is available on LearningSuite,​ under "​Content -> Julia -> High Performance Primitives"​.
  
 Please name your module ''​HPInt''​. Please name your module ''​HPInt''​.
Line 53: Line 55:
           | (/ <OWL> <​OWL>​)           | (/ <OWL> <​OWL>​)
           | (mod <OWL> <​OWL>​)           | (mod <OWL> <​OWL>​)
-          | (collatz ​<​OWL>​) +          | (<​OWL>​)  
-          | (<​OWL>​) ​     +          | (collatz ​<​OWL>​) ​    # Only a NumVal version required for collatz ​    
           | id           | id
           | (if0 <OWL> <OWL> <​OWL>​)           | (if0 <OWL> <OWL> <​OWL>​)
Line 96: Line 98:
  
   - The ''​min,​max,​+,​-,/,​*''​ functions all must work with any combination of ''​NumVal''​ and ''​MatrixVal''​s.   - The ''​min,​max,​+,​-,/,​*''​ functions all must work with any combination of ''​NumVal''​ and ''​MatrixVal''​s.
-  - Remember that when multiplying a MatrixVal by a MatrixVal, we want to use the ''​.*''​ operation (element-wise matrix multiply) instead of ''​*''​ (matrix-matrix multiply). ​+  - Remember that when multiplying a MatrixVal by a MatrixVal, we want to use the ''​.*''​ operation (element-wise matrix multiply) instead of ''​*''​ (matrix-matrix multiply).
  
 ---- ----
Line 113: Line 115:
 ---- ----
 ====Hints:​==== ====Hints:​====
 +
 +To verify that your matrix code is working properly, you can run the test cases described in {{ :​cs330_f2016:​cattestcases.pdf |}} on {{:​cs330_f2016:​cat_256.png?​linkonly|}}
  
 Once all is said and done, the following program: Once all is said and done, the following program:
  
 <code lisp> <code lisp>
-(with base_img (render_text "​Hello"​ 25 100) +(with ((base_img (render_text "​Hello"​ 25 100)
-  (with swirl (simple_load "/​Users/​wingated/​Desktop/​swirl_256.png"​) +    (swirl (simple_load "/​Users/​wingated/​Desktop/​swirl_256.png"​))
-    (with ds (drop_shadow base_img) +    (with ((ds (drop_shadow base_img))
-      (with tmp4 (+ (* (+ (min ds base_img) (- 1 base_img)) base_img) (* (- 1 base_img) swirl) ) +        (with ((tmp4 (+ (* (+ (min ds base_img) (- 1 base_img)) base_img) (* (- 1 base_img) swirl) ))) 
-        (with tmp5 (- 1 (emboss tmp4)) +            (with ((tmp5 (- 1 (emboss tmp4))) 
-          (with base_img2 (render_text "​world!"​ 5 200) +                    (base_img2 (render_text "​world!"​ 5 200))
-     ​(with is (inner_shadow base_img2) +                (with ((is (inner_shadow base_img2))
-              (with tmp6 (max base_img2 (* (- 1 base_img2) is) ) +                    (with ((tmp6 (max base_img2 (* (- 1 base_img2) is) ))) 
-                (with output (min tmp5 tmp6 ) +                        (with ( (output (min tmp5 tmp6 )) 
-   ​(simple_save output "​output.png"​) +                            (simple_save output "​output.png"​) 
- +                        
-              +                    
-     ​+                
-   ​+            
- +        )
-      ​)+
     )     )
-  ) 
 ) )
 +
 +  ​
 </​code>​ </​code>​
  
cs330_f2016/labhppint.1476283844.txt.gz · Last modified: 2021/06/30 23:40 (external edit)