From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 5B1807EE6B for ; Wed, 27 Nov 2013 12:54:45 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.229 as permitted sender) identity=mailfrom; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@tot-dmz-mxout1.janestreet.com) identity=helo; client-ip=38.105.200.229; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@tot-dmz-mxout1.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjoBANTclVImacjlnGdsb2JhbABZhBK6cYEWHg4BAQEBAQYNCQkUKIIlAQEEAScZAQE3AQQLCwQBBjshARIBBQEcBhOHbwMJBgMCozCLEIRSAQWFBw2IDBEGjHGBKWgHhDOWLIFrjFqDTBgpgxeBPg X-IPAS-Result: AjoBANTclVImacjlnGdsb2JhbABZhBK6cYEWHg4BAQEBAQYNCQkUKIIlAQEEAScZAQE3AQQLCwQBBjshARIBBQEcBhOHbwMJBgMCozCLEIRSAQWFBw2IDBEGjHGBKWgHhDOWLIFrjFqDTBgpgxeBPg X-IronPort-AV: E=Sophos;i="4.93,781,1378850400"; d="scan'208";a="38200266" Received: from mx5.janestreet.com (HELO tot-dmz-mxout1.janestreet.com) ([38.105.200.229]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Nov 2013 12:54:44 +0100 Received: from tot-oib-smtp1.delacy.com ([172.27.22.15] helo=tot-smtp) by tot-dmz-mxout1.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1Vldhb-0001qI-BL for caml-list@inria.fr; Wed, 27 Nov 2013 06:54:43 -0500 Received: from tot-dmz-mxgoog1.delacy.com ([172.27.224.14] helo=mxgoog2.janestreet.com) by tot-smtp with esmtps (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Vldhb-0006mt-AR for caml-list@inria.fr; Wed, 27 Nov 2013 06:54:43 -0500 Received: from mail-ie0-f175.google.com ([209.85.223.175]) by mxgoog2.janestreet.com with esmtp (Exim 4.76) (envelope-from ) id 1Vldhb-0006RQ-7L for caml-list@inria.fr; Wed, 27 Nov 2013 06:54:43 -0500 Received: by mail-ie0-f175.google.com with SMTP id x13so11278866ief.6 for ; Wed, 27 Nov 2013 03:54:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=imj30I7+CiWj1qkspLshFinxKxqQqM0nx9l7kP2u0Cw=; b=KqIPgwusOuUaB9AIBh4WTK/zy/Mp6o5mldNXygzAcS3Ww5H8qz5zmalTFn3nJ/Hggo 0KHAxTh2Bifaw0sY4POGVGl/rcJeuG9mUvQqQMXpcdBbEloV2WWfCoOIo1XwiSXfLjRa 3RFbqXYa1MvkIizEwKQq/KUMp5VrRxYPLjK6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=imj30I7+CiWj1qkspLshFinxKxqQqM0nx9l7kP2u0Cw=; b=enLrLXF/Zsi2bnfNQPxFEEefyxUSlgM1WOJjG72QXBZtHkOzfTsTLu4EAPTz1sfslc 9vxBjQj4p6e6q4PdieWQ6JPHS1pNMnJvGOAqG6d26fA4G1WedHGW76J/o3hxwC/dVjx2 LPKCpORV5CHwPoYtOaWtpI4rs4Rxcpt49eeSMT2qXqOBPqfmNm61kswENJkWV+v1aMng two+RvF8hRfrO05+Mz84q1oGzLD701KM+wywdYVS8bql+KpoBxaidy9Z+xGf+iuflwY2 nMYzxIXl5Vm00LXUCq/VsW3KxXpBoQTgV39SroQ/8tmTTEvqbpMgqjsxt+4IHoQUBFn5 9aRQ== X-Gm-Message-State: ALoCoQnNQgM5rCX2ZeNhvqeTyTPHc/pVlouun7rwVdrBjzRxS27ntM4vuAIxaYocITAFxaNf3YkClvUBRKve2vgzkaxCBr2MAldbKa6iGDkxyfb43PONRqZ/8hOnQzkw1Eg6gS7g/MqlUldFhlV+LmqjvDVC9ZULbQ== X-Received: by 10.42.215.80 with SMTP id hd16mr23680366icb.17.1385553282945; Wed, 27 Nov 2013 03:54:42 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.42.215.80 with SMTP id hd16mr23680362icb.17.1385553282879; Wed, 27 Nov 2013 03:54:42 -0800 (PST) Received: by 10.50.170.40 with HTTP; Wed, 27 Nov 2013 03:54:42 -0800 (PST) In-Reply-To: <529370C0.9020801@gmail.com> References: <529370C0.9020801@gmail.com> Date: Wed, 27 Nov 2013 11:54:42 +0000 Message-ID: From: Jeremie Dimino To: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> Cc: "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=20cf301d3cec3e6baa04ec27439b Subject: Re: [Caml-list] [batteries] ... how to create (format) directives that do not take any arguments? --20cf301d3cec3e6baa04ec27439b Content-Type: text/plain; charset=ISO-8859-1 On Mon, Nov 25, 2013 at 3:46 PM, Matej Kosik < 5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote: > I would like to define custom directives, that would enable me to write > code like e.g. this: > > Print.printf "regular %bold_on bold %bold_off regular %italic_on italic > %italic_off"; [...] > Can somebody give me some advice how to create simple "parameterless > format directives" (like those above)? > IIRC, this should work: let printer_bold_on k = k (fun oc -> output_string oc "blah") to define the format directive %bold_on. -- Jeremie --20cf301d3cec3e6baa04ec27439b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Nov 25, 2013 at 3:46 PM, Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> wrote:<= br>
I would like to d= efine custom directives, that would enable me to write code like e.g. this:=

Print.printf "regular %bold_on bold %bold_off regular %italic_on itali= c %italic_off";=A0
[...]
Can somebody give me some advice how to create simple "parame= terless format directives" (like those above)?
IIRC, this should work:

=A0 =A0let printer_bold_on k =3D k (fun oc -> output_string oc "bla= h")

to define the format directiv= e %bold_on.

--=A0
Jere= mie
--20cf301d3cec3e6baa04ec27439b--