<sc30317>
I know, if that w_final is true, then you are supposed to exit the loop and print out the final value
<sc30317>
I just figured out that new_w is wrong
<sc30317>
new_w is a function I created
<mrvn>
but w_final never changes
<sc30317>
yea
<sc30317>
It should with new_w
<thelema>
if new_w () then exit 0;
<sc30317>
what are you saying that for thelema ?
<mrvn>
And why do you have a count when you already have i as counter?
<sc30317>
idk, could I just use !i instead of !count?
<mrvn>
Without ! I believe.
<mrvn>
But you should most likely write this recursively.
<sc30317>
ok...
<sc30317>
how would I go about doing that?
<mrvn>
.oO(Yu put your left hand on the keyboard and the right hand on the keyboard and then you type)
<sc30317>
haha nice one mrvn
<sc30317>
im trying
<sc30317>
why not right and first then left hand?
<sc30317>
:D
<mrvn>
coding is left associative.
<sc30317>
haha I guess so
<sc30317>
printf has equal left and right though?
<sc30317>
the word printf that is
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
<thelema>
mrvn: you'd write this recursively. sc30317 will most likely write this imperatively. luckily ocaml supports both.
<sc30317>
thelema, definitely!
bzzbzz_ has quit [Quit: leaving]
joewilliams_away is now known as joewilliams
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
EricFisher has joined #ocaml
<EricFisher>
Hi, I'd like to ask a question about ocamldebug. How to use user-defined printers? I'm trying to debug CIL program, can I use the printers defined in CIL directly?
<EricFisher>
Anyone there?
enthymeme has joined #ocaml
joewilliams is now known as joewilliams_away
_andre has quit [Quit: Lost terminal]
valross has joined #ocaml
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
yakischloba has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
ztfw` has quit [Remote host closed the connection]
msteele_ has quit [Ping timeout: 252 seconds]
msteele has joined #ocaml
enthymeme has joined #ocaml
smimram has quit [Read error: Operation timed out]
oc13 has joined #ocaml
smimram has joined #ocaml
ttamttam has joined #ocaml
<EricFisher>
Hi, in ocamldebug can I print the value of the element of a list?
ttamttam has quit [Client Quit]
<EricFisher>
ok nobody
ulfdoz has quit [Ping timeout: 258 seconds]
smimram has quit [Read error: Operation timed out]
ygrek has joined #ocaml
<flux>
I think not many people actually use ocamldebug :)
Yoric has joined #ocaml
smimram has joined #ocaml
ttamttam has joined #ocaml
Yoric has quit [Quit: Yoric]
Tianon has quit [Ping timeout: 245 seconds]
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
ikaros has joined #ocaml
CcSsNET has quit [Quit: User disconnected]
smimram has quit [Ping timeout: 268 seconds]
<EricFisher>
flux: So, how to debug OCaml?
<EricFisher>
without ocamldebug, for a big program.
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
smimram has joined #ocaml
oc13 has quit [Ping timeout: 240 seconds]
<Camarade_Tux>
EricFisher: well, for what kind of bug?
<EricFisher>
Camarade_Tux: Say I want to look over the internal data value or the executing path.
<EricFisher>
Camarade_Tux: You know the CIL written in Ocaml, I'm wondering how to debug it.
oc13 has joined #ocaml
<Camarade_Tux>
sounds like a task for a debugger, why not ocamldebug btw?
<EricFisher>
uh... Is there any other debugger?
<flux>
ericfisher, I've gone mostly with debug messages
<flux>
I guess ocamldebug would work if you have a program that doesn't do a lot at a time
smimram has quit [Ping timeout: 248 seconds]
<mrvn>
flux: I've submitted the Digest patch to the BTS.
<EricFisher>
So, usually, when one develop a program in OCaml, how does he make sure the program is correct?
<mrvn>
EricFisher: If it compiles it usualy works. :)
<flux>
mrvn, thumbs up ;). so what does the patch actually add? a Bigarray-compatible function for feeding digest?
<EricFisher>
I'm used to work with c and gdb, hehe.
<mrvn>
flux: Support for digesting multiple strings and Bigarray.Array1.
<mrvn>
flux: Should be usefull for the Rope type in Batteries
<Camarade_Tux>
I know you can use gdb with ocaml programs but I'm not sure to what extent (I think you'll be missing some information) and you won't have the pretty-printer
<mrvn>
Camarade_Tux: pretty badly I think.
<mrvn>
EricFisher: You could do a full verification of the source if you really want. Most people just try&error.
<Camarade_Tux>
I remember rwmjones used it but I can't remember the results
<mrvn>
In case of errors I usualy do Printf.printf debugging.
<flux>
the annoying part about producing trace messages in ocaml is converting data structures into something human-readable
<EricFisher>
Actually, I think that it's a good way to know the how the program is going with a debugger.
<flux>
toplevel is nice for that. I imagine ocamldebug can do that as well, to certain extent?
<flux>
debugger is a nice way to familiarise oneself with a new piece of code
<mrvn>
flux: ocamlc/opt should really implicitly create caml_print_<name_of_type> functions for every type.
<EricFisher>
Indeed.
<Camarade_Tux>
what about sexplib?
<mrvn>
Camarade_Tux: that is just an extention. Not every program uses it.
<EricFisher>
OK, let me ask a specific question, in ocamldebug, I want to print the value of a list, but it's very very long, how can I print a specific element of the list?
<Camarade_Tux>
yeah, but it can be used to display most data structures
<flux>
something that would combine ocamldebug and ocaml toplevel would be neat. not sure how feasible it would be, though.
<Camarade_Tux>
btw, is it possible to modify programs running in ocamldebug? like changing a value?
<Camarade_Tux>
also, a custom printer could do it (for printing as you wish)
<EricFisher>
Camarade_Tux: I don't think so. It's hard to write a complex printer.
<rwmjones>
you can debug just fine in gdb, but you only get to see assembly and function names ...
<EricFisher>
Yes, I made a try.
smimram has joined #ocaml
<EricFisher>
ocamldebug is almost good except that it can't call the functions in the program.
<EricFisher>
Again, who knows how to display a specific element of a list?
<Camarade_Tux>
set print_depth/print_length ? they'll display at most n elements
<flux>
looking at the manual there doesn't seem to be another way
<flux>
if it could invoke functions, it could simply invoke List.nth..
<EricFisher>
It's sad that It's very long.
<flux>
but, alas
<flux>
infact an ocaml-controlled debugger would be neat as well. I wonder how complicated ocamldebug is :)
<Camarade_Tux>
flux: I'm suprised there's nothing like that because with the ability to load bytecode, it sounds pretty doable
<flux>
camarade_tux, I wonder if the problem is executing that's not part of the program..
<flux>
and on the other hand you can't (?) have two ocaml runtimes around, can you?
<flux>
what you might do is fork, load new code, execute it, print output and discard the process
<Camarade_Tux>
ocamldebug can use custom printers so there should be a way
<Camarade_Tux>
and to display one specific element, you only need to combine List.nth and the already-define pretty printer for lists... but I don't know its name
<EricFisher>
yep, It's a way.
<Camarade_Tux>
I wonder if a pretty-printer for an int ref would be able to change the value of the ref
valross has quit [Remote host closed the connection]
pimmhogeling has joined #ocaml
smimram has quit [Read error: Operation timed out]
smimram has joined #ocaml
_zack has joined #ocaml
<mrvn>
Camarade_Tux: "This int ref was displayed %d times."
maattd has joined #ocaml
mbishop_ has joined #ocaml
mbishop has quit [Ping timeout: 265 seconds]
Yoric has joined #ocaml
<Camarade_Tux>
mrvn: I meant, the value of the variable it is _currently_ displaying
<Camarade_Tux>
looks like it can't
dark has quit [Remote host closed the connection]
zhijie has quit [Read error: Connection reset by peer]
Alpounet is now known as alp
alp is now known as alp_
zhijie has joined #ocaml
alp_ is now known as Alpounet
ikaros has quit [Quit: Leave the magic to Houdini]
jonafan has joined #ocaml
jonafan_ has quit [Ping timeout: 276 seconds]
<Camarade_Tux>
I want to parse command-line arguments but Arg is pretty annoying and only know of ocaml-getopt otherwise, is there any other library?
<flux>
sure
<flux>
whip your own, that's what everybody else does :)
<flux>
(Arg is indeed quite annoying)
<EricFisher>
I just changed the module named "Main" of the program, and load them all in top level. But, when I try to run the program by call "theMain ()", I found I can't transfer command line arguments to it.
<Camarade_Tux>
yeah, I started writing my own because I was in the train and had no internet access ;-)
thelema_ has joined #ocaml
<EricFisher>
Can I pass arguments in top level?
<flux>
good question. possibly not. I usually write some function I can call with the arguments, by the startup function it's called as start_here (List.tl (Array.to_list Sys.argv))
<EricFisher>
thanks, I think a good news is that top level is better than ocamldebug, because you can call any functions :-)
_andre has joined #ocaml
haelix_ has joined #ocaml
hcarty has joined #ocaml
olegfink1 has joined #ocaml
ned has joined #ocaml
ned is now known as Guest57618
<EricFisher>
No, I forgot that I can't set breakpoint and stop in top level :(
<flux>
:)
<Camarade_Tux>
wouldn't emacs provide a nice interface to the debugger?
<EricFisher>
no idea, I just use vim.
<Camarade_Tux>
I don't use emacs either (vim too ;-) ) but I think it should make it nicer to work with very long outputs
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
slash_ has joined #ocaml
mrvn has quit [Ping timeout: 248 seconds]
smimram has joined #ocaml
mrvn has joined #ocaml
albacker has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
olegfink1 has left #ocaml []
olegfink has joined #ocaml
mbishop_ has quit [Ping timeout: 260 seconds]
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
mbishop_ has joined #ocaml
bzzbzz has joined #ocaml
ttamttam has quit [Quit: Leaving.]
_unK has joined #ocaml
ninegrid has joined #ocaml
kaustuv has joined #ocaml
<kaustuv>
I want to create a comment syntax that typechecks the commented text but does not compile it. I assume this is doable using local modules and Camlp4 without much trouble, but before I attempt it does anyone know of something like it already?
<flux>
no idea, but an idea: maybe it can be implemented like: expr (* foo *) -> if false then ignore foo (foo) else expr
<flux>
it would still compile it, but (hopefully!) it wouldn't produce anything in the binary
<mrvn>
flux: you think it opimizes the if away?
joewilliams_away is now known as joewilliams
<flux>
I tried it with a trivial example and it did
<flux>
let foo a = if false then ignore (Printf.printf "hello") else a --> camlFoo__foo_58: .L100: ret
<flux>
actually ignore is not right there, something like (expr; assert false) would be more appropriate
<kaustuv>
flux: Interestingg. Thanks. Apparently let Foo (M : sig end) = struct ... end in <code not using Foo> is not optimized away, so your idea is superior
<kaustuv>
err, let module Foo that is
<kaustuv>
ignore(expr); assert false
<oc13>
hi, a short question,
<oc13>
which module shall i use: obus or ocaml-dbus
<oc13>
ocaml-dbus ships with fedora
kaustuv has left #ocaml []
ttamttam has joined #ocaml
<flux>
no idea. take a look at both of their interfaces and pick one you like?
<flux>
other metrics: size of implementation (bigger is likely more complete)
<flux>
code quality can be more difficult to see, but I guess "good code" is likely to be less buggy
ttamttam has quit [Quit: Leaving.]
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
M| has quit [Quit: leaving]
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
smimram has quit [Ping timeout: 268 seconds]
zhijie has joined #ocaml
<f[x]>
oc13, ocaml-dbus is binding to libdbus, obus - is ocaml native implementation of dbus wire protocol
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
tmaedaZ is now known as tmaeda
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
smimram has joined #ocaml
zhijie has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
Asmadeus has quit [Ping timeout: 240 seconds]
drk-sd has joined #ocaml
Asmadeus has joined #ocaml
<oc13>
f[x], thanks.
philtor has joined #ocaml
pimmhogeling has joined #ocaml
philtor has quit [Ping timeout: 268 seconds]
zhijie has quit [Read error: Connection reset by peer]
yakischloba has joined #ocaml
zhijie has joined #ocaml
pimmhogeling has quit [Ping timeout: 260 seconds]
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
zhijie has quit [Read error: Connection reset by peer]
zhijie has joined #ocaml
oc13 has quit [Ping timeout: 268 seconds]
smimram has quit [Ping timeout: 268 seconds]
svenl has quit [Ping timeout: 245 seconds]
drk-sd has quit [Quit: {'EXIT', drk-sd, "bye"}]
smimram has joined #ocaml
pimmhogeling has joined #ocaml
f[x] has quit [Ping timeout: 256 seconds]
_unK has quit [Remote host closed the connection]
thelema_ has left #ocaml []
thelema has joined #ocaml
ikaros has joined #ocaml
joewilliams is now known as joewilliams_away
Tianon has quit [Quit: shutting down :(]
_zack has quit [Quit: Leaving.]
sepp2k has joined #ocaml
sshc has quit [Quit: leaving]
Yoric has quit [Quit: Yoric]
det has quit [Read error: Connection reset by peer]
maskd has joined #ocaml
ulfdoz has joined #ocaml
sshc has joined #ocaml
sshc has quit [Client Quit]
sshc has joined #ocaml
schmx has quit [Ping timeout: 276 seconds]
rwmjones has quit [Ping timeout: 245 seconds]
smimram has quit [Ping timeout: 268 seconds]
smimram has joined #ocaml
<flux>
thelema, methinks String.quote is broken.. also that I really should use the BTS ;)
krankkatze has joined #ocaml
rwmjones has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
mbishop_ is now known as mbishop
bluestorm has joined #ocaml
smimram has quit [Ping timeout: 268 seconds]
ygrek has quit [Ping timeout: 245 seconds]
smimram has joined #ocaml
bzzbzz has quit [Ping timeout: 264 seconds]
ygrek has joined #ocaml
rwmjones has quit [Ping timeout: 245 seconds]
rwmjones has joined #ocaml
pimmhogeling has quit [Read error: Connection reset by peer]
Mr_Awesome has quit [Ping timeout: 245 seconds]
deavid has quit [*.net *.split]
srcerer has quit [*.net *.split]
mattam has quit [*.net *.split]
bitbckt has quit [*.net *.split]
ski has quit [*.net *.split]
rbancroft has quit [*.net *.split]
patronus has quit [*.net *.split]
shr3kst3r has quit [*.net *.split]
infoe has quit [*.net *.split]
srcerer has joined #ocaml
bitbckt has joined #ocaml
ski has joined #ocaml
rbancroft has joined #ocaml
patronus has joined #ocaml
shr3kst3r has joined #ocaml
infoe has joined #ocaml
mattam has joined #ocaml
bzzbzz has joined #ocaml
mrvn has quit [Ping timeout: 276 seconds]
mrvn has joined #ocaml
pimmhogeling has joined #ocaml
_andre has quit [Quit: *puff*]
Yoric has joined #ocaml
_unK has joined #ocaml
bluestorm has quit [Ping timeout: 258 seconds]
bluestorm has joined #ocaml
Associat0r has joined #ocaml
bluestorm has quit [Quit: Leaving]
bluestorm has joined #ocaml
bluestorm has quit [Client Quit]
bluestorm has joined #ocaml
matthieu_ has joined #ocaml
maattd has quit [Ping timeout: 256 seconds]
Yoric has quit [Quit: Yoric]
pimmhogeling has quit [Ping timeout: 265 seconds]
Asmadeus has quit [Ping timeout: 260 seconds]
boscop_ has left #ocaml []
boscop has joined #ocaml
philtor has joined #ocaml
enthymeme has joined #ocaml
matthieu_ has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
ulfdoz has quit [Ping timeout: 246 seconds]
Asmadeus has joined #ocaml
drk-sd has joined #ocaml
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
ygrek has quit [Ping timeout: 245 seconds]
maattd has joined #ocaml
krankkatze has quit [Remote host closed the connection]