1/10
21/09/26
what the fuck is the big bang expression?
the big-bang expression is something we can do in racket, thats used to both wire together two functions that need to feedback into one another, and to start the cycle of this feedback loop
its first argument evaluates to what is called the initial world state. this initial world state is basically where we want our interactive functions to start. so, we give it an expression that evaluates to (a representation of) this state as its first argument.
the next arguments are the functions we’re wiring together, with special names to denote for big bang when to call these functions, which will then return to big bang the next state of the world, so it can then pass it to these functions when they are called again
note: big bang is called polymorphic, meaning it works for any type of world state
what’s a domain analysis?
its how you start a world expression, where you sketch a few of the states of the program you’re envisioning, and work to identify the constants of the program, the changing values of the program, and the functions big-bang will use, like on-tick or on-key
what to do after your domain analysis?
while learning, you can copy paste the template from the recipe. after that, you should define your constants. remember, from now on, if you’re mentioning a constant, call it by name, not the number, in case you change something later.
what does traceability mean?
its the ability to see where each element from the domain analysis ended up in the program.
what do you do after defining constants?
you should do the data definition for the changing elements of the program.
often, this starts as changing the WS name (remember ctrl + F and to only change the proper case). then do the rest of the definition. change the parameter name of the WS, and then go down and delete the big-bang functions that you wont be using
what to do after your data defintion?
start building the functions based on your “wish-list“ entries, following the htdf recipe.
what’s a key-event?
they’re considered to be a large enumeration, with a different value for each possible key one could press.
these values are stored as defined strings, so, you replace the “ke“ with the name of the key. i.e. space = “ “.
what is a structure?
they’re a thing that lets us represent compound data, i.e. groups of atomic data
ex: (define struct <structure name> (<field name 1> <field name 2>))
ex: (define struct pos (x y))
that statement declared four values.
a constructor, which is a new function that can be used to make new pos constructs
(as many selectors as there are fields) selectors, which are new functions that allow you to select one field, and have the program give the information of what that field currently holds
and a new predicate based in the structure’s name that checks if a value is based in a structure
the order of the arguments matters as you give them, and are assigned to their respective field names
what do structure definitions look like and define?
they look like;
;;the structure def:
(define-struct <name> (<fieldname> <fieldname>)
;; ex: (define-struct pos (x y))
;;then they define...
;; a constructor: (make-<structure-name>)
;; a selector: <structure-name>-<field-name>
;; a predicate: <structure-name?>
;; examples:
;; make-pos
;; pos-x and pos-y
;; pos?when should you use a compound data definition?
when you have two or more values that naturally belong together
what should be included in a compound data definition?
a structure definiton
a type comment that defines a new type name and describes how to form data
an interpretation that describes the correspondence b/w information and data
a template for a 1 argument function operating on data of this type
template rules statement