1 / 31

four

four. simple expressions in meta. Data objects. Pieces of data in a computer are called objects Today, we’ll talk about four kinds of objects Numbers Pictures (images) Points (positions within an image) Procedures (programs) Take a set of objects as inputs (arguments)

Download Presentation

four

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. four simple expressions in meta

  2. Data objects • Pieces of data in a computer are called objects • Today, we’ll talk about four kinds of objects • Numbers • Pictures (images) • Points (positions within an image) • Procedures (programs) • Take a set of objects as inputs (arguments) • Return another object as a result • Procedures are the most important kind of data in computer science

  3. Referring expressions in English • Phrases that refer to an object or objects • “Robin” • “Rob” • “The TA of this class” • “the grad students of Ian” • “the people in 324” • “France” • “capitalism” • “The sum of 2 and 3” • “The mother of the TA of this class” • We’ll focus on two kinds • Names (“Robin”, “Rob”, “France”, “capitalism”) • Functional expressions (the X of Y)

  4. A deeply nested referring expression • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of [the mother of [the TA of [this class]]]]]]]] Please forgive the sexist expression “father of the nation”

  5. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of [the mother of [the TA of [this class]]]]]]]] Please forgive the sexist expression “father of the nation”

  6. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of [the mother of [the TA of [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  7. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of [the mother of [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  8. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  9. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of [the nation of The United States [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  10. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of [the father of George Washington [the nation of The United States [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  11. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of [the grandfather of George’s grandpa [the father of George Washington [the nation of The United States [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  12. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of [the mother of George’s great grandma [the grandfather of George’s grandpa [the father of George Washington [the nation of The United States [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395 Please forgive the sexist expression “father of the nation”

  13. Meaning follows form • “The mother of the mother of the grandfather of the father of the nation of the mother of the TA of this class” • [the mother of George’s great great grandma [the mother of George’s great grandma [the grandfather of George’s grandpa [the father of George Washington [the nation of The United States [the mother of Robin’s mom [the TA of Robin [this class]]]]]]]] cs 395

  14. Names(‘robin’, ‘rob’, ‘+’, ‘point’) Aka “variables” Refer directly to objects Constants (fixed names) Numbers Refer to fixed objects(the numbers) Strings “Arbitrary text enclosed in double-quotes” Also refer to fixed objects (the text) Functional expressions Sequences of expressions Separated by spaces (or line breaks) Enclosed in square brackets First expression has to refer to a procedure Example: [point 100 100] Referring expressions in meta

  15. Some functional expressions • [box width height] • A picture of a box with the specified width and height (which must be numbers) • [ellipse width height] • Same, but gives you a curved object instead of a box • [line point point] • A line with the specified endpoints • [point number number] • A point with the specified coordinates

  16. [box width height] Creates a rectangle Centered at (0,0) Width is width Height is height Default coloring Unfilled (interior is left alone) Border drawn in black (which shows up very poorly in these slides) ► [box 200 100] ► Rectangles

  17. hey stupid don’t you think it’s time you did an example?

  18. [ellipse width height] Same, but curved If width and height are the same, you get a circle Otherwise, an ellipse ► [ellipse 200 100] ► [ellipse 100 100] Circles and ellipses

  19. [line start end] Makes a linefrom start to end Start and end are point objects Created using[point x y] Note that: Default is black line 1 pixel wide ► [line [point 0 0] [point 100 100]] ► Lines

  20. Coordinate system (0,0) • Positions on the screen described by (x, y) coordinates • X: number of pixels to the right of the “origin” • Y: number of pixels downfrom the “origin” • Coordinates can be negative (system just shifts the image to make them visible) (100, 33) (33, 100)

  21. [group object object …] Make a composite picture from multiple picture objects Objects can be shapes or other groups ► [group [box 100 100] [box 200 200] [box 300 300] [ellipse 100 100]] ► Groups

  22. hey how about another example?

  23. [translate pointobject object …] Shifts objects so that their (0,0) is now at point Shifting by [point 10 20] moves everything Right 10 pixels Down 20 pixels Also acts like a group, so you can include multiple objects and they’re all shifted ► [group [box 200 200] [translate [point 50 0] [box 100 100]]] ► Translate

  24. hey show them how to handle errors

  25. that’s everything you need to know for the assignment but here’s some other stuff you might have fun with

  26. [scale scale-factorobject object …] Make a composite object from multiple picture objects Also acts like a group, so you can include multiple objects and they’re all scaled ► [box 100 100] ► [scale 2 [box 100 100] [box 10 10]] ► Scaling

  27. [rotate angleobject object …] Rotates contents clockwise angledegrees about the point (0,0) Also acts like a group, so you can include multiple objects and they’re all rotated around (0,0) ► [rotate 45 [box 100 100]] ► Rotate

  28. [paint color objects …] Fills interiors of objects with color, which can be A color object made with [color red green blue] A string (magic color name) A symbol (magic color name) The word: null (no quotes)Turns off filling Also acts like a group, so you can include multiple objects ► [group [box 200 200] [paint “black” [box 100 100]]] ► Paint

  29. [ink pen objects …] [pen color width] Draws the outline of objects with specified pen Pen specifies color and width of line Pen objects can be created with the pen procedure … or you can just specify a color in lieu of a pen Also acts like a group, so you can include multiple objects ► [group [box 200 200] [ink [pen “black” 10] [box 100 100]]] ► Ink

  30. Objects are like web pages Pages can contain links to other pages Different from containing the pages themselves But I can in some sense pass you a whole set of pages by passing you a link to a single page that has links to the others Forming a group is like making a new web page with links to the component objects You can think of the components as “in” the group Or just as “available to” the group Peeking inside the data group box box box ellipse

  31. When we group objects inside groups inside other groups We get a tree-structured hierarchy Kind of like outlines And kind of like code note: translate doesn’t actually change its arguments – it makes a translate object Data as hierarchy group box translate group box translate group box translate

More Related