Version française
Home     About     Download     Resources     Contact us    
Browse thread
From a recursive circuit to a functional/recursive OCaml-code...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] From a recursive circuit to a functional/recursive OCaml-code...
On Sun, Feb 05, 2006 at 04:42:47PM +1100, skaller wrote:
> On Sun, 2006-02-05 at 05:16 +0100, Oliver Bandel wrote:
> 
> > But I'm not clear about how to write this function "f",
> > because it needs mutual recursion...
> 
> No it doesn't, not even with feedback, because your
> system is CLOCKED.
[...]

I need for this task one clock.
I can do a clock (in binary values) with true and false
or 1 and 0 or so with a variable.
I can do this with loops or functions that inverts their
last value (true -> false   and false -> true) with simple
toggling.
I then could use this value and do things depending on the value.

But this one clock I also can do with two mutual recursive
functions. Each one represents the work that must be done
in one state (or more precise: when switching from one state to the
other).
So with two functions that call each other recursively I can
do a toggling value (state machine with two states) by
func_x1 calling func_x2 and then func_x2 calling func_x1.

Another reason why I started intuitively with a recursive
definition of my code here.



Ciao,
   Oliver