I am a student currently learning about Functional Reactive paradigm using F#. It\'s radically new viewpoint for me. Yesterday I learned about creating a simple ping-pong game u
There's more than one way to do FRP, and it's an active area of research. What's best can depend a lot on the details of how things interact with each other, and new and better techniques may appear in the future.
Broadly the idea is to have behaviours that are functions of time in place of ordinary values (as you said). Behaviours can be defined in terms of other behaviours, and can be defined to swap between other behaviours when particular events occur.
In your example, you generally wouldn't need to remember the position of the ball via arguments (but for some kinds of FRP you might do). Instead you can just have a behaviour:
ballPos : time -> (float * float)
This might have global scope, or for a larger program it may be better to have a local scope with all uses of it in that scope.
As things get more complicated, you'll have behaviours defined in increasingly complex ways, depend on other behaviours and events - including recursive dependencies which are handled differently in different FRP frameworks. In F# for recursive dependencies I'd expect you'd need a let rec
including all involved behaviours. These can still be organised into structures though - at the top-level you might have:
type alienInfo = { pos : float*float; hp : float }
type playerInfo = { pos : float*float; bombs : int }
let rec aliens : time -> alienInfo array = // You might want laziness here.
let behaviours = [| for n in 1..numAliens ->
(alienPos player n, alienHP player n) |]
fun t -> [| for (posBeh, hpBeh) in behaviours ->
{pos=posBeh t; hp=hpBeh t} |] // You might want laziness here.
and player : time -> playerInfo = fun t ->
{ pos=playerPos aliens t; bombs=playerBombs aliens t}
And then the behaviours for alienPos, alienHP can be defined, with dependencies on the player, and playerPos, playerBombs can be defined with dependencies on aliens.
Anyway, if you can give more details of what kind of FRP you're using, it will be easier to give more specific advice. (And if you want advice on what kind - personally I'd recommend reading: http://conal.net/papers/push-pull-frp/push-pull-frp.pdf)