From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 60594BBC4 for ; Mon, 30 Mar 2009 02:19:03 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0CAJesz0nCRgOEgWdsb2JhbACBUJQyAQEWIrAig3oG X-IronPort-AV: E=Sophos;i="4.38,443,1233529200"; d="scan'208";a="23521870" Received: from fork.recoil.org ([194.70.3.132]) by mail2-smtp-roc.national.inria.fr with SMTP; 30 Mar 2009 02:19:03 +0200 Received: (qmail 5940 invoked by uid 3023); 30 Mar 2009 00:19:02 -0000 Received: from 94-194-206-35.zone8.bethere.co.uk (HELO Shock.config) (94.194.206.35) (smtp-auth username remote@recoil.org, mechanism cram-md5) by fork.recoil.org (qpsmtpd/0.32) with ESMTP; Mon, 30 Mar 2009 01:19:00 +0100 Message-Id: From: Anil Madhavapeddy To: OCaml Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: mixing infix functions and the format4 types Date: Mon, 30 Mar 2009 01:18:58 +0100 X-Mailer: Apple Mail (2.930.3) X-Spam: no; 0.00; anil:01 anil:01 infix:01 infix:01 printf:01 ocaml:01 printf:01 kprintf:01 val:01 foo:01 foo:01 val:01 functions:01 functions:01 expression:02 Is there any way to mix infix operators with the Printf format6 types? I have a code printing module where this would be quite convenient syntactically, but the obvious attempt didn't work: $ ocaml Objective Caml version 3.11.0 # open Printf;; # let myfn m s = let xfn o = m ^ ": " ^ o in kprintf xfn s;; val myfn : string -> ('a, unit, string, string) format4 -> 'a = # myfn "foo" "bar";; - : string = "foo: bar" # myfn "foo" "%s %s" "bar1" "bar2";; - : string = "foo: bar1 bar2" # let (---) m s = myfn m s;; val ( --- ) : string -> ('a, unit, string, string) format4 -> 'a = # "foo" --- "bar";;; - : string = "foo: bar" # "foo" --- "%s %s" "bar1" "bar2";; Error: This expression is not a function, it cannot be applied Is there a trick to let this work, or do I need to stick to using non- infix functions for formatting? thanks Anil