mfurr changed the topic of #ocaml to: OCaml 3.08.2 available! | Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ | 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/
<dan2> I love ocaml
<dan2> let agi_init (a:agicon) : agistor (* agicon -> agistor *) =
<dan2> let htbl = Hashtbl.create 9 in
<dan2> let add_entry x y = Hashtbl.add htbl x y in
<dan2> let rec getdata () =
<dan2> let b = (input_line a.inchan) in
<dan2> match b with
<dan2> | "" -> htbl
<dan2> | b -> Scanf.sscanf b "%s = %s" add_entry; getdata();
<dan2> in
<dan2> getdata();;
<dan2> Demitar: ^ works
<dan2> hmm, I bet scanf would make a quick easy config parser
<dan2> is there a limitation in ocaml on how long strings can be
<pango> 16M chars on 32 bits architectures
<dan2> hmm
<dan2> how long of a string can its scanf function process
<pango> probably the same
smkl has joined #ocaml
hangman4 has quit [Connection timed out]
wam has quit ["it's all over"]
wam has joined #ocaml
mlh has joined #ocaml
CapNemo has quit [Read error: 60 (Operation timed out)]
smkl has quit [Read error: 238 (Connection timed out)]
gim has quit ["zoo dodo"]
mattam has quit ["zZz"]
zzorn_afk has quit ["zzz"]
drz has joined #ocaml
<dan2> whats the best way to go about stripping/chomping a string in ocaml
smkl has joined #ocaml
mrsolo has joined #ocaml
hangman4 has joined #ocaml
vezenchio has joined #ocaml
kinners has joined #ocaml
mlh has quit [Client Quit]
hangman4 has quit [Connection timed out]
kinners has quit ["leaving"]
hangman4 has joined #ocaml
cryptilox has joined #ocaml
cryptilox has quit ["[BX] I'm off like a prom dress..."]
shawn has quit [sterling.freenode.net irc.freenode.net]
vezenchio has quit [sterling.freenode.net irc.freenode.net]
pharx has quit [sterling.freenode.net irc.freenode.net]
Hanji has quit [sterling.freenode.net irc.freenode.net]
vincenz has quit [sterling.freenode.net irc.freenode.net]
durnew has quit [sterling.freenode.net irc.freenode.net]
dobrek has quit [sterling.freenode.net irc.freenode.net]
shammah has quit [sterling.freenode.net irc.freenode.net]
rossberg has quit [sterling.freenode.net irc.freenode.net]
rifleman has quit [sterling.freenode.net irc.freenode.net]
avlondono has quit [sterling.freenode.net irc.freenode.net]
mflux_ has quit [sterling.freenode.net irc.freenode.net]
Godeke has quit [sterling.freenode.net irc.freenode.net]
Smerdyakov has quit [sterling.freenode.net irc.freenode.net]
Hadaka has quit [sterling.freenode.net irc.freenode.net]
pango has quit [sterling.freenode.net irc.freenode.net]
Hipo has quit [sterling.freenode.net irc.freenode.net]
noj has quit [sterling.freenode.net irc.freenode.net]
calvin_ has quit [sterling.freenode.net irc.freenode.net]
solarwind has quit [sterling.freenode.net irc.freenode.net]
Demitar has quit [sterling.freenode.net irc.freenode.net]
hangman4 has quit [sterling.freenode.net irc.freenode.net]
mrsolo has quit [sterling.freenode.net irc.freenode.net]
mrvn has quit [sterling.freenode.net irc.freenode.net]
Riastradh has quit [sterling.freenode.net irc.freenode.net]
cmeme has quit [sterling.freenode.net irc.freenode.net]
mellum has quit [sterling.freenode.net irc.freenode.net]
smkl has quit [sterling.freenode.net irc.freenode.net]
hangman4 has joined #ocaml
vezenchio has joined #ocaml
mrsolo has joined #ocaml
smkl has joined #ocaml
pango has joined #ocaml
mrvn has joined #ocaml
Godeke has joined #ocaml
pharx has joined #ocaml
Hanji has joined #ocaml
Hipo has joined #ocaml
shawn has joined #ocaml
Riastradh has joined #ocaml
noj has joined #ocaml
calvin_ has joined #ocaml
Smerdyakov has joined #ocaml
cmeme has joined #ocaml
solarwind has joined #ocaml
vincenz has joined #ocaml
durnew has joined #ocaml
dobrek has joined #ocaml
shammah has joined #ocaml
rossberg has joined #ocaml
mflux_ has joined #ocaml
Hadaka has joined #ocaml
rifleman has joined #ocaml
avlondono has joined #ocaml
Demitar has joined #ocaml
mellum has joined #ocaml
rifleman has quit [sterling.freenode.net irc.freenode.net]
vezenchio has quit [sterling.freenode.net irc.freenode.net]
Hanji has quit [sterling.freenode.net irc.freenode.net]
dobrek has quit [sterling.freenode.net irc.freenode.net]
rossberg has quit [sterling.freenode.net irc.freenode.net]
pharx has quit [sterling.freenode.net irc.freenode.net]
durnew has quit [sterling.freenode.net irc.freenode.net]
vincenz has quit [sterling.freenode.net irc.freenode.net]
avlondono has quit [sterling.freenode.net irc.freenode.net]
shammah has quit [sterling.freenode.net irc.freenode.net]
vezenchio has joined #ocaml
pharx has joined #ocaml
Hanji has joined #ocaml
vincenz has joined #ocaml
durnew has joined #ocaml
dobrek has joined #ocaml
shammah has joined #ocaml
rossberg has joined #ocaml
avlondono has joined #ocaml
rifleman has joined #ocaml
mflux_ has quit [sterling.freenode.net irc.freenode.net]
mflux_ has joined #ocaml
smkl has quit [sterling.freenode.net irc.freenode.net]
smkl has joined #ocaml
smkl has quit [Read error: 238 (Connection timed out)]
hangman4 has quit [Connection timed out]
hangman4 has joined #ocaml
cryptilox has joined #ocaml
smkl has joined #ocaml
cryptilox has quit ["BitchX: it won't get you laid"]
shawn_ has joined #ocaml
shawn has quit [Read error: 60 (Operation timed out)]
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
smkl has quit [Read error: 238 (Connection timed out)]
Submarine has joined #ocaml
ez4 has joined #ocaml
smkl has joined #ocaml
hangman4 has quit [Read error: 110 (Connection timed out)]
Submarine has quit [Read error: 60 (Operation timed out)]
Submarine has joined #ocaml
vezenchio has quit ["haibane · renmei"]
hangman4 has joined #ocaml
vezenchio has joined #ocaml
_JusSx_ has joined #ocaml
_JusSx_ has left #ocaml []
<Demitar> Can I make a method with a polymorphic argument? method query (f : (Atlas.t -> 'a option)) : 'a =
<pango> I think the class must also be parametrized with 'a, but I could be wrong
<vincenz> no
<vincenz> you can parametrize the method
<Demitar> The error I get is: <class error> The method query has type (Atlas.t -> 'a option) -> 'a where 'a is unbound
<vincenz> f: 'a.((Atlas.t -> 'a option) -/ 'a)
<Demitar> Ah.
<vincenz> it's like templates I think
<Demitar> Those nasty dots...
<vincenz> f: 'a.((Atlas.t -> 'a option) -> 'a)
<vincenz> I think it will basically have different f's inside
<vincenz> kind of like templates
<Demitar> Get a syntax error by the dot though...
<vincenz> not sure of the exact syntax
<vincenz> never used it
<vincenz> but should be something like that
_fab has joined #ocaml
<Demitar> That ought to be more fruitful than looking at the bnf grammar, thanks. :)
<vincenz> method fold : 'a. ('a -> int -> 'a) -> 'a -> 'a =
<vincenz> but you have to make a function inside
<vincenz> method fold : 'a. ('a -> int -> 'a) -> 'a -> 'a = fun ...
<vincenz> you have to assign a func to it
<vincenz> work now?
<Demitar> Yes.
<Demitar> But wrapping a function inside feels a tad awkward.
<vincenz> yeah
<vincenz> don't know why
<vincenz> anyways
<vincenz> gotta go
zzorn has joined #ocaml
smkl has quit [Read error: 238 (Connection timed out)]
Submarine has quit ["Leaving"]
<dan2> Demitar: how do I make a larger if statement
<dan2> do I use begin end?
<mflux_> you may use begin/end or parenthesis
<dan2> mflux_: thanks
<mflux_> I however often use construct let _ = () in
<dan2> mflux_: ugh
<mflux_> but sometimes when you need to bind something anyway, that can be avoided
<Demitar> mflux_, dangerous though. Since it doesn't catch partial applications. :)
<mflux_> demitar, hmm?
<Demitar> let _ = String.sub in doesn
<Demitar> 't warn.
<mflux_> but that's not what I wrote
<Demitar> What you wrote was a no-op so I took the liberty of extending the thought. ;-)
<mflux_> if true then let _ = () in insert_code_here; more_code; else bar
<Demitar> That works?
<mflux_> yes
<Demitar> Strange scoping.
<mflux_> I don't find it very strange
<mflux_> but it doesn't mean it couldn't be ;)
<Demitar> Well usually the if statement ends with the first semicolon. It becomes odd in a case like this: if false then let cow = "cow" in print_endline (cow ^ cow); (* here I expect to back at the pre-if level *) print_endline "regardless of wether the previous test worked ...";
<mflux_> let foo = let a = 42 in let b = 66 in a + b; Printf.printf "%d\n" (a - b);
<mflux_> whops, add () after 'foo'
<mflux_> do you expect the function not to include the printf?
<mflux_> (note that the function makes no sense ;))
<Demitar> mflux_, thing is that I would also naively expect if true then print_endline "foo"; print_endline "bar" else print_endline "quux"; to work.
<mflux_> well the problem comes from that else is optional
<mflux_> what would you expect if true then if true then a else b to return?
<mflux_> hmph, make that second true to false
<mflux_> or first true to false
<Demitar> The if statement has a tad of a relearning curve coming from other languages, and then the let _ () in comes and makes what one originally thought would work be true again, it's unexpected to say the least.
<mflux_> in any case, you can use an editor that automatically indents the code ;)
gim has joined #ocaml
<mflux_> the thing is that one is 'expected' to write mostly functional code
<mflux_> so there rarely are consecutive statements
<mflux_> and ifs always have an else-branch
<Demitar> Yes, it's not a huge problem but the fact that one all of the sudden has to *limit* the scope of if rather than extend it is definitely not along the lines of least suprise.
<mflux_> you can still write if foo then begin asdfasdf; babar; end if you want
<mflux_> and I would imagine atleast for old pascal programmers that seems quite natural
<mflux_> well, for c/c++/java-writers too infact
<mflux_> but 'let a = 42 in' is some sort of a scoping construct not similar to ones in those languages
<mflux_> and can be 'abused' with that let _ = () -thingy
<Demitar> Yes, in the end, it's the scoping of let ... in is what isn't quite expected.
smkl has joined #ocaml
Submarine has joined #ocaml
TFK has joined #ocaml
smkl has quit [Read error: 238 (Connection timed out)]
mrvn_ has joined #ocaml
mrvn has quit [Read error: 110 (Connection timed out)]
mrvn_ is now known as mrvn
smkl has joined #ocaml
pango has quit [Read error: 110 (Connection timed out)]
pango has joined #ocaml
_shawn has joined #ocaml
shawn_ has quit [Read error: 110 (Connection timed out)]
smimou has quit ["?"]
vezenchio has quit ["haibane · renmei"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
smkl has quit [Read error: 238 (Connection timed out)]
pharx has quit []
stef_ has joined #ocaml
mrsolo_ has quit [Read error: 54 (Connection reset by peer)]
mrsolo_ has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
smkl has joined #ocaml
hangman4 has quit [Read error: 110 (Connection timed out)]
smkl has quit [Read error: 238 (Connection timed out)]
Submarine has quit ["Leaving"]
drz has quit ["using sirc version 2.211+KSIRC/1.3.11"]
drz has joined #ocaml
smkl has joined #ocaml
zzorn is now known as zzorn_afk
mrsolo_ has joined #ocaml
_shawn has quit ["Leaving"]
m3ga has joined #ocaml