Seite 1 von 1

Exam Check-List: Discussion on Part 10 - Func. React. Progr.

Verfasst: 23. Aug 2012 18:33
von FeG
Hi,

finally :shock: ... here is my solution to the tenth (and last) topic of the exam check-list (-> spoiler alert...).

As Functional Reactive Programming actually isn't part of the exam and there are no slides, I blatantly copied the task-setting from the exam in 2011 -- and assume, that at least a question like 2. won't appear in the exam :roll:

Last but not least: Thank you, Andreas, for providing the check list -- it helped me a lot to recap the lecture content in-depth. :!:

All the best,
Felix


  1. Given a FRP program, explain what it does.

    Code: Alles auswählen

    (require frtime/animation)
    
    (define start-time (value-now seconds))
    (define elapsed (- seconds start-time))
    (define circle1 (make-circle mouse-pos elapsed "blue"))
    (display-shapes (list circle1))
    
    The program moves a circle along with the mouse position; it's radius grows over time (radius = (current time - start time) in seconds).
  2. Change the behavior of a FRP program in a specified way.

    Let the radius be resetted on left mouse click.

    Code: Alles auswählen

    (define start-time
      (hold (-=> left-clicks (value-now seconds))
            (value-now seconds)))
    
    (Well, that's from the exam, too and there we should explain, what the code does (so: the other way around). I hope I got it right..)
  3. Draw a dataflow diagram describing the computational dependencies in the given program.

    Code: Alles auswählen

    circle position <-- elapsed <-- [value-now seconds]
                              ^---- start-time <-- [value-now seconds]