caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] A question about Format boxes
@ 2012-09-13 15:00 Michael Welsh Duggan
  2012-09-14 16:30 ` Martin Jambon
  2012-10-26 15:23 ` [Caml-list] " Hongbo Zhang
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Welsh Duggan @ 2012-09-13 15:00 UTC (permalink / raw)
  To: caml-list

The example at
<URL:http://caml.inria.fr/resources/doc/guides/format.en.html#hov-boxes>
shows a major difference in the output of packing versus structural hov
boxes.  However, in my experiments I cannot achieve the output this
example assigns to "packing" boxes.  (OCaml 3.12)

My examples from the REPL are below.  Would someone be able to tell me
what I am doing incorrectly?

# Format.printf "@[<hv 2>(---@\n@[<hv 2>(---@\n@[<hv 2>(---@,)@]@,)@]@,)@]@\n";;
(---
  (---
    (---)))
- : unit = ()
# Format.printf "@[<hov 2>(---@\n@[<hov 2>(---@\n@[<hov 2>(---@,)@]@,)@]@,)@]@\n";;
(---
  (---
    (---)))
- : unit = ()
# Format.printf "@[<2>(---@\n@[<2>(---@\n@[<2>(---@,)@]@,)@]@,)@]@\n";;
(---
  (---
    (---)))
- : unit = ()
# Format.printf "@[<b 2>(---@\n@[<b 2>(---@\n@[<b 2>(---@,)@]@,)@]@,)@]@\n";;
(---
  (---
    (---)))
- : unit = ()


-- 
Michael Welsh Duggan
(md5i@md5i.com)


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

* Re: [Caml-list] A question about Format boxes
  2012-09-13 15:00 [Caml-list] A question about Format boxes Michael Welsh Duggan
@ 2012-09-14 16:30 ` Martin Jambon
  2012-10-26 15:23 ` [Caml-list] " Hongbo Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Jambon @ 2012-09-14 16:30 UTC (permalink / raw)
  To: caml-list

On 09/13/2012 08:00 AM, Michael Welsh Duggan wrote:
> The example at
> <URL:http://caml.inria.fr/resources/doc/guides/format.en.html#hov-boxes>
> shows a major difference in the output of packing versus structural hov
> boxes.  However, in my experiments I cannot achieve the output this
> example assigns to "packing" boxes.  (OCaml 3.12)
>
> My examples from the REPL are below.  Would someone be able to tell me
> what I am doing incorrectly?
>
> # Format.printf "@[<hv 2>(---@\n@[<hv 2>(---@\n@[<hv 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<hov 2>(---@\n@[<hov 2>(---@\n@[<hov 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<2>(---@\n@[<2>(---@\n@[<2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<b 2>(---@\n@[<b 2>(---@\n@[<b 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()

I have no idea what you're doing wrong, but I can suggest you try 
easy-format (http://mjambon.com/easy-format.html) which lets you choose 
and customize various indentation styles.


Martin


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

* [Caml-list] Re: A question about Format boxes
  2012-09-13 15:00 [Caml-list] A question about Format boxes Michael Welsh Duggan
  2012-09-14 16:30 ` Martin Jambon
@ 2012-10-26 15:23 ` Hongbo Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: Hongbo Zhang @ 2012-10-26 15:23 UTC (permalink / raw)
  To: caml-list

Hi, I think he is trying to explain the difference:

let s = "--------------------------" in Format.fprintf 
Format.std_formatter "@[<hov1>(%s@[<hov1>(%s@[<hov1>(%s@,)@]@,)@]@,)@]" 
s s s;;
let s = "--------------------------" in Format.fprintf 
Format.std_formatter "@[<hov1>(%s@[<hov1>(%s@[<hov1>(%s@,)@]@,)@]@,)@]" 
s s s;;
(--------------------------(--------------------------(--------------------------
                                                        )))- : unit = ()
# let s = "--------------------------" in Format.fprintf 
Format.std_formatter "@[<1>(%s@[<1>(%s@[<1>(%s@,)@]@,)@]@,)@]" s s s;;
let s = "--------------------------" in Format.fprintf 
Format.std_formatter "@[<1>(%s@[<1>(%s@[<1>(%s@,)@]@,)@]@,)@]" s s s;;
(--------------------------(--------------------------(--------------------------
                                                        )
                             )
  )- : unit = ()

HTH
On 9/13/12 11:00 AM, Michael Welsh Duggan wrote:
> The example at
> <URL:http://caml.inria.fr/resources/doc/guides/format.en.html#hov-boxes>
> shows a major difference in the output of packing versus structural hov
> boxes.  However, in my experiments I cannot achieve the output this
> example assigns to "packing" boxes.  (OCaml 3.12)
>
> My examples from the REPL are below.  Would someone be able to tell me
> what I am doing incorrectly?
>
> # Format.printf "@[<hv 2>(---@\n@[<hv 2>(---@\n@[<hv 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<hov 2>(---@\n@[<hov 2>(---@\n@[<hov 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<2>(---@\n@[<2>(---@\n@[<2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
> # Format.printf "@[<b 2>(---@\n@[<b 2>(---@\n@[<b 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
>    (---
>      (---)))
> - : unit = ()
>
>


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

end of thread, other threads:[~2012-10-26 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13 15:00 [Caml-list] A question about Format boxes Michael Welsh Duggan
2012-09-14 16:30 ` Martin Jambon
2012-10-26 15:23 ` [Caml-list] " Hongbo Zhang

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).