caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] function application is partial
@ 2004-05-07  5:21 briand
  2004-05-07  5:54 ` briand
  0 siblings, 1 reply; 3+ messages in thread
From: briand @ 2004-05-07  5:21 UTC (permalink / raw)
  To: caml-list


File "sweep.ml", line 30, characters 6-115:
Warning: this function application is partial,
maybe some arguments are missing.

Here's the source:


type sweep_data = { freq: float; data: Complex.t };;

let print_sweep (v: sweep_data array) =
  let n = Array.length v in
 (* print out the magnitude data in dB *)
    for i = 0 to n-1 do
      let p = v.(i) in
      let f = p.freq in
      let z = p.data in
	Printf.printf "%.3e %.3e\n" (number_db (Complex.norm2 z));
    done;
    print_newline();
    (* print the phase data *)
    for i = 0 to n-1 do
      let p = v.(i) in
      let f = p.freq in
      let z = p.data in
	Printf.printf "%.3e %.3e\n" (rad_deg (Complex.arg z));
    done;
;;

Array.get can only take two arguments (duh).

If it is getting two arguments how can it possibly be interpreted as a
partial application ?

Brian

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] function application is partial
  2004-05-07  5:21 [Caml-list] function application is partial briand
@ 2004-05-07  5:54 ` briand
  2004-05-07  9:10   ` Keith Wansbrough
  0 siblings, 1 reply; 3+ messages in thread
From: briand @ 2004-05-07  5:54 UTC (permalink / raw)
  To: caml-list

There's nothing like posting and finding your mistake an instant later.

The printf was causing the error.

But why was the error on p=v.(i) and not on the printf line itself ?

Thanks

Brian

>>>>> "briand" == briand  <briand@aracnet.com> writes:

  briand> File "sweep.ml", line 30, characters 6-115:
  briand> Warning: this function application is partial,
  briand> maybe some arguments are missing.

  briand> Here's the source:


  briand> type sweep_data = { freq: float; data: Complex.t };;

  briand> let print_sweep (v: sweep_data array) =
  briand>   let n = Array.length v in
  briand>  (* print out the magnitude data in dB *)
  briand>     for i = 0 to n-1 do
  briand>       let p = v.(i) in
  briand>       let f = p.freq in
  briand>       let z = p.data in
  briand> 	Printf.printf "%.3e %.3e\n" (number_db (Complex.norm2 z));
  briand>     done;
  briand>     print_newline();
  briand>     (* print the phase data *)
  briand>     for i = 0 to n-1 do
  briand>       let p = v.(i) in
  briand>       let f = p.freq in
  briand>       let z = p.data in
  briand> 	Printf.printf "%.3e %.3e\n" (rad_deg (Complex.arg z));
  briand>     done;
  briand> ;;

  briand> Array.get can only take two arguments (duh).

  briand> If it is getting two arguments how can it possibly be interpreted as a
  briand> partial application ?

  briand> Brian

  briand> -------------------
  briand> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
  briand> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
  briand> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] function application is partial
  2004-05-07  5:54 ` briand
@ 2004-05-07  9:10   ` Keith Wansbrough
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Wansbrough @ 2004-05-07  9:10 UTC (permalink / raw)
  To: briand; +Cc: caml-list


> But why was the error on p=v.(i) and not on the printf line itself ?
[..]
>   briand> File "sweep.ml", line 30, characters 6-115:
>   briand> Warning: this function application is partial,
>   briand> maybe some arguments are missing.
[..]
>   briand>       let p = v.(i) in
>   briand>       let f = p.freq in
>   briand>       let z = p.data in
>   briand> 	Printf.printf "%.3e %.3e\n" (number_db (Complex.norm2 z));

I can't tell which line is line 30, but none of your lines are 115
characters long.  Count 109 characters from the "let" in "let p =
v.(i)", and I suspect you reach the printf.

OCaml often seems to be confused about lines in error messages.

HTH.

--KW 8-)

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-07  9:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-07  5:21 [Caml-list] function application is partial briand
2004-05-07  5:54 ` briand
2004-05-07  9:10   ` Keith Wansbrough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).