From: Francois Berenger <berenger@riken.jp>
To: caml-list@inria.fr
Subject: [Caml-list] Scanf.sscanf surprised me
Date: Tue, 08 Oct 2013 11:58:53 +0900 [thread overview]
Message-ID: <525374ED.2010906@riken.jp> (raw)
This example line and scanning format work:
# let line = "active_ZINC01535869
0.470,0.389,0.479,0.453,0.470,0.631,0.562,0.590,0.677,0.558,0.379";;
val line : string =
"active_ZINC01535869
0.470,0.389,0.479,0.453,0.470,0.631,0.562,0.590,0.677,0.558,0.379"
# Scanf.sscanf line "%s %f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f" (fun name s1
s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 -> (name, s1, s2, s3, s4, s5, s6, s7,
s8, s9, s10, s11));;
- : string * float * float * float * float * float * float * float *
float * float * float * float
=
("active_ZINC01535869", 0.47, 0.389, 0.479, 0.453, 0.47, 0.631, 0.562,
0.59, 0.677, 0.558, 0.379)
This one doesn't:
# let line =
"active_ZINC01535869,0.470,0.389,0.479,0.453,0.470,0.631,0.562,0.590,0.677,0.558,0.379";;
val line :
string =
"active_ZINC01535869,0.470,0.389,0.479,0.453,0.470,0.631,0.562,0.590,0.677,0.558,0.379"
# Scanf.sscanf line "%s,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f" (fun name s1
s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 -> (name, s1, s2, s3, s4, s5, s6, s7,
s8, s9, s10, s11));;
Exception: End_of_file.
I am quite surprised.
I was expecting the first separator being a space or a coma
to behave the same.
--
Best regards,
Francois Berenger.
next reply other threads:[~2013-10-08 2:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-08 2:58 Francois Berenger [this message]
2013-10-08 3:28 ` Robert Roessler
2013-10-08 4:30 ` Gabriel Scherer
2013-10-08 15:23 ` Eric Cooper
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=525374ED.2010906@riken.jp \
--to=berenger@riken.jp \
--cc=caml-list@inria.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