<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/b801b6e1958639194014abd51a4747a3"
  from="Oliver Bandel &lt;oliver@f...&gt;"
  author="Oliver Bandel"
  date="2006-02-05T04:04:13"
  subject="Re: [Caml-list] From a recursive circuit to a functional/recursive OCaml-code...]"
  prev="2006/02/e53f4724f2819ce035bbef253c1ad50d"
  next="2006/02/1cc4eb9caf947ecb2db08eeeab666e06"
  prev-thread="2006/02/123aec67dc0623c495431e677bee71af"
  next-thread="2006/02/97ace0c2a51e26bcec579188e650a0e3"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="Re: [Caml-list] From a recursive circuit to a functional/recursive OCaml-code...]">
<msg 
  url="2006/02/b801b6e1958639194014abd51a4747a3"
  from="Oliver Bandel &lt;oliver@f...&gt;"
  author="Oliver Bandel"
  date="2006-02-05T04:04:13"
  subject="Re: [Caml-list] From a recursive circuit to a functional/recursive OCaml-code...]">
</msg>
</thread>

<contents>
Hello,


On Sun, Feb 05, 2006 at 12:36:53PM +1300, Jonathan Roewen wrote:
&gt; Where does the iterating come in? From your description, all you're
&gt; doing is a one-time calculation on a set of input values.

u is calculated out of e and x with operator/function function_B.

But e is calculated out of u with function_C

So, there is a loop of calculation, which means that there is recursion...



&gt; 
&gt; E.g. of the form:
&gt; 
&gt; while true do
&gt;    print_result (func_A (read_int ()))
&gt; done;;

Yes, that's, what is the underlying thing: you get input values and
create output values.

But the calculation of output values is done via an internal feedback...



&gt; 
&gt; Perhaps if you upload the circuit somewhere so people can see, it
&gt; might make a difference.

OK, because sending it as an email-attachement didn't worked on this list,
I put the picture here:

   http://www.belug.org/~ob/struktur-grafisch.jpg

The first picture is the so called trivial machine,
which only operates on the input with an operation/function
and creates an output value;
and the second picture in the file is the non-trivial machine
(the simplest version of a non-trivial machine with one input value
 and the necessary feedback inside the machine).

(Distinction between both is done because: the non-trivial machine is
 history dependnt, the trivial is not. Also there are differences in
 prediction of both: the trivial machine is time-independent and therefore
 easily to predict. But the non-trivial machine can't be tested/analyzed/predicted
 as like the trivial machine...)

For the trivial machine I had done two implementations: one is iterative
and uses the while-loop. And then I did a recursive implementation.

For the trivial machine (first picture) I created the following code
that is functional/recursive:


(* -------------------------------------------- *)

let function_A x =  x * 2

let _ =
  let rec calc () =
    let inval = int_of_string (read_line()) (* input-value "x" in the picture *)
    in
      let outval = function_A inval (* Operator/Function "A" in the picture *)
      in
        Printf.printf "%d =&gt; %d \n" inval outval; calc() (* outval is "y" in the picture *)
  in
    calc ()
      
(* -------------------------------------------- *)



For the non-trivial machine because of the feedbacks it's
not so easy to write it as a program.
IMHO FP has some advantages, because I do not need to store
transitional valuthe necessaryes... but the recursions stuff.... welll, how to implement it here?!

I had tried some ways (mutual recursive functions, mutual values
and combinations, but I don't know what I really need and
I need some help here....).


TIA,
   Oliver

</contents>

</message>

