flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
ulfdoz_ is now known as ulfdoz
jeff_s_ has joined #ocaml
jamii has quit [Connection timed out]
seafood has joined #ocaml
Associ8or has quit []
alexyk has joined #ocaml
Kerris7 has quit ["Don't even think about saying Candlejack or else you wi"]
<palomer> whoa
<palomer> revised syntax changes the application order of constructors
<palomer> type constructors
jeff_s_ has quit []
<palomer> anyone have any pcre friendly regexps for specifying floats and integers?
Amorphous has quit [Read error: 110 (Connection timed out)]
<kaustuv_> integers is easy: -?\d+
<palomer> works
<palomer> oh, and string
<kaustuv_> surely the answers you seek are just a google search away?
<palomer> actually, scratch string
<palomer> but they won't give me ocaml friendly regexps!
Amorphous has joined #ocaml
sanguine1 has quit [lindbohm.freenode.net irc.freenode.net]
xevz has quit [lindbohm.freenode.net irc.freenode.net]
Demitar has quit [lindbohm.freenode.net irc.freenode.net]
maxote has quit [lindbohm.freenode.net irc.freenode.net]
mattam has quit [lindbohm.freenode.net irc.freenode.net]
haelix_ has quit [lindbohm.freenode.net irc.freenode.net]
bohanlon has quit [lindbohm.freenode.net irc.freenode.net]
xerxes has quit [lindbohm.freenode.net irc.freenode.net]
gildor has quit [lindbohm.freenode.net irc.freenode.net]
hto has quit [lindbohm.freenode.net irc.freenode.net]
authentic has quit [lindbohm.freenode.net irc.freenode.net]
Asmadeus has quit [lindbohm.freenode.net irc.freenode.net]
Mr_Awesome has quit [lindbohm.freenode.net irc.freenode.net]
patronus has quit [lindbohm.freenode.net irc.freenode.net]
maskd has quit [lindbohm.freenode.net irc.freenode.net]
ScrumMaster has quit [lindbohm.freenode.net irc.freenode.net]
kaustuv has quit [lindbohm.freenode.net irc.freenode.net]
gl has quit [lindbohm.freenode.net irc.freenode.net]
munga_ has quit [lindbohm.freenode.net irc.freenode.net]
brendan has quit [lindbohm.freenode.net irc.freenode.net]
aij has quit [lindbohm.freenode.net irc.freenode.net]
nimred has quit [lindbohm.freenode.net irc.freenode.net]
lanaer has quit [lindbohm.freenode.net irc.freenode.net]
javax has quit [lindbohm.freenode.net irc.freenode.net]
kaustuv_ has quit [lindbohm.freenode.net irc.freenode.net]
r0bby has quit [lindbohm.freenode.net irc.freenode.net]
alexyk has quit [lindbohm.freenode.net irc.freenode.net]
cloudhead has quit [lindbohm.freenode.net irc.freenode.net]
palomer has quit [lindbohm.freenode.net irc.freenode.net]
bebui has quit [lindbohm.freenode.net irc.freenode.net]
ozzloy has quit [lindbohm.freenode.net irc.freenode.net]
ulfdoz has quit [lindbohm.freenode.net irc.freenode.net]
m3ga has quit [lindbohm.freenode.net irc.freenode.net]
jonafan has quit [lindbohm.freenode.net irc.freenode.net]
smimou has quit [lindbohm.freenode.net irc.freenode.net]
sgnb has quit [lindbohm.freenode.net irc.freenode.net]
peddie has quit [lindbohm.freenode.net irc.freenode.net]
ertai has quit [lindbohm.freenode.net irc.freenode.net]
mbishop has quit [lindbohm.freenode.net irc.freenode.net]
Amorphous has quit [lindbohm.freenode.net irc.freenode.net]
mellum has quit [lindbohm.freenode.net irc.freenode.net]
Pepe_ has quit [lindbohm.freenode.net irc.freenode.net]
sgwizdak has quit [lindbohm.freenode.net irc.freenode.net]
mal`` has quit [lindbohm.freenode.net irc.freenode.net]
fremo has quit [lindbohm.freenode.net irc.freenode.net]
prigaux has quit [lindbohm.freenode.net irc.freenode.net]
mfp has quit [lindbohm.freenode.net irc.freenode.net]
sbok has quit [lindbohm.freenode.net irc.freenode.net]
bacam has quit [lindbohm.freenode.net irc.freenode.net]
Ori_B has quit [lindbohm.freenode.net irc.freenode.net]
jlouis has quit [lindbohm.freenode.net irc.freenode.net]
delroth has quit [lindbohm.freenode.net irc.freenode.net]
negacthulhu has quit [lindbohm.freenode.net irc.freenode.net]
mishok13 has quit [lindbohm.freenode.net irc.freenode.net]
mrvn has quit [lindbohm.freenode.net irc.freenode.net]
acatout has quit [lindbohm.freenode.net irc.freenode.net]
|jeremiah has quit [lindbohm.freenode.net irc.freenode.net]
pants3 has quit [lindbohm.freenode.net irc.freenode.net]
det has quit [lindbohm.freenode.net irc.freenode.net]
wli has quit [lindbohm.freenode.net irc.freenode.net]
TaXules has quit [lindbohm.freenode.net irc.freenode.net]
hcarty has quit [lindbohm.freenode.net irc.freenode.net]
seafood has quit [lindbohm.freenode.net irc.freenode.net]
ztfw has quit [lindbohm.freenode.net irc.freenode.net]
svenl_ has quit [lindbohm.freenode.net irc.freenode.net]
tarbo2 has quit [lindbohm.freenode.net irc.freenode.net]
holgr has quit [lindbohm.freenode.net irc.freenode.net]
ReinH has quit [lindbohm.freenode.net irc.freenode.net]
hkBst has quit [lindbohm.freenode.net irc.freenode.net]
willb has quit [lindbohm.freenode.net irc.freenode.net]
rumbleca has quit [lindbohm.freenode.net irc.freenode.net]
tomaw has quit [lindbohm.freenode.net irc.freenode.net]
petchema_ has quit [lindbohm.freenode.net irc.freenode.net]
flux has quit [lindbohm.freenode.net irc.freenode.net]
totom has quit [lindbohm.freenode.net irc.freenode.net]
ppsmimou has quit [lindbohm.freenode.net irc.freenode.net]
tsuyoshi has quit [lindbohm.freenode.net irc.freenode.net]
ski__ has quit [lindbohm.freenode.net irc.freenode.net]
clog has joined #ocaml
jli has joined #ocaml
ztfw has quit [Connection timed out]
ray has joined #ocaml
palomer has quit [Remote closed the connection]
sporkmonger has joined #ocaml
ulfdoz_ has joined #ocaml
seafood has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
vithos has joined #ocaml
cloudhea has joined #ocaml
seafood has quit []
ulfdoz_ has joined #ocaml
xerxes_ has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has quit [Client Quit]
AxleLonghorn has joined #ocaml
ulfdoz__ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz__ is now known as ulfdoz
xerxes has quit [Read error: 110 (Connection timed out)]
ulfdoz_ has quit [Read error: 110 (Connection timed out)]
jknick has joined #ocaml
jeff_s_ has joined #ocaml
kaustuv_ has quit ["07d7f4fd60d747431207d33555e04773"]
jeff_s_ has quit []
seafood has joined #ocaml
seafood has quit [Client Quit]
xerxes_ has quit ["Ex-Chat"]
Jedai has joined #ocaml
seafood has joined #ocaml
pants1 has joined #ocaml
Associat0r has joined #ocaml
Camarade_Tux has joined #ocaml
pants3 has quit [Read error: 113 (No route to host)]
seafood has quit []
<mrvn> jli: It depends. If your list is really circular then no. If you mark the endpoints by pointing them at themself then yes.
<flux> mrvn, but it doesn't help at all, because the list is doubly-linked
<flux> it keeps bouncing next/prev/next/prev/next/prev/.. even with just two non-circular nodes
<mrvn> right.
<flux> I suppose the printer could be better
<flux> by pointing out "visited already" or something
ikaros has joined #ocaml
komar_ has joined #ocaml
<mrvn> { prev = { prev = a; next = a; ... } as b; next = b; ... } as a ?
<flux> I just used type t = { mutable prev : t option; mutable next : t option } let t1 = { prev = None; next = None } let t2 = { prev = None; next = None } let _ = t1.next <- Some t2; t2.prev <- Some t1
<mrvn> I ment as output of the printer.
<flux> oh, right
<flux> yes, something like that could be
cloudhea has quit []
<kaustuv> it's easy to override the printer for any type
sporkmonger has quit []
ikaros has quit ["Leave the magic to Houdini"]
cloudhead has quit [Success]
m3ga has quit ["disappearing into the sunset"]
ulfdoz_ has joined #ocaml
ztfw` has quit [Remote closed the connection]
vithos has quit []
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
acatout has quit [Read error: 60 (Operation timed out)]
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
spez has joined #ocaml
alexyk has quit []
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
s4tan has joined #ocaml
angerman has joined #ocaml
rwmjones has joined #ocaml
<angerman> can someone assist me with this: http://gist.github.com/111550 ? I'm trying to write a map function.
<angerman> But somehow I cannot see what is wrong :(
<angerman> hmm ... am I stupid? maybe ...
<angerman> I found it.
_zack has joined #ocaml
<AxleLonghorn> did you still need help?
<angerman> AxleLonghorn: I guess I do :(
<AxleLonghorn> some style pointers maybe
<angerman> I can't call it :(
<AxleLonghorn> hmm?
<angerman> Printf.printf "%d\n" (map (fun x y -> x * y) [1;2;3;4;5] [1;2;3;4;5]);;
<angerman> that's how I try to call it
<AxleLonghorn> what's the error?
<angerman> This expression has type int list but is here used with type int
<angerman> for the (fun ...) part
<AxleLonghorn> well, the result of map is an int list
<gl> Printf.printf is asking for an int, while the result of map is a list
<AxleLonghorn> yeah
<angerman> ouch :(
<AxleLonghorn> it's probably just easier to copy and paste the function into the toplevel, since it has automatic printing of lists
<angerman> I'll try to fold it into a string
<AxleLonghorn> I prefer this:
<AxleLonghorn> let string_of_list f l = "[" ^ (String.concat "," (List.map f l)) ^ "]"
<AxleLonghorn> some style tips for you though: you don't have to parenthesize the values in the match statement
<AxleLonghorn> you also don't need the ';;
<AxleLonghorn> at the end of the function. Often the compiler can infer that via whitespace around your function
<angerman> AxleLonghorn: ohh, thanks :)
<angerman> what is the function to convert int -> string? (fun x -> Printf.sprintf "%d" x) would work I guess. but is there something simpler?
<AxleLonghorn> string_of_int
<AxleLonghorn> it's under the string conversions section of the Pervasives module
<angerman> hmm feels a bit strange. it's been 4 years since I last used ocaml...
<AxleLonghorn> I'm sure things have changed
rwmjones has quit ["Closed connection"]
<AxleLonghorn> though, I only started 2 years ago, so I may be wrong
<kaustuv> string_of_int is one of the oldest library functions that dates back to caml light 1.0 days
<AxleLonghorn> kaustuv, how long have you been here?
<kaustuv> On #ocaml, not very long. But I've been using it since 2001
<angerman> kaustuv: I didn't mean that string_of_int wasn't there ... just that I have forgotten nearly everything :)
spez has quit []
rwmjones has joined #ocaml
Yoric[DT] has joined #ocaml
<AxleLonghorn> well, good night all. have fun angerman
AxleLonghorn has left #ocaml []
<Yoric[DT]> hi
<kaustuv> salut
verte has joined #ocaml
Kerris7 has joined #ocaml
angerman has quit []
jeanbon has joined #ocaml
ulfdoz has quit ["deprecated"]
hkBst has joined #ocaml
ulfdoz has joined #ocaml
seafood has joined #ocaml
ulfdoz_ has joined #ocaml
pants2 has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
Yoric[DT] has quit ["Ex-Chat"]
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
seafood has quit []
pants1 has quit [Read error: 113 (No route to host)]
rjack has joined #ocaml
seafood has joined #ocaml
komar_ has joined #ocaml
<ulfdoz> (31 of 276)
<ulfdoz> ewin, sorry
pants1 has joined #ocaml
pants2 has quit [Read error: 60 (Operation timed out)]
spez has joined #ocaml
<kaustuv> Any HLVM experts here? What does jdh mean by this:
<kaustuv> > The "data representation strategy" I used in HLVM took five minutes to design and it runs circles around ocamlopt on x86 and x64.
jeanbon has quit ["EOF"]
<ulfdoz> kaustuv: He means it is orders of magnitudes faster.
<kaustuv> I understand English already, thanks. I want to know what data representation he used.
jamii has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
spez has quit [Success]
th5 has joined #ocaml
Alpounet has joined #ocaml
komar_ has quit [Read error: 60 (Operation timed out)]
zerny has joined #ocaml
zerny has quit [Client Quit]
zerny has joined #ocaml
komar_ has joined #ocaml
rjack has quit ["leaving"]
<mrvn> wieso **
<mrvn> ups
Snark has joined #ocaml
angerman has joined #ocaml
angerman has quit [Read error: 131 (Connection reset by peer)]
angerman_ has joined #ocaml
seafood has quit []
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
zerny has quit [Read error: 110 (Connection timed out)]
lutter has joined #ocaml
Camarade_Tux has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
rjack has joined #ocaml
TaXules has quit [anthony.freenode.net irc.freenode.net]
TaXules has joined #ocaml
lutter has quit [Read error: 104 (Connection reset by peer)]
lutter has joined #ocaml
lutter1 has joined #ocaml
lutter has quit [Read error: 54 (Connection reset by peer)]
ulfdoz_ has joined #ocaml
ikaros has joined #ocaml
alexyk has joined #ocaml
vpalle has joined #ocaml
ulfdoz has quit [Read error: 101 (Network is unreachable)]
ulfdoz_ is now known as ulfdoz
iago__ has joined #ocaml
<iago__> hello, am I confused or there is no function in ocaml libraries to copy a file without use Sys.command or similar?
<Alpounet> you're probably right
<iago__> ;/ it is too strange, you have Sys.rename, etc, but you have to deal with Sys.command for a simple copy
lutter has joined #ocaml
lutter1 has quit [Read error: 104 (Connection reset by peer)]
alexyk has quit []
sporkmonger has joined #ocaml
<tsuyoshi> well.. renaming a file is a simple system call, copying isn't
lutter has quit [Read error: 104 (Connection reset by peer)]
lutter has joined #ocaml
<kaustuv> iago__: copying a file is not a trivial matter. The files can have holes in them, or be recursively symlinked or whatever.
<kaustuv> Not to mention the issue of permissions...
<kaustuv> Best to use Sys.command "cp -a ..."
<rwmjones> iago__, and remember to quote the filenames, ie:
<rwmjones> Sys.command (Printf.sprintf "cp -a %s %s" (Filename.quote f1) (Filename.quote f2))
<flux> cp -a -- ?
<rwmjones> cp -a does a recursive copy and preserves timestamps
<flux> I meant -- is useful, unless Filename.quote also handles first character being a dash
<kaustuv> -a preserves all of mode, ownership and timestamps, when possible
<flux> I've used .. cp -a -- "$A" "$B" where A and B are environment variables I've set prior to the call. it should work around magic character issues, but pollutes the environment..
<iago__> rwmjones, uhm, thanks
<rwmjones> flux, good point
<mrvn> flux: so unset them after the cp
<mrvn> rwmjones: why not Sys.command (Printf.sprintf "cp -a -- '%s' '%s'"?
<rwmjones> mrvn, that won't work if the filenames contain ' chars
<rwmjones> or do you mean using Filename.quote as well?
<mrvn> s,','\'',g
<rwmjones> IIRC Filename.quote adds single quotes around the whole string
<mrvn> You still need some quoting but far less than without '' or ""
<kaustuv> Using library functions for such things is generally a better idea than rolling your own for whatever bogus reason
<mrvn> rwmjones: if the quoting works.
<mrvn> - rwmjones
<kaustuv> I think Printf.sprintf "cp -a -- %S %S" f1 f2 would also work, but I won't stake my reputation on it
<mrvn> Also why isn't there a Sys.cmd ["cp"; "-a"; "--"; f1; f2]?
<kaustuv> Unix.open_process_*
<mrvn> val open_process : string -> in_channel * out_channel
<mrvn> nope.
<mrvn> open_process_full : string -> string array -> in_channel * out_channel * in_channel
<mrvn> will do.
<mrvn> arg, no the string array is env, not args.
th5 has quit []
<kaustuv> Unix.execv
<kaustuv> also Unix.create_process
<mrvn> Unix.create_process if you don't want to manually fork
iago__ has quit ["Leaving"]
<mrvn> Still, a Sys.... variant with string arrays would be good.
Ched has joined #ocaml
<mrvn> Does Mac ocaml have a Unix module?
<kaustuv> fun proc args -> Sys.command (String.concat " " (proc :: args))
<kaustuv> And yes, it does.
<mrvn> kaustuv: The difference is in the need to quote things. If you concat the strings you ruin that.
<kaustuv> Given that Sys.command uses sh -c, I fail to see how to avoid quoting things
<mrvn> Unix.create_process needs no quoting of the filenames.
AxleLonghorn has joined #ocaml
lutter has quit [Read error: 104 (Connection reset by peer)]
lutter has joined #ocaml
Kerris7_ has joined #ocaml
alexyk has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
vpalle has joined #ocaml
|jeremiah has quit [Read error: 104 (Connection reset by peer)]
Ched has quit [Read error: 104 (Connection reset by peer)]
Ched has joined #ocaml
Kerris7 has quit [Read error: 110 (Connection timed out)]
|jeremiah has joined #ocaml
lutter has quit [Read error: 110 (Connection timed out)]
cloudhead has joined #ocaml
|jeremiah has quit [Read error: 104 (Connection reset by peer)]
Ched has quit [Remote closed the connection]
lutter has joined #ocaml
|jeremiah has joined #ocaml
TaXules has quit [anthony.freenode.net irc.freenode.net]
TaXules has joined #ocaml
s4tan has quit []
alexyk has quit []
ScrumMaster has quit ["En Garde !"]
vithos has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
Ched has joined #ocaml
_zack has quit ["Leaving."]
lutter has quit [Read error: 110 (Connection timed out)]
<AxleLonghorn> say I were implementing a small expression language
<AxleLonghorn> type expr = Integer | Boolean | Var of string | Fun expr * expr
<AxleLonghorn> now, imagine that I want to add on tuples
mbac has joined #ocaml
<AxleLonghorn> what would be the best way of implementing a tuple?
<AxleLonghorn> Tuple of expr * expr?
<mbac> my efforts to find an ocaml irc library are being thwarted by google search results that think i'm asking about ocaml irc channels
<AxleLonghorn> or Tuple of expr list ?
<mbac> so now i direct this query to YOU
<mbac> "ocaml irc library"?
<Camarade_Tux> one in mlbot and one in lablgtk's examples
<mbac> i can has mlbot source?
jeanbon has joined #ocaml
<mbac> "camlirc" is what i wanted to ask google, apparantly
<Camarade_Tux> I have to say I'm not sure how to get mlbot's source
<Camarade_Tux> camlirc is the name of the client in lablgtk's examples iirc
<AxleLonghorn> http://blog.mestan.fr/
<mbac> haha camlirc is in our main repo
<mbac> sweet
<mbac> that was convenient
<AxleLonghorn> so, anyone have any thoughts on which would be a better way of doing tuples?
<AxleLonghorn> lists or cons-esque data type
<mbac> oh my god it uses the object system
<rwmjones> AxleLonghorn, it depends how you want to use it & how you want to parse the input ... it's not something we can really answer
<AxleLonghorn> well, I was just wondering if anyone knew of any consequences I wasn't thinking of
<mbac> well, looks like i'm writing my own irc library again
<mbac> thanks
mbac has quit ["lulz"]
<AxleLonghorn> the expr * expr way is ugly in that the nesting could become hideous
alexyk has joined #ocaml
<AxleLonghorn> how about this for a contraint: there's no pattern matching in the language
ikaros has quit ["Leave the magic to Houdini"]
lutter has joined #ocaml
itewsh has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
alexyk has quit []
ulfdoz_ has joined #ocaml
komar_ has joined #ocaml
alexyk has joined #ocaml
Alpounet has quit [Read error: 60 (Operation timed out)]
Alpounet has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
Snark has quit ["Ex-Chat"]
Ched has quit [Read error: 54 (Connection reset by peer)]
AxleLonghorn has left #ocaml []
<Camarade_Tux> I find qt quite annoying to work with actually, I think I prefer gtk but I don't know if I prefer gtk or lablgtk actually
<jonafan> you mean gtk from c?
monadic_kid has joined #ocaml
iago has joined #ocaml
<Camarade_Tux> I don't have much experience with GTK in C as I've mainly used lablgtk (and edited others' code), so I am not sure why I prefer gtk : is it because of lablgtk which is a nice interface or is because gtk seems saner to me
zerny has joined #ocaml
<iago> what one should do in ocaml when you want something like http://moonpatio.org/fastcgi/hpaste.fcgi/view?id=2424 ?
<flux> you should use anonymous functions instead: doWhen (..) (fun () -> Sys.remove ..)
<iago> well, was the another option
<flux> or, if you do that a lot, you may want to take a look at monads
<iago> some external library?
<flux> monads is a concept, not a specific library
<flux> but if your code is built according to the monadic principles, you can use pa_monad to lighten the syntactic load
<iago> I know what monads are, but there are libraries to implement them
<iago> mtl for example in Haskell :?
<flux> what I'm thinking here is continuation passing style monad
<monadic_kid> mtl is the monad transfomer library, thats more to do with combining monads
<iago> monadic_kid, well, ok, anyway, monads in Haskell are defined in libraries
<flux> iago, in any case, using anonymous functions is likely slightly faster than lazy values
<flux> also using lazy values seems like abuse here, because you aren't really storing values but actions :)
<iago> yep, I ask because I see it a bit ugly
<iago> :P
<flux> there are also syntax extensions that make the syntactic load of defining a lot of functions lighter, but I'm not sure if they apply to unit functions
<flux> pa_hole (or pa_holes?) might be useful
<iago> well, perhaps anonymous fun's will be the better option, I only use this in some places
<flux> there's one trick that might be suitable or not:
<flux> instead of let do_somethin f = f ()
<flux> you have: let do_something f a = f a
<flux> so instead of do_something (fun () -> print_endline "hello world")
<flux> you can write do_something print_endline "hello world";;
<flux> of course, the trick can make functions with more arguments look worse
<flux> because then it's like: do_something (Printf.printf "%s %s" "hello") "world"
<iago> yep
<iago> I follow some near to this
<iago> before write this version
monadic_kid has quit ["Leaving"]
itewsh has quit [Read error: 110 (Connection timed out)]
nwardez has joined #ocaml
itewsh has joined #ocaml
nwardez has quit [Client Quit]
nwardez has joined #ocaml
monadic_kid has joined #ocaml
nwardez has quit [Client Quit]
Yoric[DT] has joined #ocaml
rjack has quit ["leaving"]
nwardez has joined #ocaml
<jli> if I have a sum type with Construct Cons of complicated_record, and I pattern match with "Cons record", "record" is no longer a Cons. so do I just say "Cons record" to make a new Cons, or is it idiomatic to change the match to "| Cons record as cons", or something?
nwardez has quit [Remote closed the connection]
nwardez has joined #ocaml
<Yoric[DT]> hi
nwardez has quit ["nwardez has no reason"]
ikaros has joined #ocaml
nwardez has joined #ocaml
nwardez has quit [Remote closed the connection]
<hcarty> Yoric[DT]: Hello
<jli> 444444444444444444444444444444444444444444444444444444444444444444444444444455555555555555555555555555555555558965
<hcarty> jli: "| Cons record as cons" would save a bit of time computationally. It may be a bit more idiomatic as well.
<jli> doh, sorry about that
<jli> hcarty: okay, thank you
<hcarty> jli: You are quite welcome
Ariens_Hyperion has joined #ocaml
nwardez has joined #ocaml
nwardez has quit [Client Quit]
Mr_Awesome has joined #ocaml
tomaw has quit ["Quit"]
lutter has quit ["Leaving."]
tomaw has joined #ocaml
Ched has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
ikaros_ has joined #ocaml
nwardez has joined #ocaml
komar__ has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
<jli> can someone explain this type error to me? http://moonpatio.org/fastcgi/hpaste.fcgi/view?id=2426#a2426
AxleLonghorn has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
itewsh has quit [Remote closed the connection]
Ched has quit [Read error: 60 (Operation timed out)]
<Ariens_Hyperion> jli:
<Ariens_Hyperion> those refs are for lists or for other nodes?
<hcarty> jli: Are you getting this in the toplevel?
Ched has joined #ocaml
<hcarty> jli: In a fresh toplevel, this type checks for me: http://moonpatio.org/fastcgi/hpaste.fcgi/view?id=2426#a2427
<hcarty> jli: If you redefine types with the same name in the toplevel this sort of strange error can happen
<Ariens_Hyperion> I can't even get it to worl in the topo lever since list is defined after node
<hcarty> Ariens_Hyperion: Change the second "type" to "and"
<hcarty> It looks like the original paste made it as far as it did due to a previous definition of "type 'a dbl_list"
<Ariens_Hyperion> works in 3.11
jeanbon has quit ["EOF"]
jeanbon has joined #ocaml
jeanbon has quit [Client Quit]
Ched has quit [Read error: 104 (Connection reset by peer)]
Ched has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
palomer has joined #ocaml
<palomer> hrmph
<palomer> type-conv doesn't seem to be object friendly
sanguinev has joined #ocaml
slash_ has joined #ocaml
sanguine1 has quit [No route to host]
<hcarty> palomer: Jane St. does not apparently use the OCaml object system, so that seems like a reasonable possibility
<hcarty> palomer: Do you know if any of the downstream extensions/libraries (Sexplib, Binprot) are object friendly?
sbok has quit [anthony.freenode.net irc.freenode.net]
prigaux has quit [anthony.freenode.net irc.freenode.net]
mfp has quit [anthony.freenode.net irc.freenode.net]
mfp has joined #ocaml
sbok has joined #ocaml
prigaux has joined #ocaml
sanguine1 has joined #ocaml
zerny has quit [Remote closed the connection]
kushou has joined #ocaml
<kushou> hi
sanguinev has quit [Read error: 110 (Connection timed out)]
AxleLonghorn1 has joined #ocaml
AxleLonghorn has quit [Read error: 104 (Connection reset by peer)]
alexyk_ has joined #ocaml
<kushou> I tried to creat two "type foo = {bar1: int; bar2}" (i don't know the english name), with both the same first input name
Ched has quit [Read error: 104 (Connection reset by peer)]
<kushou> (sorry for my bad english)
<Ariens_Hyperion> kushou: give a name to the type
<kushou> that is what i've done, isn't it ?
Camarade_Tux has quit [Read error: 113 (No route to host)]
Ched has joined #ocaml
<Alpounet> hcarty, AFAIK, such libraries do not use objects, since that's not OCaml's main "view of programming"
angerman_ has quit []
<AxleLonghorn1> kushou
<AxleLonghorn1> you can't have records with the same labels
<AxleLonghorn1> they are not objects
<kushou> ok
<AxleLonghorn1> what you are seeing is the fact that you keep redefining types with the same label, so each time you try to refer to the record with the same label, it sees a different type each time
Ariens_Hyperion has left #ocaml []
<AxleLonghorn1> this is partly because ocaml reads definitions from top to bottom, and if you overwrite a definition, you will use the last one defined
<AxleLonghorn1> this happens with function definitions as well
<AxleLonghorn1> let foo x y = 1;; val foo : 'a -> 'b -> int = <fun>
<kushou> ok, but when record tri1 = {x1; x2; x3} and tri2 = {x1; x2}, i don't understand why tri1 overwrite tri2
<AxleLonghorn1> let foo x y z = 1;; val foo : 'a -> 'b -> 'c -> int = <fun>
<AxleLonghorn1> foo;; 'a -> 'b -> 'c -> int = <fun>
<AxleLonghorn1> because it was the last one defined, from top to bottom
<kushou> hum ok
<kushou> so i can't define two records in the same time ?
<AxleLonghorn1> you can, just not with the same label
<AxleLonghorn1> s/label/labels
<kushou> ok, hum i need to try something
<AxleLonghorn1> type tri1 = {x : int; y : int; z : int};; type tri2 = {x1 : int; y : int} will work
<AxleLonghorn1> the problem is that OCaml can't infer the record type involved if multiple records use the same label
alexyk has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
jeddhaberstro has joined #ocaml
<kushou> ok so why b can't be tri1 ?
<AxleLonghorn1> again, like I said, you can't use the same label in different types
<kushou> oh i haven't seen the "x1"
<AxleLonghorn1> when OCaml sees a record label of x, it looks for the last type that defined that label, which was tri2
<kushou> ;; type tri2 = {x1
<kushou> ok ok, i've understood
<kushou> thanks
<AxleLonghorn1> I find records to be slightly annoying because of the label issue
<AxleLonghorn1> in order to access the value under a label from outside the module the record was defined in, you have to open the module it was defined in
<AxleLonghorn1> which is annoying if you don't want to pollute the function namespace
<kushou> ok, i don't know what is the modules yet
<kushou> i need to go to bed, good night all
<kushou> and thank you
<jli> AxleLonghorn1: you mean record.label access?
kushou has quit ["Konversation terminated!"]
<AxleLonghorn1> yes
komar__ has quit [Remote closed the connection]
m3ga has joined #ocaml
Alpounet has quit ["Ex-Chat"]
<jli> AxleLonghorn1: hm, that's really annoying.
FFighter has joined #ocaml
<FFighter> hello!
<FFighter> what is the best book to start learning OCaml ?
<jli> FFighter: I've been learning with Oreilly's free book
<FFighter> jli, hmm cool
<FFighter> where can I find it?
<brendan> there's also the hickey book, if you don't mind it being cursed
<m3ga> brendan: the hickey book isn't cursed, just the ripoff of it :-)
<jli> cursed?
sovesky_ has joined #ocaml
sovesky_ has left #ocaml []
<jli> oh, I tried using that book. I don't think it's organized very well
<m3ga> jason hickey wrote a book and released it on the net, someone else published large chunks of it as their own work
<jli> weird
<jli> published? was it printed?
jamii has quit [Connection timed out]
<jli> hcarty: ah, thanks. it works now.
<jli> has anyone read OCaml for Scientists?
<m3ga> i would buy it but the author has annoyed me way too many times on usenet/mailing lists/reddit etc
<jli> heh, really? weird. isn't he a Dr.?
<m3ga> in physics. he has no compsci or engineering education
<jli> still :)
ikaros_ has quit ["Leave the magic to Houdini"]
iago has quit ["Leaving"]
FFighter has quit ["Leaving"]
<m3ga> well, i've worked with a couple of compsci phds who couldn't code their way out of a wet paper bag
alexyk_ has quit []
jeanbon has joined #ocaml
AxleLonghorn1 has left #ocaml []
slash_ has quit [Client Quit]
jeanbon has quit [Read error: 113 (No route to host)]
<hcarty> jli: Regarding accessing records defined in a module - if the record type is defined in module Foo, you can do x.Foo.label if you want to avoid using "open Foo"
<hcarty> jli: And OCaml for Scientists has received a lot of very positive reviews, but Mr. Harrop has... a reputation as m3ga pointed out :-) And it is a rather expensive book.
<m3ga> i also find his code (the stuff on his website for free) rather quirky and not really what I consider good idiomatic ocaml code.
<palomer> hcarty, ill check if sexplib is object friendly in a sec
<palomer> but looking at the code, there doesn't seem to be any code for objects