User:Inge Hoonte/oct20 2011
Link: Oct 20 class
Formal computer language -> mathematical or computing, not spoken, expressing ideas that can be processed
Procedural / Imperative -> tell the computer what to do, compare to following a recipe
- bash
- Python
- PHP, Java, javascript, Rudy....
Declarative -> more descriptive, domain specific, compare to improv cooking
- SVG
- CSS, HTML
- Lisp, Prolog
- XPath
ipython: text is always the exception. put quotes around it. name = "inge" -> expression gets stored in a variable
name ="..." print "Hello", name, "etc"
str = string = textual object int = integer float = not whole number, eg 1.56
x = """inge ....: and ....: more ....: stuff ....: and more ....: stuff""" In [16]: x Out[16]: 'inge\nand\nmore\nstuff\nand more\nstuff'
===
lunch
====
XML, SVG
- make sure you always open and close the code: header, closer
- .format after """ looks for previous {} and whatever is in there:
for x in range(100): print """ <rect style="fill:#ff00ff" id="rect2985" width="{0}" height="242.85715" x="{1} {2}" y="252.36218" /> """.format(x*2, x*2, x)
==
for x in range(1, 100): print """ <rect style="fill:none;stroke:#ff000f;stroke-opacity:25" id="rect2985" width="{0}" height="100" transform="rotate (45 {1} {2})" x="{1}" y="{2}" /> """.format(x*10, x*3, x*99)
-> prints rectangles that are all rotated 45 degrees