adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | Current MOOC: https://huit.re/ocamlmooc | OCaml 4.04.0 release notes: http://ocaml.org/releases/4.04.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
madroach has quit [Ping timeout: 256 seconds]
kakadu has quit [Ping timeout: 245 seconds]
mengu has quit [Remote host closed the connection]
madroach has joined #ocaml
wtetzner has joined #ocaml
lucasem has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
antkong_ has quit [Quit: antkong_]
benwbooth has joined #ocaml
moei has quit [*.net *.split]
apache3_ has quit [*.net *.split]
fraggle_ has quit [*.net *.split]
freusque has quit [*.net *.split]
wolfcore has quit [*.net *.split]
myst|fon has quit [*.net *.split]
silver has quit [Read error: Connection reset by peer]
apache3_ has joined #ocaml
fraggle_ has joined #ocaml
freusque has joined #ocaml
wolfcore has joined #ocaml
moei has joined #ocaml
myst|fon has joined #ocaml
moei has quit [Ping timeout: 255 seconds]
moei has joined #ocaml
handlex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yomimono has joined #ocaml
snhmib has quit [Ping timeout: 240 seconds]
yomimono has quit [Ping timeout: 256 seconds]
FreeBirdLjj has joined #ocaml
antkong_ has joined #ocaml
zirman has joined #ocaml
xorpse has quit [Ping timeout: 245 seconds]
antkong_ has quit [Quit: antkong_]
wtetzner has quit [Remote host closed the connection]
antkong has joined #ocaml
wtetzner has joined #ocaml
govg has quit [Ping timeout: 258 seconds]
rgrinberg has joined #ocaml
jao has quit [Ping timeout: 252 seconds]
louisriesener has quit [Excess Flood]
louisriesener has joined #ocaml
mcspud has quit [Excess Flood]
antkong has quit [Ping timeout: 252 seconds]
antkong has joined #ocaml
mcspud has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
wtetzner has quit [Remote host closed the connection]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
lucasem has quit [Quit: Connection closed for inactivity]
ygrek has quit [Ping timeout: 255 seconds]
rgrinberg has quit [Ping timeout: 255 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Remote host closed the connection]
yomimono has joined #ocaml
rgrinberg has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
nomicflux has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
nomicflux has quit [Quit: nomicflux]
pierpa has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
Algebr`` has joined #ocaml
MercurialAlchemi has joined #ocaml
yomimono has quit [Ping timeout: 256 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
antkong has quit [Quit: antkong]
antkong has joined #ocaml
tane has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
govg has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
rcabaco_ has joined #ocaml
rcabaco has quit [Ping timeout: 248 seconds]
mengu has joined #ocaml
mengu has quit [Remote host closed the connection]
ocaml190 has joined #ocaml
MercurialAlchemi has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
<ocaml190> I use labgtk like this #require "lablgtk2";;
<ocaml190> lablgtk
<ocaml190> let a = Printexc.print main () This is the function that draws the UI.
<ocaml190> How do I call this ?
<ocaml190> from the toplevel.
<ocaml190> If I compile then it works. But want to know how to call from toplevel.
<AlfredENeuman> where's main defined?
tane has quit [Quit: Leaving]
<AlfredENeuman> i don't know lablgtk myself, but if i had main defined in foo.ml, i'd do:
<AlfredENeuman> #mod_use "foo.ml";;
<AlfredENeuman> let a = Printexc.print Foo.main ();;
govg has quit [Ping timeout: 258 seconds]
antkong has quit [Quit: antkong]
antkong has joined #ocaml
fre has joined #ocaml
antkong has quit [Read error: Connection reset by peer]
mengu has joined #ocaml
antkong has joined #ocaml
mengu has quit [Ping timeout: 276 seconds]
<ocaml190> # let a = Printexc.print main ();; (process:2894): GLib-GObject-WARNING **: invalid (NULL) pointer instance (process:2894): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
<ocaml190> I used #mod_use "foo.ml";;
alfredo has joined #ocaml
jnavila has joined #ocaml
dhil has joined #ocaml
govg has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
_zim_ has joined #ocaml
Simn has joined #ocaml
moei has quit [Quit: Leaving...]
dhil has quit [Ping timeout: 255 seconds]
larhat has joined #ocaml
fre has quit [Ping timeout: 258 seconds]
freusque has quit [Quit: WeeChat 1.6]
kakadu has joined #ocaml
freusque has joined #ocaml
govg has quit [Ping timeout: 255 seconds]
FreeBirdLjj has joined #ocaml
antkong has quit [Quit: antkong]
antkong has joined #ocaml
antkong has quit [Read error: Connection reset by peer]
antkong has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
mengu has joined #ocaml
antkong has quit [Quit: antkong]
nbecker has quit [Quit: WeeChat 1.7]
FreeBirdLjj has quit [Remote host closed the connection]
govg has joined #ocaml
mfp has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
xorpse has joined #ocaml
FreeBirdLjj has joined #ocaml
Algebr`` has quit [Ping timeout: 255 seconds]
_andre has joined #ocaml
frefity has joined #ocaml
<ocaml190> Anyone can show lablgtk code that draws n rectangles where n is a parameter ?
Flerex has joined #ocaml
snhmib has joined #ocaml
Flerex has quit [Client Quit]
ltadeu has joined #ocaml
ltadeu has quit [Remote host closed the connection]
ltadeu has joined #ocaml
frefity has quit [Quit: Ex-Chat]
dhil has joined #ocaml
simon3 has joined #ocaml
simon3 has quit [Remote host closed the connection]
frefity has joined #ocaml
zpe has joined #ocaml
sepp2k has joined #ocaml
Algebr`` has joined #ocaml
Algebr`` has quit [Ping timeout: 255 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
silver has joined #ocaml
alfredo has quit [Ping timeout: 256 seconds]
<ocaml190> Gdk.Rectangle.create ~x ~y ~width ~height Calls a method with params ? What is ~ ?
govg has quit [Ping timeout: 240 seconds]
<ocaml190> Labelled parameter ?
<chelfi> yes
<ocaml190> Right
eagleflo_ is now known as eagleflo
FreeBirdLjj has joined #ocaml
<ocaml190> What is the idiomatic OCaml for outer and inner loops ?
<ocaml190> I tend to write imperative code. Want functional.
<jbrown> fold/map/iter?
<jbrown> it depends what you're looping over, and why
<ocaml190> I do something in the inner loop. Just over two ints m and n.
Algebr`` has joined #ocaml
<ocaml190> Let's say I am doing this.
<ocaml190> let x = x + 5 in let y = y + 5 in let width = 10 in let height = 10 in let update_rect = Gdk.Rectangle.create ~x ~y ~width ~height in area#misc#draw (Some update_rect)
<jbrown> seems like quite an imperative thing, you might as well just use for loops
<jbrown> I mean, you could write two nested recursive functions, or create lists of integers and iterate over them, but it wouldn't be better IMO
Algebr`` has quit [Ping timeout: 255 seconds]
<ocaml190> [ zip (repeat i) [0..n-1] | i <- [0..m-1] ] in Haskell. Can't do it in OCaml ?
<jbrown> there aren't comprehensions quite like that, no
<flux> eons ago there was a campl4 syntax extension for that
<flux> but I guess it didn't catch on
dhil has quit [Ping timeout: 240 seconds]
<twold> This is for monadic comprehensions (so should just do what you want for the List monad)
<chelfi> you can also desugar the comprehension if you do not mind the syntax
<twold> sure
<ocaml190> I have to learn a bit more for that. But meanwhile http://pastebin.com/bgFXjLSD
<ocaml190> Is that too long ?
<flux> ocaml190, you can get a bit smaller by using let width, height = 10, 10 in ..
<flux> and you shouldn't guard all match clauses. the last when .. should preferably become (* when m >= 5 *), ie. a comment
<twold> is this just mapping over a range of x, y pairs? if so, you can simply nest List.map
<flux> and perhaps the whole loop could be replaced with some nice range iteration from ie. Containers, Batteries or Core
<twold> but I'd also like to know what would an idiomatic Ocaml look like
<flux> personally I would just use for :-)
<flux> and even when using loops like that, I would put the exit condition in the beginning of the function
<flux> and just use plain 'if'
<ocaml190> What is this range iteration ?
<flux> let flip f a b = f b a flip List.iter CCList.(0 --^ 5) (fun n -> .. ) - pretty terrible ;-)
<flux> (actually flip is defined in containers' CCFun)
<flux> becomes slightly better when replace (fun n -> ..) with @@ fun n -> ..
<flux> but if you don't need to return values and are doing purely imperative work, I think for loop is just fine :)
FreeBirdLjj has quit [Remote host closed the connection]
govg has joined #ocaml
nomicflux has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
two_wheels has joined #ocaml
Algebr`` has joined #ocaml
Algebr`` has quit [Ping timeout: 255 seconds]
handlex has joined #ocaml
dhil has joined #ocaml
alienbot has joined #ocaml
nomicflux has quit [Quit: nomicflux]
handlex has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<zozozo> say you want some modules to be linked in a binary for their side-effect (even though there is no dependency on them), what would be the simplest solution ? Up until now, since the modules had an empty interface I juste included them in my main.ml, but I'm starting to add visible interfaces for them, and it kind of breaks everything
<zozozo> unfortunately, 'module _ = A' does not seem to be supported
<companion_cube> I'd add a function `run:unit->unit` to these modules, and call that
handlex has joined #ocaml
<companion_cube> Foo.run(); Bar.run();
<companion_cube> this makes it clear that they are there only for side effects
<companion_cube> doing `module A = Foo` might be dangerous because of module aliases
ocaml190 has quit [Ping timeout: 260 seconds]
unbalanced has joined #ocaml
<zozozo> good idea
yomimono has joined #ocaml
mengu_ has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
defgeneric has quit [Ping timeout: 240 seconds]
defgeneric has joined #ocaml
Algebr`` has joined #ocaml
Algebr`` has quit [Ping timeout: 255 seconds]
johnelse has quit [Quit: leaving]
johnelse has joined #ocaml
ryanartecona has joined #ocaml
frug72 has quit [Ping timeout: 255 seconds]
beaumonta has joined #ocaml
mengu_ has quit [Remote host closed the connection]
frug72 has joined #ocaml
infinity0 has quit [Ping timeout: 240 seconds]
infinity0 has joined #ocaml
infinity0 has joined #ocaml
mengu has joined #ocaml
infinity0 has quit [Remote host closed the connection]
abeaumont has quit [Ping timeout: 260 seconds]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
infinity0 has quit [Remote host closed the connection]
th5 has joined #ocaml
handlex has quit [Quit: handlex]
moei has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 252 seconds]
jave has quit [Ping timeout: 248 seconds]
jave has joined #ocaml
flx has joined #ocaml
john51 has quit [Write error: Broken pipe]
mcspud has quit [Excess Flood]
john51 has joined #ocaml
flux has quit [Write error: Broken pipe]
kakadu has quit [Write error: Broken pipe]
flx is now known as flux
groovy2shoes has quit [Excess Flood]
kakadu has joined #ocaml
groovy2shoes has joined #ocaml
orbitz_ has joined #ocaml
dlat_ has joined #ocaml
profan_ has joined #ocaml
ciniglio_ has joined #ocaml
dlat has quit [Write error: Broken pipe]
profan has quit [Write error: Broken pipe]
ciniglio has quit [Write error: Broken pipe]
orbitz has quit [Write error: Broken pipe]
j0sh_ has joined #ocaml
ohama has quit [Disconnected by services]
__y has joined #ocaml
haesbaert has quit [Write error: Broken pipe]
haesbaer1 has joined #ocaml
ohama has joined #ocaml
snhmib has quit [*.net *.split]
louisriesener has quit [*.net *.split]
average has quit [*.net *.split]
ktosiek[m] has quit [*.net *.split]
M-jimt has quit [*.net *.split]
obadz has quit [*.net *.split]
unbalancedparen has quit [*.net *.split]
_y has quit [*.net *.split]
vinoski has quit [*.net *.split]
dch has quit [*.net *.split]
voglerr has quit [*.net *.split]
bigs_ has quit [*.net *.split]
noplamodo has quit [*.net *.split]
pitastrudl has quit [*.net *.split]
pote_ has quit [*.net *.split]
vishesh has quit [*.net *.split]
lyxia has quit [*.net *.split]
emias has quit [*.net *.split]
jbrown has quit [*.net *.split]
danieli has quit [*.net *.split]
RomanZ5 has quit [*.net *.split]
maker has quit [*.net *.split]
msch has quit [*.net *.split]
j0sh has quit [*.net *.split]
asm89 has quit [*.net *.split]
stephe has quit [*.net *.split]
grandy has quit [*.net *.split]
Balod has quit [*.net *.split]
jpdeplaix has quit [*.net *.split]
lpaste has quit [*.net *.split]
Exagone313 has quit [*.net *.split]
evhan has quit [*.net *.split]
S11001001 has quit [*.net *.split]
adi_____ has quit [*.net *.split]
mehdib has quit [*.net *.split]
thizanne has quit [*.net *.split]
bitbckt has quit [*.net *.split]
jpdeplaix has joined #ocaml
lyxia has joined #ocaml
Balod has joined #ocaml
obadz has joined #ocaml
emias has joined #ocaml
evhan has joined #ocaml
maker has joined #ocaml
Exagone313 has joined #ocaml
louisriesener has joined #ocaml
ggherdov has quit [Ping timeout: 258 seconds]
pote_ has joined #ocaml
pitastrudl has joined #ocaml
lpaste has joined #ocaml
asm89 has joined #ocaml
unbalancedparen has joined #ocaml
Rome has joined #ocaml
ktosiek[m] has joined #ocaml
M-jimt has joined #ocaml
snhmib has joined #ocaml
jbrown has joined #ocaml
danieli has joined #ocaml
grandy has joined #ocaml
noplamodo has joined #ocaml
vishesh has joined #ocaml
mehdib has joined #ocaml
thizanne has joined #ocaml
bitbckt has joined #ocaml
vinoski has joined #ocaml
unbalancedparen has quit [Max SendQ exceeded]
danieli has quit [Max SendQ exceeded]
grandy has quit [Max SendQ exceeded]
danieli_ has joined #ocaml
alienbot has quit [Read error: Connection reset by peer]
unbalancedparen has joined #ocaml
mcspud has joined #ocaml
pierpa has joined #ocaml
average has joined #ocaml
voglerr has joined #ocaml
Balod is now known as balod
adi_____ has joined #ocaml
stephe has joined #ocaml
ggherdov has joined #ocaml
pierpa` has joined #ocaml
dch has joined #ocaml
pierpa` has quit [Remote host closed the connection]
S11001001 has joined #ocaml
pierpa has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ggherdov has quit [Excess Flood]
pierpa has joined #ocaml
alienbot has joined #ocaml
bigs_ has joined #ocaml
msch has joined #ocaml
ggherdov has joined #ocaml
alienbot has quit [Remote host closed the connection]
al-damiri has joined #ocaml
grandy_ has joined #ocaml
orbifx-m has joined #ocaml
yomimono has quit [Ping timeout: 258 seconds]
yomimono has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
thomasga has joined #ocaml
jao has joined #ocaml
MercurialAlchemi has joined #ocaml
larhat has quit [Quit: Leaving.]
ryanartecona has quit [Quit: ryanartecona]
handlex has joined #ocaml
Flerex has joined #ocaml
<Flerex> Does anyone know why am I getting this error when compiling?
<Flerex> warning: ignoring file {file}, file was built for unsupported file format ( 0x28 0x2A 0x6C 0x65 0x74 0x20 0x72 0x65 0x63 0x20 0x72 0x6C 0x69 0x73 0x74 0x20 ) which is not the architecture being linked (x86_64)
<companion_cube> seems like you have files built for another architecture
<companion_cube> try `make clean` or something like that?
<Flerex> Didn't do anything
<Flerex> it's a very simple file I'm trying to compile with ocamlc
<Flerex> This is the file
<companion_cube> how do you compile? can you remove all *.cm{i,o} files?
<Flerex> I type ocamlc {file}
<Flerex> and that's it
thomasga has quit [Quit: Leaving.]
Algebr`` has joined #ocaml
<companion_cube> try to remove file.cmi file.cmo
<Flerex> Same :S
<companion_cube> that's very weird
<companion_cube> (what if you copy your file somewhere else and try again? I really suspect a stale build file)
Algebr`` has quit [Ping timeout: 255 seconds]
<Flerex> If I copy it and paste it on the interactive compiler (ocaml) it works
slash^ has joined #ocaml
<companion_cube> I meant copy the file in another directory
thomasga has joined #ocaml
<Flerex> It works now
<Flerex> Yeah
<Flerex> Weird
<Flerex> Thanks! :)
sz0 has joined #ocaml
copy` has joined #ocaml
antkong has joined #ocaml
Denommus has joined #ocaml
mfp has quit [Ping timeout: 255 seconds]
Denommus has quit [Client Quit]
Denommus has joined #ocaml
shinnya has joined #ocaml
vicfred has joined #ocaml
jnavila has quit [Quit: It was time]
orbifx-m has quit [Ping timeout: 252 seconds]
xorpse has quit [Ping timeout: 248 seconds]
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
tane has joined #ocaml
mfp has joined #ocaml
larhat has joined #ocaml
ryanartecona has joined #ocaml
shinnya has quit [Ping timeout: 276 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
agarwal1975 has joined #ocaml
thomasga has quit [Quit: Leaving.]
zpe has quit [Ping timeout: 252 seconds]
balod has quit [Remote host closed the connection]
simon3 has joined #ocaml
balod has joined #ocaml
mengu has quit [Remote host closed the connection]
sepp2k has quit [Ping timeout: 255 seconds]
philtor has joined #ocaml
orbifx-m has joined #ocaml
antkong has quit [Quit: antkong]
handlex has quit [Quit: handlex]
Algebr`` has joined #ocaml
Algebr`` has quit [Ping timeout: 255 seconds]
handlex has joined #ocaml
Algebr``` has joined #ocaml
simon3 has quit [Remote host closed the connection]
wolfcore has quit [Ping timeout: 255 seconds]
smondet has joined #ocaml
isd has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
malc_ has joined #ocaml
wolfcore has joined #ocaml
simon3 has joined #ocaml
rgrinberg has joined #ocaml
Onemorenickname has joined #ocaml
<Onemorenickname> Hello people
<Onemorenickname> and i solved my problem
<Onemorenickname> you are so good i don't even need to ask you any question
<companion_cube> indeed
simon3 has quit [Remote host closed the connection]
emacs-fb has joined #ocaml
<companion_cube> congratulations for solving your issue!
ygrek has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
<orbifx-m> Flerex: did you use any prebuilt libraries?
wtetzner has joined #ocaml
<reynir> :D
<orbifx-m> oops, there is more log 😝
omar__ has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
ryanartecona has joined #ocaml
Onemorenickname has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
Onemorenickname has joined #ocaml
Onemorenickname has quit [Read error: Connection reset by peer]
malc_ has quit [Remote host closed the connection]
Onemorenickname has joined #ocaml
<emacs-fb> So I'm having this rather strange issue that seems to center around using a Format.formatter to write to a file. I expect to be able to write the file and flush and then close the backing channel, but what I see instead is that the last line is dropped.
<emacs-fb> But only when writing to a file -- not when writing to stdout (which can be toggled via command line)
<emacs-fb> I don't know what question to ask, except "why?"
Anarchos has joined #ocaml
<companion_cube> you need to flush the formatter as well
<companion_cube> e.g. @. will flush
<companion_cube> (use "@." rather than "\n" in Format)
<emacs-fb> I call Format.print_flush ();
<companion_cube> also, @? will flush
<emacs-fb> The sequence looks like this:
<emacs-fb> let () =
<emacs-fb> then Some Sys.argv.(2)
<emacs-fb> let output_file =
<emacs-fb> if Array.length Sys.argv > 2
<emacs-fb> let input_file = "some_file" in
<emacs-fb> else None
<emacs-fb> in
<emacs-fb> let (output_chan, output_formatter) =
<emacs-fb> match output_file with
<emacs-fb> | Some name ->
<emacs-fb> let ochan = open_out name in
<emacs-fb> (ochan, Format.formatter_of_out_channel ochan)
<companion_cube> please use a paste :/
<emacs-fb> | None -> (stdout, Format.std_formatter)
<emacs-fb> in
<emacs-fb> (
<emacs-fb> Format.set_formatter_out_channel output_chan;
<emacs-fb> Format.open_box 0;
<emacs-fb> Location.input_name := input_file;
<companion_cube> eeeek
<emacs-fb> do_some_printing ();
<reynir> heh
<emacs-fb> Format.print_flush ();
<emacs-fb> flush output_chan;
<emacs-fb> match output_file with
<companion_cube> any op around here?
<emacs-fb> | Some _ -> close_out output_chan
<emacs-fb> | None -> ()
<emacs-fb> )
<emacs-fb> Oops, sorry!
<emacs-fb> How do I do that?
<companion_cube> use https://paste.isomorphis.me/
<companion_cube> much simpler
<companion_cube> I was going to kick you
<companion_cube> ok, so: a big red flag for me is "set_formatter_out_channel"
<emacs-fb> My apologies!
<emacs-fb> Why is that a red flag?
<companion_cube> it's modifying a global variables
<companion_cube> and global variables are bad, m'kay? :D
<companion_cube> use Format.fprintf whenever you have a formatter that is not {stdout,stderr}, as a good rule of thumb
<emacs-fb> Good point.
<companion_cube> and the pp_* combinators instead of the ones working on the std formatter
<companion_cube> so `Format.fprintf my_formatter "@[%s@]@."` instead of redirecting to stdout and then using `Format.printf`
<emacs-fb> The only problem is, the do_some_printing() is a large lib that (at first) picks either to write to output_chan or output_formatter based on a command line flag & some modes.
<emacs-fb> I am not sure how it does its printing internally.
<companion_cube> :s
<companion_cube> is this a lib you don't have any control on?
<companion_cube> (as a workaround if it's the case, try `pp_print_flush output_formatter ()`)
<emacs-fb> Sort of. It is a lib that does AST printing but also it uses the default OCaml AST printer, so I have control over the part that does its own printing. For the most part.
<companion_cube> well, good style (imho) would dictate that the printing is done on a `formatter` passed as argument
voglerr has quit [Quit: Connection closed for inactivity]
<companion_cube> typically a printer for `foo` has type `Format.formatter -> foo -> unit`
<emacs-fb> Er, does that return a function that I have to then call?
<emacs-fb> (pp_print flush)
<companion_cube> no, no
<companion_cube> it's like `print_flush ()` but you pass a formatter: `pp_print_flush formatter ()`
wtetzner has quit [Remote host closed the connection]
<emacs-fb> val pp_print_flush : formatter -> unit -> unit
<emacs-fb> What is the second unit?
<reynir> the return type
<companion_cube> it takes unit and returns unit
<emacs-fb> Rather, why does it take unit?
<companion_cube> ah
<emacs-fb> Consistency's sake for the other pp_*?
<companion_cube> it's because the `Format.formatter -> 'a -> unit` is so pervasive
<companion_cube> yeah
<emacs-fb> Oh, okay
wtetzner has joined #ocaml
<companion_cube> emacs-fb: it's so it works with %a
<emacs-fb> Holy guacamole I think that pp_print_flush worked
<reynir> \o/
<emacs-fb> Do I need to have flush output_chan if I have pp_print_flush?
<emacs-fb> companion_cube: This has been hours of grief. Thank you.
<companion_cube> I think you should flush anyway
<companion_cube> better safe than sorry
<companion_cube> !search format blog > emacs-fb
<ocabot_> emacs-fb: format_blogpost -> https://cedeela.fr/format-all-the-data-structures.html
<companion_cube> in case you want to know more about Format ;-)
<emacs-fb> I shall take a look -- thank you
mengu has joined #ocaml
<emacs-fb> Oh, sorry one more question
<reynir> ooh, I like the "> nick" syntax
<emacs-fb> So I have that match block that ensures that I don't call Format.formatter_of_out_channel on stdout. But is that bad?
wtetzner has quit [Remote host closed the connection]
<companion_cube> it's reasonable, I think
<emacs-fb> The match block is reasonable or calling formatter_of_out_channel is reasonable? Sorry -- I wasn't clear
<companion_cube> both are
<companion_cube> I mean, it's a valid way not to duplicate Format.std_formatter
omar__ has quit [Ping timeout: 240 seconds]
<emacs-fb> But it shouldn't be a problem if I duplicate Format.std_formatter?
<companion_cube> I don't think it would be much of a problem
<emacs-fb> Excellent -- thank you
<companion_cube> maybe a bit unpredictable if you use both at t he same time
<companion_cube> I never did this
<emacs-fb> I don't think we use both at the same time
<emacs-fb> At least, Ack doesn't think so
<emacs-fb> If something else does the box opening, do I need to do one outside?
<companion_cube> hmmm, box openings and closings should be balanced within each formatter
<companion_cube> but where the openings and closings are is up to you
<companion_cube> I'd suggest to use combinators though, they make your life easier
<companion_cube> !fmt
omar__ has joined #ocaml
<companion_cube> (for instance)
<companion_cube> and format strings are extremely compact, too
<emacs-fb> Brilliant. Thank you so much for your time and knowledge.
<companion_cube> no pb, good luck!
emacs-fb has quit [Quit: leaving]
wtetzner has joined #ocaml
wtetzner has quit [Remote host closed the connection]
rgrinberg has quit [Remote host closed the connection]
handlex has quit [Quit: handlex]
ltadeu has quit [Ping timeout: 255 seconds]
omar__ has quit [Ping timeout: 256 seconds]
slash^ has quit [Read error: Connection reset by peer]
kakadu has joined #ocaml
zirman has quit [Ping timeout: 258 seconds]
ryanartecona has quit [Quit: ryanartecona]
omar__ has joined #ocaml
diphuser has joined #ocaml
octachron has joined #ocaml
omar__ has quit [Ping timeout: 240 seconds]
calculemus has quit [Quit: WeeChat 1.6]
dhil has quit [Ping timeout: 240 seconds]
Algebr``` is now known as Algebr
mengu has quit [Remote host closed the connection]
mengu has joined #ocaml
handlex has joined #ocaml
Orion3k has quit [Remote host closed the connection]
ciniglio_ has quit [Quit: Lost terminal]
ollehar has joined #ocaml
jnavila has joined #ocaml
octachron has quit [Quit: Leaving]
orbitz_ has quit [Quit: Reconnecting]
orbitz has joined #ocaml
orbifx-m has quit [Ping timeout: 248 seconds]
handlex has quit [Quit: handlex]
snhmib has quit [Ping timeout: 245 seconds]
jcloud is now known as jyc`
Anarchos has quit [Ping timeout: 255 seconds]
atsampso1 has joined #ocaml
jyc` is now known as jcloud
atsampson has quit [Ping timeout: 258 seconds]
Denommus has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
calculemus has joined #ocaml
<companion_cube> http://mutanatum.com/posts/2017-01-12-Browser-FP-Head-to-Head.html people of jsoo and bucklescript will appreciate their non-relevance :]
yomimono has quit [Quit: Leaving]
snhmib has joined #ocaml
orbifx has joined #ocaml
al-damiri has quit [Quit: Connection closed for inactivity]
<ollehar> hm
octachron has joined #ocaml
yomimono has joined #ocaml
antkong has joined #ocaml
antkong has quit [Client Quit]
yomimono has quit [Ping timeout: 240 seconds]
antkong has joined #ocaml
antkong has quit [Read error: Connection reset by peer]
antkong has joined #ocaml
jnavila has quit [Remote host closed the connection]
<reynir> transpilerrs
Algebr has quit [Ping timeout: 255 seconds]
Algebr` has joined #ocaml
larhat has quit [Quit: Leaving.]
unbalanced has quit [Quit: WeeChat 1.6]
infinity0 has joined #ocaml
antkong has quit [Quit: antkong]
kakadu has quit [Remote host closed the connection]
Onemorenickname has quit [Read error: Connection reset by peer]
yomimono has joined #ocaml
antkong has joined #ocaml
th5 has quit []
fre has joined #ocaml
AlexDenisov has joined #ocaml
AlexDenisov has quit [Client Quit]
al-damiri has joined #ocaml
yomimono has quit [Ping timeout: 240 seconds]
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Flerex has joined #ocaml
orbifx has quit [Ping timeout: 245 seconds]
infinity0 has quit [*.net *.split]
ollehar has quit [*.net *.split]
vicfred has quit [*.net *.split]
pote_ has quit [*.net *.split]
stephe has quit [*.net *.split]
profan_ has quit [*.net *.split]
apache3_ has quit [*.net *.split]
fraggle_ has quit [*.net *.split]
myst|fon has quit [*.net *.split]
pote_ has joined #ocaml
ollehar has joined #ocaml
stephe has joined #ocaml
infinity0 has joined #ocaml
profan_ has joined #ocaml
apache3_ has joined #ocaml
vicfred has joined #ocaml
fraggle_ has joined #ocaml
myst|fon has joined #ocaml
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
ollehar has quit [Quit: ollehar]
govg has joined #ocaml
octachron has quit [Quit: Leaving]
jmiven has quit [Quit: co'o]
smondet has quit [Ping timeout: 248 seconds]
jmiven has joined #ocaml
Algebr` has quit [Remote host closed the connection]
danieli_ is now known as danieli
danieli has quit [Changing host]
danieli has joined #ocaml
nomicflux has joined #ocaml