Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
To: colonna@ccr.jussieu.fr
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] no error with ocamlc, a syntax error with ocaml
Date: Fri, 29 Sep 2006 20:27:01 +1200	[thread overview]
Message-ID: <ad8cfe7e0609290127l39d79e3aq4393b3e34dd7d7d9@mail.gmail.com> (raw)
In-Reply-To: <451CD121.3070502@ccr.jussieu.fr>

Why aren't you doing: ocaml tuvuw_from_data_error.ml?

You don't need to redirect input. Whether this is a bug or just an
unsupported use case is another question.

Jonathan

On 9/29/06, Francois Colonna <colonna@ccr.jussieu.fr> wrote:
> Hello,
>
> the small ocaml program attached gives no errors at compilation
>
> ocamlc -c tuvuw_from_data_error.ml
>
> and this syntax error at execution:
>
> ocaml < tuvuw_from_data_error.ml
>        Objective Caml version 3.09.2
>
> # * *       val s_d1 : string = "1"
> # val s_d2 : string = "2"
> # val s_d3 : string = "3"
> # val s_d4 : string = "4"
> # val s_d5 : string = "5"
> #     val d1 : int = 1
> # val d2 : int = 2
> # val d3 : int = 3
> # val d4 : int = 4
> # val d5 : int = 5
>  print_string (" w d5 = ") ;t = <fun>
>  print_int (w_from_data ( d5 ) ) ;>
>  print_newline () ;t -> int = <fun>
>    val t : int * int -> int = <fun>
>  print_string (" v d3 d4 d5 = ") ;ta : int -> int = <fun>
>  print_int (v_from_data ( d3, d4, d5 ) ) ;= <fun>
>  print_newline () ;_data : int * int * int -> int = <fun>
>          val t_from_data : int * int * int * int * int -> int = <fun>
>  print_string (" u  d1 d2 = ") ;      for data :  d1 = 1 d2 = 2 d3 = 3
> d4 = 4 d5 = 5
>  print_int (u_from_data ( d1, d2 ) ) ;
>  print_newline () ;3 d4 d5 = 22
>    unit = ()
> #
> Syntax error
> #
>
>
>
> By the way, why is the output mixed up ?
>
> Thanks
> François Colonna
>
>
> (**
>  * trying to implement cascade
>  *)
>
>
> let s_d1 = "1" ;;
> let s_d2 = "2" ;;
> let s_d3 = "3" ;;
> let s_d4 = "4" ;;
> let s_d5 = "5" ;;
>
>
> let d1 = int_of_string (s_d1) ;;
> let d2 = int_of_string (s_d2) ;;
> let d3 = int_of_string (s_d3) ;;
> let d4 = int_of_string (s_d4) ;;
> let d5 = int_of_string (s_d5) ;;
>
> (**
>  * define functions as function of their sons
>  *)
>
> let w (a_a) = a_a + 3 ;;
>
> let u (a_a, b_a) = a_a + b_a + 1;;
>
> let v (a_a, b_a) = a_a + b_a + 2 ;;
>
> let t (a_a, b_a) = a_a + b_a ;;
>
>
> (**
>  * express each function as a function of its data
>  * using the functon of its sons
>  *)
>
>
> let w_from_data ( a_a ) =
>    w ( a_a )
> ;;
>
> let u_from_data ( a_a, b_a ) =
>    u ( a_a, b_a )
> ;;
>
> let v_from_data ( a_a, b_a, c_a ) =
>    v ( u_from_data ( a_a, b_a),
>        w_from_data ( c_a) )
> ;;
>
> let t_from_data ( a_a, b_a, c_a, d_a, e_a ) =
>    t ( u_from_data (a_a, b_a),
>        v_from_data (c_a, d_a, e_a) )
> ;;
>
> (**
>  * execution
>  *)
>
>
> print_string (" for data : ") ;
> print_string (" d1 = ") ;
> print_int d1 ;
> print_string (" d2 = ") ;
> print_int d2 ;
> print_string (" d3 = ") ;
> print_int d3 ;
> print_string (" d4 = ") ;
> print_int d4 ;
> print_string (" d5 = ") ;
> print_int d5 ;
> print_newline () ;
> ;;
>
> print_string (" t d1 d2 d3 d4 d5 = ") ;
> print_int (t_from_data ( d1, d2, d3, d4, d5 ) ) ;
> print_newline () ;
> ;;
>
> print_string (" w d5 = ") ;
> print_int (w_from_data ( d5 ) ) ;
> print_newline () ;
>
> print_string (" v d3 d4 d5 = ") ;
> print_int (v_from_data ( d3, d4, d5 ) ) ;
> print_newline () ;
>
> print_string (" u  d1 d2 = ") ;
> print_int (u_from_data ( d1, d2 ) ) ;
> print_newline () ;
>
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>


  parent reply	other threads:[~2006-09-29  8:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-29  7:54 Francois Colonna
2006-09-29  8:25 ` [Caml-list] " micha
2006-09-29  8:27 ` Jonathan Roewen [this message]
2006-09-29  8:40 ` Virgile Prevosto
2006-09-29  9:11   ` Francois Colonna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad8cfe7e0609290127l39d79e3aq4393b3e34dd7d7d9@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=colonna@ccr.jussieu.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox