smimou changed the topic of #ocaml to: OCaml 3.08.3 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
__DL__ has quit [Remote closed the connection]
araujo has joined #ocaml
eyda|mon has joined #ocaml
<eyda|mon> I don't see XML-light on the Caml hump page or anything. Is there any Xml lib anyone can recommend?
<tautologico> PXP
<eyda|mon> thanks
<eyda|mon> hm, it was on the old version of the Caml hump site
<eyda|mon> I didn't see it on the new one
<eyda|mon> I thought the information would be on both sites
<eyda|mon> thanks again
<tautologico> no problem
mrvn has joined #ocaml
<eyda|mon> brb
eyda|mon has left #ocaml []
eyda|mon2 has joined #ocaml
<tautologico> why oh why ocaml doesn't have a simple implode function ?
mrvn_ has quit [Read error: 110 (Connection timed out)]
<mauke> (implode : string list -> string)?
<mauke> or what do you mean by implode?
<tautologico> char list -> string
<tautologico> like in SML
<mauke> ah
<tautologico> explode : string -> char list
<tautologico> I just wrote one
<tautologico> but it should be standard :)
<mauke> String.concat "" List.map (String.make 1)
<tautologico> good
<mauke> er, that may not work
<mauke> let implode chars = String.concat "" (List.map (String.make 1) chars)
<tautologico> works
<tautologico> thanks
<tautologico> a looming deadline makes me miss that kind of things
<mauke> damn, there is no range function
<tautologico> nop
<mauke> let rec range from to = if from > to then [] else from :: range (from + 1) to
<mauke> let explode s = List.map (fun i -> s.[i]) (range 0 (String.length s - 1))
<mauke> and now the same stuff in perl: sub implode { join '', @_ } sub explode { split //, $_[0] }
<tautologico> I don't need explode right now :)
<tautologico> well, in python:
<tautologico> I don't remember, but it has functions for this too
<tautologico> anyway, perl is made for this kind of stuff
<mauke> yeah
<tautologico> the only minor quibble is that range is not tail recursive
<tautologico> but it shouldn't hurt in this case
<mauke> huhu, in haskell:
<tautologico> I made one that is tail recursive because I needed large ranges
<mauke> implode :: [Char] -> String
<mauke> implode = id
<tautologico> well, not fair :)
<tautologico> in haskell strings are char lists
<tautologico> which is a more elegant representation, indeed
<tautologico> good time to check how String.concat is implemented
<tautologico> hm... that's a bit huge
<mauke> lots of unsafe_blits
<tautologico> yep
<tautologico> my implode was
<tautologico> let implode chlist = List.fold_left (fun s ch -> s ^ (String.make 1 ch)) "" chlist
<tautologico> wonder which is more efficient
<tautologico> well
<tautologico> concat creates a single string with the right size
<tautologico> fold will create many intermediate strings
cjohnson has quit [""We live like penguins in the desert...""]
eyda|mo has joined #ocaml
eyda|mo is now known as eyda|mon
ulfdoz has joined #ocaml
<eyda|mon> the PXP seems like an overkill for what I want to do. I did see XML-light, but is there anything similar?
eyda|mon2 has quit [Read error: 110 (Connection timed out)]
<eyda|mon> h, there it is
ulfdoz_ has quit [Read error: 60 (Operation timed out)]
tautologico has quit []
eyda|mon has quit []
vezenchio has joined #ocaml
epichrom has quit ["What is the meaning of "meaning"?"]
_shawn has joined #ocaml
<ulfdoz> re
__DL__ has joined #ocaml
shawn_ has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
Herrchen has joined #ocaml
<Snark> slt
pediddle has joined #ocaml
pediddle is now known as pediddle_
pediddle_ is now known as pediddle
pediddle has left #ocaml []
angagon has joined #ocaml
det has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
det has joined #ocaml
gcharlo2 has joined #ocaml
_JusSx_ has joined #ocaml
Skal has joined #ocaml
Smerdyakov has quit [Client Quit]
Smerdyakov has joined #ocaml
Herrchen has quit ["bye"]
smimou has joined #ocaml
Shadek has joined #ocaml
<Shadek> hello
<Shadek> which editor / programming environment can I use to program in OCAML ?
<det> emacs is great
kinners has joined #ocaml
<Shadek> does it have a read, eval loop ?
<kinners> ocaml? yes
<kinners> using ledit/rlwrap makes it usable, and the emacs mode can be very useful
_JusSx_ has quit ["leaving"]
<kinners> and there is the editor+shell written in tk too
<Shadek> ok, I'll try the emacs solution
<Shadek> I have it already configured with slime (lisp)
<kinners> (ocamlbrowser is the tk version)
<Shadek> but emacs+slime was a single ebuild... I wonder if there is an equivalent for ocaml... I suppose I'll have to configure it by hand
<kinners> all I know is that an ocaml mode came with my xemacs, and that there is another mode called tuareg which I installed seperately (via a debian pkg)
<Shadek> I see that in gentoo, there is an ocaml mode for xemacs, but I have emacs installed... I just don't want 2 emacs flavors to be installed at the same time.
<Shadek> thanks anyway
<kinners> np
<Shadek> I found a website that proposes a solution for emacs+ocaml. This is http://www.enseignement.polytechnique.fr/profs/informatique/Didier.Remy/emacs/
<Shadek> oh I just found it in my portage tree. The ebuil is called ocaml-mode :)
<TeXitoi> Shadek: tuareg-mode is better
<Shadek> ok
kinners has quit [Nick collision from services.]
kinners has joined #ocaml
<vincenz> kinners: what is rlwrap?
<kinners> vincenz: it provides a libreadine prompt for shell programs (with history, completion, etc.)
_JusSx_ has joined #ocaml
_JusSx_ has quit ["leaving"]
_JusSx_ has joined #ocaml
kinners has quit ["leaving"]
* vincenz nods
Banana has quit ["."]
<araujo> Morning.
cjohnson has joined #ocaml
_JusSx__ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
<araujo> Im playing a bit with input/output stuff
<araujo> im trying to get working the input function, but i apparently am passing wrong arguments:
<araujo> input ic [] 0 15;;
_JusSx__ has quit ["leaving"]
<mflux> let s = String.create 15 in input ic s 0 (String.length s); s
<mflux> in ocaml strings are not lists
<araujo> Right. that was my confusion.
<mflux> also input doesn't construct the string, it merely modifies the string it is passed
<mflux> doesn't change its length either, so be careful ;).
<araujo> mflux, so, we can say that strings are ocaml native types?
<araujo> mm.. i didn't know that String.create thingy...
<araujo> interesting
<araujo> It creates an empty string? :-)
<mrvn> you can create a undefined or an empty string.
<mrvn> Often the first thing you do to a string is fill it with some data. No point setting it all to 0 beforehand then.
<araujo> I see. But in this case, it is necessary right?
<mrvn> String.create n returns a fresh string of length n. The string initially contains arbitrary characters.
<araujo> I see.
<mrvn> And the next thing you do is fill it with input, so that is ok.
<mrvn> String.make length char creates and initializes a string for you.
<araujo> Good. I imagine i couldn't use that fresh string before filling it with input....
<araujo> i test
<mrvn> you can. But there is no way of telling what is in there.
<araujo> Cool.
<mrvn> whatever data was in that memory segment before.
<araujo> Right.
<araujo> And other q, im usually deal with the concept of strings being just char lists.
<araujo> I see it isn't that way here, what are strings exactly?
<araujo> A native data type, similar to char, int...
<araujo> ?
<mrvn> Strings are a buffer of memory.
<araujo> Oh, nice, so, the string type is just a reference to that buffer?
<mrvn> Afaik it is that buffer with a header
<mrvn> internaly.
<araujo> Ok, thanks, that will help me to deal better with this new concept
Banana has joined #ocaml
Herrchen has joined #ocaml
TeXitoi has quit [Read error: 54 (Connection reset by peer)]
TeXitoi has joined #ocaml
_JusSx_ has joined #ocaml
<araujo> Hello.
<araujo> I get:
<araujo> # let s = String.create 15 in input ic s 0 (String.length s); s;;
<araujo> Warning: this expression should have type unit.
<araujo> But input returns int
<araujo> I don't get what happens
<mellum> input ic s 0 (String.length s) has type int, but you ignore the int.
<araujo> How can't i ignore it?,
<vincenz> ignore ()
* araujo scratches his head
<vincenz> ignore (input ...)
<vincenz> ignore : 'a -> unit
<araujo> Thanks :-)
haakonn_ has quit [Read error: 104 (Connection reset by peer)]
haakonn_ has joined #ocaml
angagon has quit [Read error: 110 (Connection timed out)]
<araujo> let oc = open_out "other" and s = "Great O\'Caml" in output oc s 0 (String.length s);;
<araujo> It isn't writing to the file
<vincenz> you're checking the file while it's still open in ocaml?
* araujo doesn't get it what vincenz said
<vincenz> you open another terminal to check the file while ocaml is still running?
<Snark> araujo: did you check the file while ocaml had it still open?
<vincenz> maybe it's not flushed
<Snark> (in which case the writing might still be cached)
<vincenz> io, in any language, typically buffers
<araujo> Oh, i see
* Snark shuts up
<araujo> :-/
<araujo> dumb me, thanks
<Snark> araujo: not that dumb: I do the same regularly ;-)
epichrom has joined #ocaml
<araujo> Snark, :-)
<ulfdoz> /adsfas////wb
<ulfdoz> Sorry, my Box didn't respond.
pango__ has joined #ocaml
pango_ has quit [Read error: 60 (Operation timed out)]
_JusSx__ has joined #ocaml
cjohnson has quit [Remote closed the connection]
cjohnson has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
gcharlo2 has quit ["Leaving"]
cjohnson has quit [Remote closed the connection]
<araujo> Anybody knows a function to include newlines into an out_channel ?
<Snark> '\n' ?
cjohnson has joined #ocaml
cjohnson has quit [Read error: 104 (Connection reset by peer)]
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]
_JusSx__ has quit ["leaving"]
Demitar has joined #ocaml
<Snark> good night
Snark has left #ocaml []
_JusSx_ has joined #ocaml
cognominal has quit [Remote closed the connection]
cognominal has joined #ocaml
cjohnson has joined #ocaml
vezenchio has quit [""Under democracy one party always devotes its chief energies to trying to prove that the other party is unfit to rule—and bot]
elk has joined #ocaml
<ulfdoz> cya
mart has joined #ocaml
Shadek has left #ocaml []
mart has left #ocaml []
bzzbzz has joined #ocaml
__DL__ has quit [Read error: 131 (Connection reset by peer)]
_JusSx_ has quit ["leaving"]
gim_ has joined #ocaml
vodka-goo has joined #ocaml
bzzbzz has quit ["leaving"]
gim has quit [Read error: 110 (Connection timed out)]
elk has quit [Read error: 60 (Operation timed out)]
gim_ is now known as gim
Skal has quit [Remote closed the connection]
vodka-goo has quit []
mlh has joined #ocaml