Taaus changed the topic of #ocaml to: http://caml.inria.fr/oreilly-book/
<Dybbuk> Ok, dumb newbie question: How do I get the length of a string?
kjs3 has joined #ocaml
<timmy> Dybbuk: String.length my_string
skylan has quit [No route to host]
Dybbuk has quit [Read error: 110 (Connection timed out)]
kjs3 has quit [Read error: 110 (Connection timed out)]
puffin has quit [carter.openprojects.net irc.openprojects.net]
puffin has joined #ocaml
puffin has quit [carter.openprojects.net irc.openprojects.net]
Yurik has quit [carter.openprojects.net irc.openprojects.net]
samx has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
puffin has joined #ocaml
Yurik has joined #ocaml
samx has joined #ocaml
Dieb has joined #ocaml
timmy has joined #ocaml
puffin has quit [carter.openprojects.net irc.openprojects.net]
samx has quit [carter.openprojects.net irc.openprojects.net]
Yurik has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
puffin has joined #ocaml
Yurik has joined #ocaml
samx has joined #ocaml
Dieb has joined #ocaml
timmy has joined #ocaml
gl has quit [Connection timed out]
skylan has quit [carter.openprojects.net irc.openprojects.net]
puffin has quit [carter.openprojects.net irc.openprojects.net]
samx has quit [carter.openprojects.net irc.openprojects.net]
Yurik has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
puffin has joined #ocaml
Yurik has joined #ocaml
samx has joined #ocaml
Dieb has joined #ocaml
timmy has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
puffin has quit [carter.openprojects.net irc.openprojects.net]
samx has quit [carter.openprojects.net irc.openprojects.net]
Yurik has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
puffin has joined #ocaml
Yurik has joined #ocaml
samx has joined #ocaml
Dieb has joined #ocaml
timmy has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
yangsx has joined #ocaml
yangsx has left #ocaml []
gl has joined #ocaml
Cryptor has joined #ocaml
Yurik has quit ["restart"]
Yurik has joined #ocaml
Yurik has quit ["restart"]
Yurik has joined #ocaml
owll has joined #ocaml
Cryptor has quit ["Leaving"]
owll has left #ocaml []
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger."]
gl has joined #ocaml
gl has quit ["La foule est une somme d'erreurs qu'il faut corriger."]
gl has joined #ocaml
casken has joined #ocaml
casken has quit []
Dybbuk has joined #ocaml
<Dybbuk> timmy: Thanks.
gl has quit [No route to host]
<Dybbuk> Ok...let me see if I'm understanding something correctly here.
<Dybbuk> If I do a 'let foo = 5 in ...', then any time I modify foo, it's still modifying the foo in the local scope?
<Dybbuk> How do I set foo to something else?
<Dybbuk> 'let foo = 5 in let foo = foo + 1 ;;' Does that work?
<Dybbuk> No it doesn't.
<Dybbuk> Hmmm.
<Dybbuk> So the only way you can do that kind of stuff with an int is with 'ref'?
<Dybbuk> That seems strange.
<puffin> let foo = 5 in let foo = foo+1 in print_int(foo);;
<puffin> you can do that. but the two foos are different variables which happen to have the same name
Dybbuk has quit [Read error: 110 (Connection timed out)]
gl has joined #ocaml
Dybbuk has joined #ocaml
<Dybbuk> Wow, I'm having one of those great network days.
gl has quit [Read error: 104 (Connection reset by peer)]
<Dybbuk> I'm having issues with 'try .. with'.
<Dybbuk> "This expression has type unit but is here used with type string"
<Dybbuk> I just want to print out the error message.
<Dybbuk> Oh whoops.
<Dybbuk> No, this is the real error:
<Dybbuk> This expression has type unit but is here used with type unit -> unit
<smkl> you probably forgot one () argument
<Dybbuk> Hmmm.
<Dybbuk> Here's what I'm doing:
<Dybbuk> try
<Dybbuk> main()
<Dybbuk> with
<Dybbuk> SQL_Error(s) -> print_string s; print_newline()
<Dybbuk> | _ -> print_string ("Unknown error\n")
<Dybbuk> ;;
<Dybbuk> I copied it straight out of the Ocamlodbc examples.
<Dybbuk> Maybe I'm forgetting to link with something?
<smkl> your main has bad type
<Dybbuk> Oh...damn.
<Dybbuk> How do I change the type?
<smkl> write it correctly
<Dybbuk> Oh, got it. :)
<Dybbuk> I did forget a ()
<Dybbuk> Thanks.
<Dybbuk> Sorry about the dumb questions. This is merely my second day on the ocaml wagon.
<Dybbuk> Is there an ocaml pretty printer, like prin1 in Lisp?
<smkl> what does prin1 do?
<Dybbuk> It will print out internal representations of Lisp expressions.
<Dybbuk> So for example, if you (defun foo (x) (+ x 1)), prin1 will print that out. :)
<Dybbuk> Or some variety of prin1 will do it.
<Dybbuk> I can never keep them all straight.
<Dybbuk> there's print, prin1, princ, and so on.
<smkl> nope
<Dybbuk> Oh, drat.
<Dybbuk> Well, I got the odbc stuff working...so it seems like my biggest hurdle is the fact that there's no mod_caml or mod_ocaml type thing for Apache.
<Dybbuk> But you can link ocaml into plain old C libraries, right?
<smkl> you need to do some interfacing for that
<Dybbuk> Yeah, that's what I was afraid of. Looking at the way mod_perl is written, it includes FFI wrappers for much of the Apache API.
<Dybbuk> It's a big project.
<Dybbuk> It would probably be simpler to write a threaded web server in Ocaml and just use Apache's mod_proxy.
<Dybbuk> What I'd really like is some glue between Perl and XS.
<Dybbuk> Er, Perl and Ocaml.
<smkl> somebody said that mod_* wouldn't be useful for compiled languages
<Dybbuk> Well, they're wrong.
<Dybbuk> It's very useful for compiled languages.
<Dybbuk> Consider the case where you have a web server taking 100 hits per second, each of those hits needing to pull data from an RDBMS.
<Dybbuk> Usually the connection and authentication to the RDBMS takes longer than a hundred queries, so it's wiser to reuse one or two connections than to call a new DBH connection with every hit.
<Dybbuk> Not only that, but there's considerable overhead forking CGI programs.
<Dybbuk> Anyhow, using mod_proxy would work.
<Dybbuk> A Perl->Ocaml glue would work even better. That would make me happpppy.
<Dybbuk> And I think I see how to do it.
<Dybbuk> There's an Inline::Python module for Perl that uses the Python/C interface to do what I want.
gl has joined #ocaml
* gl &
<Dybbuk> fg %1