From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id 592735D4 for ; Tue, 4 Sep 2018 07:47:18 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.53,328,1531778400"; d="scan'208";a="344776617" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 04 Sep 2018 09:47:16 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 8B366824DD; Tue, 4 Sep 2018 09:47:16 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 09D4A824B2 for ; Tue, 4 Sep 2018 09:46:02 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=berenger.francois.724@m.kyushu-u.ac.jp; spf=Pass smtp.mailfrom=berenger.francois.724@m.kyushu-u.ac.jp; spf=None smtp.helo=postmaster@br6.m.kyushu-u.ac.jp IronPort-PHdr: =?us-ascii?q?9a23=3AUAVBIBQf3I4UcrXtTbIBrNi+wtpsv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6yYReN2/xhgRfzUJnB7Loc0qyK6/+mATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSizexfbF/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4qF2QxHqlS?= =?us-ascii?q?gHLSY0/nzJhMx+jKxVoxyv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Hxrbd47ZGlPg?= =?us-ascii?q?QcS7GjEsC893ytRIYV4vQ4z/3CCG5DKjBvour5LOBJEw9fiGjXLreYB4jXXXyb?= =?us-ascii?q?Ihkhw7BMJEc2++1PZy?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BLAgDJN45bl2EaBYVaHAEBAQQBAQoBA?= =?us-ascii?q?YQzA3wog3KWIS2YJwEKI4RJAoNSGQcBBDQUAQIBAQIBAQEBARMBAQEBAQYYBkw?= =?us-ascii?q?MgjUigmABAQEBAgEjBFcLCxgCAiYCAh84EwgBAYMdAYF5BwEPoyJ7M4Rsgm4Zg?= =?us-ascii?q?gUFgQuKSIEcgTmCPS6DGwOCLYI0gjUiAoEnAQEBhH4Hh0IvjTUBBgEBARqGGok?= =?us-ascii?q?/HYFAhw4lhWaLJ4gXAgQCBAUCFIFYgXaBQIEegU6CM4UMiSNgAY1TAQE?= X-IPAS-Result: =?us-ascii?q?A0BLAgDJN45bl2EaBYVaHAEBAQQBAQoBAYQzA3wog3KWIS2?= =?us-ascii?q?YJwEKI4RJAoNSGQcBBDQUAQIBAQIBAQEBARMBAQEBAQYYBkwMgjUigmABAQEBA?= =?us-ascii?q?gEjBFcLCxgCAiYCAh84EwgBAYMdAYF5BwEPoyJ7M4Rsgm4ZggUFgQuKSIEcgTm?= =?us-ascii?q?CPS6DGwOCLYI0gjUiAoEnAQEBhH4Hh0IvjTUBBgEBARqGGok/HYFAhw4lhWaLJ?= =?us-ascii?q?4gXAgQCBAUCFIFYgXaBQIEegU6CM4UMiSNgAY1TAQE?= X-IronPort-AV: E=Sophos;i="5.53,328,1531778400"; d="scan'208";a="344776334" Received: from br6.m.kyushu-u.ac.jp ([133.5.26.97]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2018 09:46:00 +0200 Received: from m-mail4.m.kyushu-u.ac.jp (m-mail4.m.kyushu-u.ac.jp [192.168.30.24]) by br6.m.kyushu-u.ac.jp with ESMTP id lthWGN1k9SEhQ3SP (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 04 Sep 2018 16:45:55 +0900 (JST) Received: from [192.168.2.42] (yamanishi.bio.kyutech.ac.jp [131.206.87.20]) by m-mail4.m.kyushu-u.ac.jp (Postfix) with ESMTPSA id 54F2432030C for ; Tue, 4 Sep 2018 16:45:55 +0900 (JST) To: caml-list@inria.fr References: <20180904062257.GA29189@nautica> From: Francois BERENGER Message-ID: <903e65e7-61b2-f18d-9c39-09757f1ca7f4@m.kyushu-u.ac.jp> Date: Tue, 4 Sep 2018 16:45:55 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180904062257.GA29189@nautica> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: by bsmtpd at m.kyushu-u.ac.jp X-Validation-by: berenger.francois.724@m.kyushu-u.ac.jp Subject: Re: [Caml-list] Strange online ocamldoc for Scanf Reply-To: Francois BERENGER X-Loop: caml-list@inria.fr X-Sequence: 17046 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 09/04/2018 03:22 PM, Dominique Martinet wrote: > Francois BERENGER wrote on Tue, Sep 04, 2018: >> It seems type signatures are truncated. >> >> For example in: >> https://caml.inria.fr/pub/docs/manual-ocaml/libref/Scanf.html >> >> val sscanf : string -> ('a, 'b, 'c, 'd) scanner >> >> I would expect sscanf to take three arguments, not one. > > The documentation is correct (and you also are correct that sscanf takes > three arguments, but...) > > ('a, 'b, 'c, 'd) scanner is itself a function taking two arguments, as > defined a bit later in the page: > > type ('a, 'b, 'c, 'd) scanner = ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> > 'c Ok, my mistake. I have to admit that I don't understand such a (lengthy) type definition, probably because I don't read such ones very often. > Basically, to use the example on the page with sscanf "x = 1" "%s = %i" f, > sscanf "x = 1" return a scanner to which you can apply a pattern and a > function - ultimately that is three arguments as you describe, but > thanks to currying after applying one argument you get anther function. > > This is useful because basically you do not care if the scanner comes > from 'sscanf "x = 1"' or 'scanf' or 'bscanf some_channel' -- all three > are equivalent scanners > > > Cheers, > -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs