rwmjones changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.1 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
LordMetroid has quit [Connection timed out]
lordmetroid_ is now known as LordMetroid
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
lordmetroid_ has joined #ocaml
goalieca has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
psnively has quit []
LordMetroid has quit [Read error: 110 (Connection timed out)]
hkBst has quit ["Konversation terminated!"]
lordmetroid_ has quit [Client Quit]
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
middayc has joined #ocaml
mwc_ has left #ocaml []
bluestorm has quit ["Konversation terminated!"]
<orbitz> do i have to open amodule in order to get access to anyr ecords i put in its interface?
ita has quit [Remote closed the connection]
<Smerdyakov> No. You never have to open a module to do anything in OCaml.
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has joined #ocaml
authentic has quit [Read error: 104 (Connection reset by peer)]
ben__ has joined #ocaml
ben__ is now known as ziph
mwc_ has joined #ocaml
authentic has joined #ocaml
mwc_ has left #ocaml []
jlouis has joined #ocaml
bzzbzz has quit ["leaving"]
jlouis_ has quit [Read error: 110 (Connection timed out)]
jlouis_ has joined #ocaml
<orbitz> except for the first chaaracter, is case important in the name of a module?
<hcarty> orbitz: Not really, except in mapping to a filename
<orbitz> so if i want to do camel case it would be
<orbitz> myFile
<orbitz> for a module naemd MyFile
<hcarty> Yes
<orbitz> ok thanks
AxleLonghorn has quit [Read error: 110 (Connection timed out)]
jlouis has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
middayc has quit []
AxleLonghorn has joined #ocaml
onigiri has quit []
seafood_ has quit []
Robdor has joined #ocaml
jlouis_ has quit [kornbluth.freenode.net irc.freenode.net]
huh has quit [kornbluth.freenode.net irc.freenode.net]
ertai has quit [kornbluth.freenode.net irc.freenode.net]
dobblego has quit [kornbluth.freenode.net irc.freenode.net]
|Catch22| has quit [kornbluth.freenode.net irc.freenode.net]
__suri has quit [kornbluth.freenode.net irc.freenode.net]
thelema has quit [kornbluth.freenode.net irc.freenode.net]
netx has quit [kornbluth.freenode.net irc.freenode.net]
morner has quit [kornbluth.freenode.net irc.freenode.net]
goalieca has quit [kornbluth.freenode.net irc.freenode.net]
rwmjones has quit [kornbluth.freenode.net irc.freenode.net]
svenl has quit [kornbluth.freenode.net irc.freenode.net]
ikatz has quit [kornbluth.freenode.net irc.freenode.net]
jdavis_ has quit [kornbluth.freenode.net irc.freenode.net]
unfo- has quit [kornbluth.freenode.net irc.freenode.net]
TaXules has quit [kornbluth.freenode.net irc.freenode.net]
jeremiah has quit [kornbluth.freenode.net irc.freenode.net]
orbitz has quit [kornbluth.freenode.net irc.freenode.net]
mattam has quit [kornbluth.freenode.net irc.freenode.net]
AxleLonghorn has quit [kornbluth.freenode.net irc.freenode.net]
Mr_Awesome has quit [kornbluth.freenode.net irc.freenode.net]
Demitar has quit [kornbluth.freenode.net irc.freenode.net]
Oatschool has quit [kornbluth.freenode.net irc.freenode.net]
Robdor has quit [kornbluth.freenode.net irc.freenode.net]
thermoplyae has quit [kornbluth.freenode.net irc.freenode.net]
pattern has quit [kornbluth.freenode.net irc.freenode.net]
mwc has quit [kornbluth.freenode.net irc.freenode.net]
Smerdyakov has quit [kornbluth.freenode.net irc.freenode.net]
mbishop has quit [kornbluth.freenode.net irc.freenode.net]
mfp has quit [kornbluth.freenode.net irc.freenode.net]
cmeme has quit [kornbluth.freenode.net irc.freenode.net]
authentic has quit [kornbluth.freenode.net irc.freenode.net]
Morphous has quit [kornbluth.freenode.net irc.freenode.net]
letrec has quit [kornbluth.freenode.net irc.freenode.net]
kig has quit [kornbluth.freenode.net irc.freenode.net]
guyzmo has quit [kornbluth.freenode.net irc.freenode.net]
ozzloy has quit [kornbluth.freenode.net irc.freenode.net]
ahf has quit [kornbluth.freenode.net irc.freenode.net]
ppsmimou has quit [kornbluth.freenode.net irc.freenode.net]
jonathanv has quit [kornbluth.freenode.net irc.freenode.net]
mrsolo has quit [kornbluth.freenode.net irc.freenode.net]
smimou has quit [kornbluth.freenode.net irc.freenode.net]
Dazhbog has quit [kornbluth.freenode.net irc.freenode.net]
gim has quit [kornbluth.freenode.net irc.freenode.net]
bla has quit [kornbluth.freenode.net irc.freenode.net]
gaja has quit [kornbluth.freenode.net irc.freenode.net]
acatout has quit [kornbluth.freenode.net irc.freenode.net]
bebui has quit [kornbluth.freenode.net irc.freenode.net]
zmdkrbou has quit [kornbluth.freenode.net irc.freenode.net]
seafood_ has joined #ocaml
Robdor has joined #ocaml
AxleLonghorn has joined #ocaml
jlouis_ has joined #ocaml
authentic has joined #ocaml
goalieca has joined #ocaml
thermoplyae has joined #ocaml
orbitz has joined #ocaml
|Catch22| has joined #ocaml
pattern has joined #ocaml
Morphous has joined #ocaml
ppsmimou has joined #ocaml
mwc has joined #ocaml
morner has joined #ocaml
Mr_Awesome has joined #ocaml
thelema has joined #ocaml
Smerdyakov has joined #ocaml
letrec has joined #ocaml
Demitar has joined #ocaml
gaja has joined #ocaml
rwmjones has joined #ocaml
jonathanv has joined #ocaml
mrsolo has joined #ocaml
svenl has joined #ocaml
huh has joined #ocaml
ertai has joined #ocaml
dobblego has joined #ocaml
smimou has joined #ocaml
netx has joined #ocaml
acatout has joined #ocaml
__suri has joined #ocaml
Dazhbog has joined #ocaml
kig has joined #ocaml
gim has joined #ocaml
zmdkrbou has joined #ocaml
bebui has joined #ocaml
guyzmo has joined #ocaml
cmeme has joined #ocaml
Oatschool has joined #ocaml
mfp has joined #ocaml
ahf has joined #ocaml
mattam has joined #ocaml
TaXules has joined #ocaml
ikatz has joined #ocaml
jeremiah has joined #ocaml
jdavis_ has joined #ocaml
unfo- has joined #ocaml
bla has joined #ocaml
mbishop has joined #ocaml
ozzloy has joined #ocaml
mwc has quit [Remote closed the connection]
julm has joined #ocaml
julm has quit [Remote closed the connection]
julm has joined #ocaml
TheLittlePrince has joined #ocaml
<Optikal__> the little prince can catch a shooting star and fly away
authentic has quit [No route to host]
julm has quit ["bye \o_"]
julm has joined #ocaml
seafood_ has quit []
julm has quit ["bye \o_"]
julm has joined #ocaml
<ziph> Anyone have any hints on doing "functional style" string manipulation in ocaml? Like having a takewhile on a string without having to home brew a strings library? :)
<Optikal__> Does ocaml have a String.explode function?
<ziph> Doesn't seem to. Is that an F#/other ML thing? Does it do string -> char list?
<Optikal__> yeah
<Optikal__> StandardML has String.explode
<thelema> Optikal__: once you define fold_right on strings (and have a cons function), explode s = fold_right cons s []
<ziph> Does that mean every significant ocaml library has its own mini string library? ;)
<flux> ziph, unfortunately, yes :)
<flux> or they could use ExtLib
<flux> it has all the stuff in String plus: http://ocaml-lib.sourceforge.net/doc/ExtString.String.html
<ziph> Ah, that looks good.
<ziph> Thanks muchly.
<flux> btw, a lazy guy's explode: let explode s = Array.to_list (Array.init (String.length s) (fun i -> s.[i]))
<flux> (not my idea, someone showed it in the channel :))
<flux> (List.init would be nice at times, it would be waaay less hacky; ExtLib has that too)
<ziph> Mmm, that's nice too. I should spend some more time digging through the libraries.
<flux> but, off to make breakfast, happy hacking
TheLittlePrinceO has joined #ocaml
|Catch22| has quit []
TheLittlePrinceO has quit [Client Quit]
TheLittlePrince has quit [Client Quit]
TheLittlePrince has joined #ocaml
evn has joined #ocaml
pango has joined #ocaml
olleolleolle has joined #ocaml
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
ziph has quit []
ben___ has joined #ocaml
ben___ is now known as zipb
zipb is now known as ziph
pattern has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
pattern has joined #ocaml
thermoplyae has quit ["daddy's in space"]
l_a_m has joined #ocaml
pattern has quit [Remote closed the connection]
pattern has joined #ocaml
AxleLonghorn has left #ocaml []
seafood_ has joined #ocaml
onigiri has joined #ocaml
Robdor has quit [Remote closed the connection]
Linktim has joined #ocaml
seafood_ has quit []
seafood_ has joined #ocaml
onigiri has quit []
seafood_ has quit [Client Quit]
seafood_ has joined #ocaml
pattern has quit [Remote closed the connection]
l_a_m has quit ["leaving"]
l_a_m has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
_dml has joined #ocaml
_dml is now known as dumb_questions
goalieca has quit [Remote closed the connection]
pattern has joined #ocaml
pattern has quit [Remote closed the connection]
pattern has joined #ocaml
pattern has quit [Remote closed the connection]
pattern has joined #ocaml
pattern has quit [Remote closed the connection]
pattern has joined #ocaml
marmottine has joined #ocaml
LordMetroid has joined #ocaml
bongy has joined #ocaml
Linktim has quit [Remote closed the connection]
asmanur has joined #ocaml
OChameau has joined #ocaml
authentic has joined #ocaml
Yoric[DT] has joined #ocaml
olleolleolle has left #ocaml []
hkBst has joined #ocaml
^authentic has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
madroac1 has joined #ocaml
madroac1 is now known as madroach
madroach has quit [Client Quit]
|Catch22| has joined #ocaml
evn_ has joined #ocaml
asmanur has quit [Read error: 110 (Connection timed out)]
evn has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
linktim_ has joined #ocaml
linktim__ has joined #ocaml
<dumb_questions> settle down, people!
<ziph> We demand an audience with the Queen.
Linktim has quit [Read error: 110 (Connection timed out)]
asmanur has joined #ocaml
ziph has quit []
ziph has joined #ocaml
evn_ has quit [Read error: 110 (Connection timed out)]
linktim_ has quit [Read error: 110 (Connection timed out)]
<dumb_questions> uh, got a dumb question
<dumb_questions> using UnixLabels
<dumb_questions> let t = time();;
<dumb_questions> localtime t;; (* works
<dumb_questions> but localtime time();; (* the unit is being absorbes by localtime as an argument
<dumb_questions> is there an idiom i need to learn ?
<dumb_questions> or is this not the n00b channel ?
<ziph> They answer my n00b questions. ;)
<julm> dumb_questions: try this: localtime (time ())
<dumb_questions> ah thanks
<dumb_questions> hmm
<dumb_questions> i thought that would mean localtime is being passed a single element tuple
<dumb_questions> still dont understand parens
<dumb_questions> ah i suppose it's only a tuple if it has 2+ elements
<dumb_questions> since the signature of (1) is just vanilla int
<dumb_questions> thanks
<dumb_questions> still very much groping around in the dark
<Yoric[DT]> There's one thing you need to understand about parens: except for a few special circumstances, they're used only as a mean of prioritizing operations.
<Yoric[DT]> In mathematics, with common notations, they're used like this except for functions.
<Yoric[DT]> In OCaml, they're used like this including for functions.
* Yoric[DT] realizes his English is not very clear today.
* Yoric[DT] is very much lacking sleep.
<ziph> What are the special cases?
<Yoric[DT]> Right now, I'm thinking of functors, but there are others.
<Yoric[DT]> Prefix operators / functions, for instance.
<Yoric[DT]> ( * ) ;;
<Yoric[DT]> erf, Xavierbot is sleeping.
<Yoric[DT]> Mmmhhhh....
<ziph> Ah, haven't played with them yet. Is printf one? :)
<Yoric[DT]> Nope.
<ziph> (A functor)
<Yoric[DT]> Hashtbl.Make is one.
xavierbot has joined #ocaml
<Yoric[DT]> It takes a module as argument and produces a module as result.
<rwmjones> ( * );;
<xavierbot> - : int -> int -> int = <fun>
<Yoric[DT]> Yeah :)
<ziph> I thought I saw printf infering types from a format string at one stage. Was I dreaming?
<Yoric[DT]> print_endline "Thanks, rwmjones";;
<xavierbot> Thanks, rwmjones
<xavierbot> - : unit = ()
<rwmjones> np
<Yoric[DT]> ziph: yep, it's called a hack :)
<flux> ziph, you weren't, but it's compiler magic
<ziph> Ah. :)
<flux> Printf.printf;;
<xavierbot> - : ('a, out_channel, unit) format -> 'a = <fun>
<Yoric[DT]> In practice, format strings are not strings.
<Yoric[DT]> They just look like strings.
<Yoric[DT]> Unrelated question: does anyone know if there's a way to install cairo bindings from godi ?
<flux> godi for 3.10 doesn't appear to have them
<ziph> ();;
<xavierbot> - : unit = ()
<flux> shouldn't be a big deal installing them manually?
<Yoric[DT]> Yeah, but there's the aforementioned lack of sleep problem :)
<Yoric[DT]> Actually, I'm not completely sure.
<Yoric[DT]> There doesn't seem to be a way of downloading these bindings without downloading the whole of cairo.
<Yoric[DT]> And I'd rather not have binary incompatibilities between the system-installed version and the local version.
<flux> really? that's weird
<Yoric[DT]> That and the fact that I may need to install cairo on the students-usable machines, so the more automated the better.
<Yoric[DT]> Mmhhhh...
<Yoric[DT]> I guess I could checkout just a directory.
zenhacker_rouan has joined #ocaml
<Yoric[DT]> Or I could use ocamlsdl instead.
<Yoric[DT]> It's just for a Game of Life, after all.
TheLittlePrince has quit [Client Quit]
zenhacker_rouan has left #ocaml []
coucou747 has joined #ocaml
<coucou747> salut all
<Yoric[DT]> coucou
<julm> 'lut
<dumb_questions> wtf does this mean? # let a () = "blah";1;;
<dumb_questions> Warning S: this expression should have type unit.
<xavierbot> Characters 1-4:
<xavierbot> wtf does this mean? # let a () = "blah";1;;
<xavierbot> ^^^
<xavierbot> Unbound value wtf
<dumb_questions> # 1;;
<dumb_questions> the dumb questions multiply ...
<dumb_questions> it thinks "blah" should be of "type unit" ... why ?
<dumb_questions> Yoric[DT]: thanks for the tips. I'm fine with ()'s now i think
<dumb_questions> system "ls /tmp";;
<xavierbot> Unknown directive `system'.
<dumb_questions> load Unix;;
<xavierbot> Characters 1-5:
<xavierbot> load Unix;;
<xavierbot> ^^^^
<xavierbot> Unbound value load
<dumb_questions> heheh
<dumb_questions> open Unix;;
<dumb_questions> system "echo wee";;
<xavierbot> Characters 1-7:
<xavierbot> system "echo wee";;
<xavierbot> ^^^^^^
<xavierbot> Unbound value system
<julm> dumb_questions: because expr before ';' should be of type unit
<Yoric[DT]> dumb_questions: xavierbot rejects Unix, for security reasons.
<dumb_questions> Yoric[DT]: of course it does. But when you see a lever ... ;)
<Yoric[DT]> :)
<Yoric[DT]> Now, as julm wrote.
<Yoric[DT]> let a () = "blah"; 1 ::
<Yoric[DT]> You're composing two values: "blah" and "1".
<Yoric[DT]> You're composing two values: "blah" and 1.
<Yoric[DT]> In OCaml, the semi-colon is actually an operator.
<Yoric[DT]> It composes a value with type unit and a value with type 'a and produces a value with type 'a.
<Yoric[DT]> It's equivalent to
<Yoric[DT]> let (_ : unit) = "blah" in 1.
<dumb_questions> ahh, its the list - join - operator
<Yoric[DT]> (well, nearly equivalent, because it causes a warning rather than a type error)
<dumb_questions> ah. i thought ; was to separate any expressions which did not form the last ( return ) value of a block ( ;; )
<dumb_questions> ie c-style eol
<Yoric[DT]> Nope :)
<dumb_questions> of course ..
<Yoric[DT]> It's close but not completely equivalent.
<dumb_questions> so .. naked endlines inside a block ?
<Yoric[DT]> Well, gottarun.
<dumb_questions> sure, i'll google. ta
<ziph> Is there an Ocaml grammar with precedence and a bit of detail on semantics anywhere?
<dumb_questions> by grammar do you mean something to do with lexx / etc
<dumb_questions> or like a cheat sheet :) ?
<ziph> Yes and no. A cheat sheet in a format that could be converted to yacc fairly easily. ;)
<dumb_questions> sorry, i'm the wrong noob to be asking ;)
<ziph> Actually I just found the right chapter. I kept running in to the summary grammar in Google.
<dumb_questions> hmm i'm still confused about the role of ; within a function definition
<dumb_questions> surely its not the list composition operator in that context ??
<ziph> [ expr ; expr ] is a production on its own.
<ziph> So in []'s it wouldn't be an operator.
<ziph> Ever used the comma operator in C?
<dumb_questions> not enough to feel intimate with the semantics
<dumb_questions> i've always tried to avoid c
<ziph> :)
<dumb_questions> it makes me feel like i'm typing out the shorter oxford english dictionary on an old typewriter
<ziph> It takes two expressions and returns the value of one, ignoring the value of the other.
<ziph> Obviously you need a side effect on the ignored one for it to be useful.
<dumb_questions> [1;] => [1]
<dumb_questions> right
<ziph> [(1;2)];;
<xavierbot> Characters 3-4:
<xavierbot> Warning S: this expression should have type unit.
<xavierbot> [(1;2)];;
<xavierbot> ^
<xavierbot> - : int list = [2]
<ziph> In parens the ; is the operator.
<dumb_questions> there youre using the l inside a tuple which aint legal ..
<dumb_questions> s/ l / ; /
<ziph> The Ocaml ; takes its left hand side and its right hand side and returns the right hand side.
<ziph> So 4 ; 3 ignores 4 and returns 3.
<dumb_questions> oh
<ziph> Except if the left hand side isn't a unit, it gives a warning.
<dumb_questions> so it does kind of make sense within function definitions ..
<ziph> So if you really want to do 4 ; 3
<ziph> You'd do:
<dumb_questions> in that only the last item is returned, but all are evaluated
<ziph> (ignore 4) ; 3;;
<xavierbot> - : int = 3
<ziph> Yeap.
<dumb_questions> and like c, you only do it if you're after side effects
<ziph> And being a binary operator it is actually being parsed like this:
<dumb_questions> so functions which are called for their side effects should return unit: ()
<dumb_questions> which makes sense too
<ziph> 1;2;3 is parsed as ((1;2);3)
<ziph> Yeah.
<dumb_questions> the empty list is traditionally nil in functional languages ;)
<dumb_questions> its like void
<ziph> By the way, tuples have nothing to do with parens as fair as I can tell.
<ziph> 3,4;;
<xavierbot> - : int * int = (3, 4)
<ziph> (((4,3,2)));;
<dumb_questions> hmm .. cool .. i think a few lights went dimly on
<xavierbot> - : int * int * int = (4, 3, 2)
<dumb_questions> quote: By the way, tuples have nothing to do with parens as fair as I can tell
<dumb_questions> ^^ yeah, it took me quite a while to realize ;)
<dumb_questions> its pure convention
<dumb_questions> thats why i didn't understand what parens were doing - i expected they were involved with tuples somehow
<coucou747> ((4,3),2)
<coucou747> ((4,3),2);;
<xavierbot> - : (int * int) * int = ((4, 3), 2)
<dumb_questions> 4,3,(1,2);;
<xavierbot> - : int * int * (int * int) = (4, 3, (1, 2))
<dumb_questions> idigit
<dumb_questions> so .. how do i give this function a return value of unit, without using a semicolon and triggering the warning?
<dumb_questions> let testsys = system "ls";;
<xavierbot> Characters 15-21:
<xavierbot> let testsys = system "ls";;
<xavierbot> ^^^^^^
<xavierbot> Unbound value system
<dumb_questions> ( assuming the Unix lib is loaded; it returns the exitcode of the process )
<ziph> let a () = 3; ();;
<xavierbot> Characters 12-13:
<xavierbot> Warning S: this expression should have type unit.
<xavierbot> let a () = 3; ();;
<xavierbot> ^
<xavierbot> val a : unit -> unit = <fun>
<ziph> What's the function again?
* dumb_questions nods
seafood_ has quit []
<dumb_questions> let testsys = system "ls";;
<xavierbot> Characters 15-21:
<xavierbot> let testsys = system "ls";;
<xavierbot> ^^^^^^
<xavierbot> Unbound value system
zmdkrbou_ has joined #ocaml
<dumb_questions> say i want this to return ()
<dumb_questions> so i can use it in main () which is a string of () - returning funcs
<dumb_questions> using ; to join them
<ziph> let testsys () = system "ls"; ()
<ziph> Or just do
<ziph> let testsys () = (ignore (system "ls"))
<dumb_questions> ( they all have side effects _
<dumb_questions> ^^^ system "ls" should be of type ()
<asmanur> no, should be of type int
<dumb_questions> hmm no
<dumb_questions> not on this box
<dumb_questions> Warning S: this expression should have type unit.
<dumb_questions> > system "ls"
<dumb_questions> because it's before a ;
<asmanur> Sys.command ;;
<xavierbot> Characters 1-12:
<xavierbot> Sys.command ;;
<xavierbot> ^^^^^^^^^^^
<xavierbot> Unbound value Sys.command
<asmanur> hum
<asmanur> on a normal box (:-') it's of type string -> int, and it's the equivalent of system () in C
<dumb_questions> ah that looks like a synonym for Unix.system which i was using
<dumb_questions> but Unix ( or is it UnixLabels) returns eg Unix.process_status = WEXITED 0
<dumb_questions> not an int
<dumb_questions> still
<dumb_questions> my question is unchanged ...
<ziph> ignore doesn't help?
<dumb_questions> heh its hardly elegant ;)
<dumb_questions> can you cast to unit ?? :)
<dumb_questions> val ignore : 'a -> unit
<dumb_questions> we're both right ;)
<dumb_questions> right
<dumb_questions> i didnt know you meant the function ignore ;-)
<ziph> Ah, right. :)
<dumb_questions> yeah thats exactly right, thanks
<dumb_questions> ok
<dumb_questions> well , today i learnt a lot
<dumb_questions> i've had this ocaml book on my shelf for yonks
<dumb_questions> and read about 100 pages
<TaXules> () ;;
<xavierbot> - : unit = ()
<TaXules> :)
<dumb_questions> it never made sense till i started a project in it
<dumb_questions> thanks all, you've helped
<TaXules> print_string "plop" ;;
<xavierbot> plop- : unit = ()
<rwmjones> Unix.system is disabled on xavierbot
<rwmjones> in fact, all of Unix
<dumb_questions> now i'm out
<dumb_questions> smoochies et al
dumb_questions has quit ["leaving"]
<bla> rwmjones, haven't tried yet this corrections with #?
<rwmjones> bla no ... because it's not a patch I haven't got round to looking at it
<bla> I can't generate patch from it if you like.
<bla> Damn; I "can".
zmdkrbou has quit [Read error: 113 (No route to host)]
<rwmjones> yeah sure ... warning that I'm really very busy at the moment though
<bla> No problem.
xaviertest has joined #ocaml
linktim__ has quit [Connection timed out]
linktim__ has joined #ocaml
<bla> rwmjones, sent; test: # () ;; end
<xaviertest> - : unit = ()
<bla> xaviertest, sleep
<xaviertest> xaviertest goes to sleep (do 'xaviertest wake' to wake)
<rwmjones> xavierbot sleep
<xavierbot> xavierbot goes to sleep (do 'xavierbot wake' to wake)
<rwmjones> xaviertest wake
<xaviertest> xaviertest wakes up
<flux> hmm..
<rwmjones> # let rec foo =
<rwmjones> foo + 1 ;;
<bla> There's still no multi line.
<rwmjones> ah ok
<bla> But it can be next step still. ;)
<flux> would ";" ^ ";" with trailing ;; be bad, if there are two bots on the channel?
<rwmjones> flux one is sleeping
<bla> $nickname usage corrected in help, commands etc. And executing between # and double ;.
<rwmjones> () ;;
<flux> darn, failed at breaking ;, I intended to make two ^B^B's :)
<flux> rwmjones, but what if they were both awake?
<rwmjones> actually the syntax of xaviertest is slightly different
<bla> One needs # at beginning.
<rwmjones> xaviertest requires # at the beginning
<bla> (-;
<rwmjones> bla's change is meant to make him less likely to interrupt if people put an accidental ending ;;
<bla> Even between # print_endline "other words";; if somebody likes.
<flux> should result in fewer accidents ;)
<xaviertest> other words
<xaviertest> - : unit = ()
<flux> # print_endline ("# foo ;" ^ ";") ;;
<xaviertest> # foo ;;
<xaviertest> - : unit = ()
<flux> using publics for automated isn't how the irc rfc says ;)
<bla> And to allow them to include code in the middle of the sentence. But there can be only one such statement... Wonder if it's a bug.
<flux> +responses
<ziph> # let a = 3;;
<xaviertest> val a : int = 3
<ziph> a;;
<ziph> # a;;
<xaviertest> - : int = 3
<ziph> # let a = "Note to self: the gold is buried under the rose bushes.";;
<xaviertest> val a : string = "Note to self: the gold is buried under the rose bushes."
<flux> so when is xavierbot going to get some persistent memory, to facilitate storing urls etc?-)
<bla> After adding something to do the authorization everything is possible..
<bla> But it's supposed to be educational bot. ;p
<flux> does someone remember the trick on how to encode multiple integers of indeterminate size into a single integer by using prime numbers?
<flux> I'm trying to create a primary key out of two other keys, which in whole are a primary key :)
middayc has joined #ocaml
<ppsmimou> you mean like 2^m*3^n encodes the pair (m,n) ?
<flux> exactly that, thank you. but now that I think of it, it probably produces too big numbers for that use :)
<ppsmimou> heh
<flux> time to exploit the fact that I know the numbers aren't likely to be very large
<bla> Hm, after 'splitting' the calculated number into prime numbers you get number of twos, and threes - this two numbers, right?
<bla> It's np-complete problem to split this?
<coucou747> no
<bla> erastotenes sieve does this in O(n) right? Without getting into number of multiplications?
<bla> Rather divisions...
<bla> Hm... Eee, wrong.
coucou747 has quit [Read error: 113 (No route to host)]
<bla> A divisions by 2 and B divisions by 3.
coucou747 has joined #ocaml
<coucou747> j'aurais peut-etre du brancher le pc...
<coucou747> (laptop is better with adaptator...)
<coucou747> bla> eratostene is O(n*log(n))
<coucou747> with n is the number of cases in the table
<bla> A divisions by 2 and B divisions by 3.
<bla> erastotenes I guess generally won't do this.
<bla> Or possibly in some queer use.
<coucou747> to decompose a number in prime factors, it's at worst O(n)
<coucou747> oh
<coucou747> sorry
<coucou747> to decompose a number in prime factors, it's at worst O(sqrt (n) )
linktim__ has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> Assuming that division is in constant time.
<Yoric[DT]> Which is not necessarily true when you start to deal with big integers.
pango has quit [Remote closed the connection]
bongy has quit ["Leaving"]
Morphous_ has joined #ocaml
pango has joined #ocaml
bongy has joined #ocaml
stbrn has joined #ocaml
stbrn has quit ["leaving"]
jonathanv is now known as jonafan
middayc has quit [Read error: 104 (Connection reset by peer)]
middayc has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
olleolleolle has joined #ocaml
thermoplyae has joined #ocaml
AxleLonghorn has joined #ocaml
marmottine has quit ["Quitte"]
thelema has quit [Read error: 110 (Connection timed out)]
middayc has left #ocaml []
ziph has quit []
linktim__ has joined #ocaml
<coucou747> My teacher asked me to make a bubble sort in caml
<coucou747> I search a pastbin
<coucou747> it makes somethink like that http://rafb.net/p/S5VfNw91.html
<coucou747> I just wanted to know if someone have a nicer solution
<coucou747> (it's not for the classroom, it's just an idea between the teacher and me)
AxleLonghorn has left #ocaml []
<rwmjones> coucou747, a nicer solution wouldn't involve bubble sort :-)
<coucou747> it's just cause bubble sort have a look of itterativ algorithm...
<coucou747> in itteratif it's just that : for (int i=0;i<N-1;i++)for (int j=i+1;j<N;j++) if (tab[i]<tab[j]){ int a=tab[i]; tab[i]=tab[j];tab[j]=a;}
<coucou747> in Cpp or java
<coucou747> rwmjones> to do a insert sort, it's nicer in ocaml as in Cpp, but to do a bubble sort...
<thermoplyae> that C code uses arrays
<Yoric[DT]> Bubble sort with lists is OK in OCaml.
<thermoplyae> you can write something similarly brief in ocaml if you avoid the functional list datatype
<thermoplyae> though it's not like what you have in the pastebin is terrible
love-pingoo has joined #ocaml
<coucou747> my aim is to make a nice bubble sort, using List
revax has joined #ocaml
Plo1 has joined #ocaml
Plo1 is now known as Plop_
Plop_ has left #ocaml []
<Yoric[DT]> Yeah, that version is ok.
<Yoric[DT]> I don't think you can do anything much nicer.
<coucou747> thx
jderque has joined #ocaml
Morphous has joined #ocaml
thermoplyae has quit ["daddy's in space"]
Morphous_ has quit [Read error: 110 (Connection timed out)]
olleolleolle has left #ocaml []
xaviertest has quit [Remote closed the connection]
<bla> xavierbot, wake
<xavierbot> xavierbot wakes up
<bla> With two bots it's still possible to make one send a command to the second, which is a command to the first...
onigiri has joined #ocaml
OChameau has quit ["Leaving"]
postalchris has joined #ocaml
thelema has joined #ocaml
RobertFischer has joined #ocaml
<flux> it's a shame there are some irc clients written by people who haven't read the relevant rfc, otherwise the notice-approach would nicely solve that
jonathanv has joined #ocaml
thermoplyae has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
ygrek has joined #ocaml
middayc_ has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
RobertFischer has quit [Client Quit]
jlouis_ is now known as jlouis
onigiri has quit []
evn has joined #ocaml
<hcarty> Is there a standard name for a fold using only the contents of the given list/array? Something like: let foo f l = List.fold_left f (List.hd l) (List.tl l)
<hcarty> Then foo min [1;2;3] to find the smallest item in the list
ita has joined #ocaml
<hcarty> "find" is the first thing that comes to my mind, but it has a different meaning in the stdlib
<hcarty> And find doesn't really apply for all uses...
<coucou747> let min_list = List.fold_left min (List.hd l) (List.tl l);;
<xavierbot> Characters 44-45:
<xavierbot> let min_list = List.fold_left min (List.hd l) (List.tl l);;
<xavierbot> ^
<xavierbot> Unbound value l
<coucou747> let min_list l= List.fold_left min (List.hd l) (List.tl l);;
<xavierbot> val min_list : 'a list -> 'a = <fun>
<coucou747> min_list [1;2;3;5;0;12];;
<xavierbot> - : int = 0
<coucou747> :)
middayc has joined #ocaml
<coucou747> hcarty> es geht ?
<coucou747> hum...
<coucou747> does it works ?
<rwmjones> xaviertest has gone ...
<thelema> hcarty: one semi-solution - List.fold_left min max_int l
<hcarty> coucou747: That works, I am just wondering if there is a standard name
<thelema> your solution raises an exception on an empty list, mine returns max_int
<coucou747> what's the minimum of an empty list ?
<coucou747> there is no minimum... so the exception is (for me) the good solution
<hcarty> Thank you for both of the examples, but is the naming convention that I am wondering about
<hcarty> s/is/it is/
<jderque> hcarty: it's called foldl1 in haskell : "foldl1 is a variant of foldl that has no starting value argument, and thus must be applied to non-empty lists."
<thelema> fair enough. Maybe the stdlib should have reduce_left and reduce_right runctions
<hcarty> jderque: Thanks
<hcarty> I like "reduce"...
<thelema> hcarty: that's the python name
evn has quit [Read error: 104 (Connection reset by peer)]
<hcarty> Oh no! I can't use them then... :-)
<ita> let reduce_left = fold_left in
evn has joined #ocaml
<hcarty> thelema: Thanks, I think I will use those names
<thelema> hcarty: just giving credit where it's due.
<thelema> ita: let reduce_left f l = fold_left f (hd l) (tl l)
middayc_ has quit [Read error: 110 (Connection timed out)]
<hcarty> module Array = struct include Array let reduce_left f a = fold_left f a.(0) (sub a 1 (length a - 1)) end;;
<xavierbot> module Array :
<xavierbot> sig
<xavierbot> external length : 'a array -> int = "%array_length"
<xavierbot> external get : 'a array -> int -> 'a = "%array_safe_get"
<xavierbot> external set : 'a array -> int -> 'a -> unit = "%array_safe_set"
<xavierbot> external make : int -> 'a -> 'a array = "caml_make_vect"
<xavierbot> external create : int -> 'a -> 'a array = "caml_make_vect"
<xavierbot> val init : int -> (int -> 'a) -> 'a array
<xavierbot> val make_matrix : int -> int -> 'a -> 'a array array
<xavierbot> val create_matrix : int -> int -> 'a -> 'a array array
<hcarty> Oh my, I'm very sorry about that
<hcarty> Array.reduce_left min [|1;2;0;5|];;
<xavierbot> - : int = 0
zmdkrbou_ is now known as zmdkrbou
<linktim__> someone can help me for do a better code ?
<linktim__> it's verry ugly
<thelema> I think you'll have to write your own iterator to start at element 1
<linktim__> can i do an only « for » for this situation ?
<thelema> yes.
<linktim__> really ?
<linktim__> how ?
<thelema> let acc = ref a.(0) in for i = 1 to Array.length a - 1 do acc := f acc a.(i); done; !acc
asmanur has quit [Remote closed the connection]
<linktim__> with a tab.(x).(y) ?
<linktim__> what is "f" ?
<thelema> linktim__: The function you want to reduce the array over.
<thelema> sorry, I'm still on the other conversation thread
<linktim__> ok
* thelema opens linktim__'s code
<linktim__> :D
linktim__ is now known as Linktil
Linktil is now known as Linktim
<thelema> ah, tic tac toe.
<Linktim> yes :)
<thelema> let check_row i = if tab.(i).(0) = tab.(i).(1) && tab.(i).(1) = tab.(i).(2) then Some tab.(i).(0) else None
<thelema> similar for col
ircrerun has joined #ocaml
thermoplyae has quit [Nick collision from services.]
ircrerun is now known as thermoplyae
<thelema> let check_diags = if (tab.(0).(0) = tab.(1).(1) && tab.(1).(1) = tab (2).(2)) || (tab.(0).(2) = tab (1).(1) && tab (1).(1) = tab.(2).(0)) then Some tab.(1).(1) else None
<thelema> if you really liked, you could raise an exception instead of returning Some x, to carry the value of who won up to the higher level code.
olleolleolle has joined #ocaml
<Linktim> thelema: but, how to know who have win ?
<thelema> check_row returns None if noone won and Some x if player x won.
<Linktim> ok :)
evn has left #ocaml []
rwmjones has quit ["Closed connection"]
postalchris has quit [Read error: 110 (Connection timed out)]
postalchris has joined #ocaml
<jderque> http://ocaml.paste.f-box.org/9 (may be harder to read, though)
<pango> you can probably write check_configuration using List.for_all
<jderque> hmm, yes, that could be simpler :-)
bluestorm has joined #ocaml
leo037 has joined #ocaml
nawcom has joined #ocaml
nawcom has quit [Client Quit]
vpalle has joined #ocaml
leo037 is now known as ofaurax
ofaurax has quit ["Leaving"]
ofaurax has joined #ocaml
jlouis_ has joined #ocaml
thermoplyae has quit ["daddy's in space"]
jlouis__ has joined #ocaml
jderque has quit ["leaving"]
Linktim has quit [Remote closed the connection]
jlouis has quit [Read error: 110 (Connection timed out)]
l_a_m has quit [Remote closed the connection]
jlouis_ has quit [Read error: 110 (Connection timed out)]
thermoplyae has joined #ocaml
ita has quit ["Hasta luego!"]
malc_ has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
^authentic has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
authentic has quit [Read error: 113 (No route to host)]
^authentic is now known as authentic
olleolleolle has quit []
bongy has quit ["Leaving"]
<TaXules> let rec plop = function |0 -> 1 |n -> n+(plop (n-1)) in plop 10 ;;
<xavierbot> - : int = 56
<TaXules> :)
<coucou747> plop 1;;
<xavierbot> Characters 1-5:
<xavierbot> plop 1;;
<xavierbot> ^^^^
<xavierbot> Unbound value plop
<coucou747> sorry
<coucou747> let rec plop = function |0 -> 1 |n -> n+(plop (n-1));;
<xavierbot> val plop : int -> int = <fun>
<coucou747> plop 1;;
<xavierbot> - : int = 2
<coucou747> plop 5;;
<xavierbot> - : int = 16
<coucou747> TaXules> U can make that in O(1)
<coucou747> let plop n = n*(n+1) / 2 + 1;;
<xavierbot> val plop : int -> int = <fun>
<coucou747> plop 10;;
<xavierbot> - : int = 56
<coucou747> plop 5;;
<xavierbot> - : int = 16
<coucou747> TaXules> no ?
<TaXules> yes
<TaXules> of course! ;)
<TaXules> but I wanted to test recursive functions
<coucou747> I don't understand why Uve made | 0 -> 1
<coucou747> the sum of naturals number is with | 0 -> 0
<TaXules> and I did'nt want to do factorial again :)
<coucou747> ...
<coucou747> I don't understand...
<coucou747> Ure plop is not a factorial...
<TaXules> this one:
<TaXules> let rec plop = function |0 -> 1 |n -> n*(plop (n-1)) in plop 10 ;;
<xavierbot> - : int = 3628800
<coucou747> I know what's factorial....
<TaXules> yes, I started to do it, and then I changed my mind ! ;)
<coucou747> ok....
<coucou747> I don't understand which type of probleme can be solved by youre "plop"
<TaXules> nothing
<TaXules> just for testing xavierbot
evn_ has joined #ocaml
<julm> Sys.ocaml_version;;
<xavierbot> Characters 1-18:
<xavierbot> Sys.ocaml_version;;
<xavierbot> ^^^^^^^^^^^^^^^^^
<xavierbot> Unbound value Sys.ocaml_version
<julm> :/
Yoric[DT] has joined #ocaml
<bluestorm> Sys may be hidden
<bluestorm> module S = Sys;;
<xavierbot> Characters 12-15:
<xavierbot> module S = Sys;;
<xavierbot> ^^^
<xavierbot> Unbound module Sys
ygrek has quit [Remote closed the connection]
<julm> external get_config: unit -> string * int = "caml_sys_get_config";;
<xavierbot> 'external' keyword disabled
<xavierbot> - : unit = ()
<julm> /o\
<Yoric[DT]> tssss
<julm> open_in;;
<xavierbot> - : unit = ()
<julm> ...
<julm> exit;;
<xavierbot> - : unit = ()
<julm> hahaha
<coucou747> quit;;
<xavierbot> Characters 1-5:
<xavierbot> quit;;
<xavierbot> ^^^^
<xavierbot> Unbound value quit
<coucou747> let rec a=function n -> a n in a;;
<xavierbot> - : 'a -> 'b = <fun>
<coucou747> Oo
<coucou747> let rec a=function n -> a n in a 0;;
<xavierbot> Objective Caml version 3.10.0
<xavierbot> Camlp4 Parsing version 3.10.0
<mbishop> heh
<coucou747> Oo
<TaXules> ;)
thermoplyae has quit ["daddy's in space"]
<julm> exception E of [>];;
<xavierbot> Characters 16-18:
<xavierbot> Parse error: ">" or "|" or [row_field] expected after "[" (in [ctyp])
<xavierbot> Characters 18-20:
<xavierbot> Parse error: illegal begin of top_phrase
<xavierbot> exception E of [>];;
<xavierbot> ^^
<julm> exception E of [> ];;
<julm> arf
<julm> 42;;
<xavierbot> Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 262, char 8
<julm> outch
<bluestorm> 42;;
<xavierbot> - : int = 42
<julm> exception E of [> ];;
Yoric[DT] has quit ["Ex-Chat"]
<julm> oh my...
<julm> why isn't it working?
<julm> 42;;
<xavierbot> Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 262, char 8
<bluestorm> :p
<julm> has he blacklisted me or what?
<bluestorm> exception E of [> ];;
<bluestorm> 24;;
<xavierbot> Assertion failed, file "camlp4/Camlp4/Struct/Camlp4Ast2OCamlAst.ml", line 262, char 8
<bluestorm> see :}
<bluestorm> looks like a camlp4 weirdiness
<julm> exception E;;
<xavierbot> exception E
ofaurax has quit ["Leaving"]
_W_ has joined #ocaml
<mbishop> julm: maybe it uses threads? and your thread is dead? :P
<julm> dunno :/
<julm> 42;;
<xavierbot> - : int = 42
<_W_> hey under http://caml.inria.fr/ocaml/release.en.html#id2269672, is the page supposed to just list that there is cygwin and win64 binaries, without actually providing them?
<malc_> _W_: huh? since when does gcc support win64?
<_W_> malc_, I have no idea, I don't think it does?
<malc_> _W_: last time i checked it didn't
<malc_> that means no dice with cygwin/ming there
<_W_> it's kind of irrelevant to what I'm asking though
<malc_> i should pay more attention to 'and's
<_W_> ah I see the comment at the end of the win64 section
<thelema> _W_: you have to make your own win64 binaries.
<_W_> anyway, iut's the cygwin binaries I'm after
<_W_> *it's
<_W_> I mean, I can compile myself, but if someone already has for cygwin, it'd save me some time
<thelema> _W_: make them yourself
<_W_> I guess the maintaners of the page doesn't come here?
<thelema> _W_: not so much.
<bla> I was using bytecode ocaml on windows. Which... worked... And doesn't need a compiler.
<hcarty> _W_: Windows binary packages are something the OCaml team recently asked for help on
<julm> module M : sig val f : [>`A of int] -> [>`A of int] end = struct let f x = x end;;
<xavierbot> module M : sig val f : [> `A of int ] -> [> `A of int ] end
<julm> \o/
<_W_> hcarty, yeah I figured something like that was up, it's just that the text on that page made it appear as if there WAS a binary, and they just forgot to link to it or something
coucou747 has quit ["bye ca veut dire tchao en anglais"]
postalchris has joined #ocaml
evn_ has quit [Read error: 110 (Connection timed out)]
vpalle has quit ["Leaving"]
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
bluestorm has quit ["Konversation terminated!"]
jlouis has joined #ocaml
Mr_Awesome has joined #ocaml
jlouis__ has quit [Read error: 110 (Connection timed out)]
malc_ has quit ["leaving"]
onigiri has joined #ocaml
LordMetroid has quit ["Leaving"]