flux__ changed the topic of #ocaml to: OCaml 3.09.2 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/
Schmurtz has quit [Read error: 113 (No route to host)]
rillig has quit ["exit(EXIT_SUCCESS)"]
smimou has quit ["bli"]
metaperl has joined #ocaml
WhatTheDeuce has joined #ocaml
cratuki has joined #ocaml
love-pingoo has joined #ocaml
love-pingoo has quit ["Connection reset by by pear"]
m3ga has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
sieni has quit [Read error: 110 (Connection timed out)]
Revision17 has joined #ocaml
Smerdyakov has quit ["Leaving"]
mikeX has quit ["zzzz"]
chessguy has joined #ocaml
Banana has quit [Read error: 104 (Connection reset by peer)]
Banana has joined #ocaml
ramkrsna has quit [Connection timed out]
ramkrsna has joined #ocaml
WhatTheDeuce has quit ["Download Gaim: http://gaim.sourceforge.net/"]
WhatTheDeuce has joined #ocaml
WhatTheDeuce has quit [Read error: 104 (Connection reset by peer)]
WhatTheDeuce has joined #ocaml
bohanlon has joined #ocaml
WhatTheDeuce has left #ocaml []
Snark has joined #ocaml
vitriol_ has joined #ocaml
chessguy has quit [Connection timed out]
<vitriol_> has anyone ever used ocaml to embed an extension language in a C program?
<flux__> I had tried to do that with irssi
<flux__> it is far from complete, but I think it technically works.. or maybe worked last time I worked on it :)
bluestorm has joined #ocaml
<bluestorm> hello wolrd
<bluestorm> could someone explain me how i may stop a Unix.accept ?
<vitriol_> flux__, oh that's cool
<bluestorm> i have a thread running accept, and i would like to have a fonction that stop that accept, and then execute some part of code in the thread that was doing the accept
<vitriol_> flux__, so there are patches for irssi?
<bluestorm> (i mean, just kill the thread isn't what i'm looking for)
<flux__> I haven't released anything, maybe I should, even if they aren't really usable yet
<bluestorm> hum
<flux__> if you're interested, though, I can provide patches
<bluestorm> Could i use a Unix.select before the accept ?
<flux__> there's a way to do nonblocking connect with select, yes
<bluestorm> hum
<flux__> there was a related bug in some ocaml version though, it might be fixed in present versions
<flux__> however, the idea is to set the socket into non-blocking state
<flux__> and then connect
<bluestorm> i never used select and the doc isn't very verbose about that
<bluestorm> hum
<flux__> and when the socket is ready for write (??), do it again
<flux__> it will throw Unix_error (EINPROGRESS, _, _) when it's still doing the connection
<flux__> google will find you actual examples on the subject
<flux__> atleast I think I've provided sufficiently many keywords :)
<bluestorm> :p
<flux__> if you need documentation in general how select is supposed to be used, check out libc info pages
<bluestorm> hum
<flux__> I believe it has some examples. if not, refer to google, it _must_ have dozens of examples.
<bluestorm> ok
<bluestorm> i didn't looked for C-ish examples
<bluestorm> i'm gonna do it now
<flux__> yeah, for more documentation on how stuff in the Unix-module is supposed to work, it's a good idea to search for C-stuff
<flux__> as they in principle are the same
<vitriol_> flux__, i would be quite interested in those patches...
<flux__> ok, I'll see if I remember how to extract stuff from svk.. :)
<vitriol_> :)
<bluestorm> thanks flux__ , after a little googling i found http://www.ussg.iu.edu/hypermail/linux/net/0001.1/0073.html . I'll try to implement that.
<bluestorm> (actually that was what i thought, by it's good to be sure it's correct)
Schmurtz has joined #ocaml
Skal has joined #ocaml
Schmurtz has quit [Client Quit]
Schmurtz has joined #ocaml
<metaperl> what led ocaml to use +. and + instead of overloading +
<pango> simplicity over adhoc overloading hack (not that they haven't used hacks elsewhere :/)
<vitriol_> what's the most egregious ocaml hack?
<pango> first that come to my mind is printf implementation
* metaperl looks up egregious
<pango> maybe someone with deeper knowledge of compiler implementation could provide better examples ;)
<mellum> making < and = work on everything is also a hack.
<mellum> worse than printf IMHO.
* pango nods
<metaperl> let y = fun x y -> 3*x + y ;; (* is it possible to curry this function of either x or y? *)
<ketty> hmm?
<ketty> you want fun ~x ~y ?
<metaperl> no, it would've been let curried1 = y x 2 ;; let curried2 = y 5 z ;;
<metaperl> # let z1 = fun m -> y 3 m ;;
<metaperl> val z1 : int -> int = <fun>
<metaperl> # let z2 = fun m -> y m 3 ;;
<metaperl> val z2 : int -> int = <fun>
<metaperl> #
<metaperl> I saw it in the online book
<ketty> let curried1 = y ~y:2 and curried2 = y ~x:5;;
<metaperl> I dont know tilde notation yet
<metaperl> I'm going thru the ora book chap by chap
<ketty> it is named parameters..
<ketty> allthou your examples are fine..
<ketty> you still have problem with something?
<metaperl> no. thanks for asking
<metaperl> t
<metaperl> I thought ~ meant a lazy parameter
<ketty> it doesn't ^^
mikeX has joined #ocaml
vitriol_ has quit [Remote closed the connection]
<metaperl> # function f -> function g -> f x ;;
<metaperl> - : (int -> 'a) -> 'b -> 'a = <fun>
<metaperl> (* the type signature here confuses me... f's signature should be ('a -> 'b) and g's signature should be ('a -> 'c) *)
<ketty> where does x come from?
<ketty> what is the type of x?
<metaperl> i dont know. this is in the ora book
<ketty> (i suppose it is int ^^)
<ketty> well, for this to pass the compiler x needs to be defined ^^
<metaperl> # let app = function f -> function x -> f x ;;
<metaperl>
<metaperl> val app : ('a -> 'b) -> 'a -> 'b = <fun>
<metaperl> that's straight from the book
<metaperl> oh I typed it wrong when playing with it, but I still dont understand the type signature
<ketty> yes, that makes sense..
<metaperl> a function should look like (a -> b)
<metaperl> we have two functions
<metaperl> therefore
<metaperl> function f should look like (a -> b)
<metaperl> and function x should look like ( c -> d)
<metaperl> for some a,b,c,d
<metaperl> agreed?
<ketty> hmmm...
<metaperl> oh
<metaperl> function f means an anonymous function which takes f as an argument
<ketty> app takes one function and one argument and applies the argument to the function, right?
<ketty> yes, that is true :)
<metaperl> so we have two anonymous functions
<metaperl> the first one takes a function
<metaperl> the second takes something that that first function can digest
smimou has joined #ocaml
<metaperl> oh yes I see now
<ketty> yes, the first function returns another function
<metaperl> wait
<ketty> who's type depend on the argument passed to the first function...
<metaperl> I dont think I understand the precedence in the arrows
<ketty> hmm?
<metaperl> I'm very lost
<ketty> val f: int -> int -> int
<metaperl> I think I need to start back with just a single function
<ketty> is same as val f: int -> (int -> int)
<metaperl> function f -> 12 ;;
<metaperl> is there a bot here?
<metaperl> that interprets ocaml?
<ketty> bot?
<metaperl> irc bot
<ketty> no, i dont think so :)
<metaperl> oh ok... I need to go back and read the first part of this section again...
<ketty> what type would you say "function f -> 12" has by the way? ^^
<metaperl> (_ -> int)
<metaperl> (a' -> int)
<ketty> yes ^^
<metaperl> I also understand this now
<metaperl> function x -> (function y -> 3*x + y) ;;
<metaperl> int -> (int -> int)
<ketty> mmm, true :)
<ketty> note that "(function x -> function y) -> 3*x + y" would not make much sence :)
Skal has quit [Remote closed the connection]
<metaperl> what is the typical suffix for ocaml program files?
<ketty> metaperl: *.ml
<metaperl> what command to ocaml tells it to load a file of code?
<ketty> #use "file.ml"
<ketty> you can allso compile it with ocamlc
<ketty> or you can run it as a script with "ocaml file.ml"
ramkrsna has quit [Read error: 110 (Connection timed out)]
multani has joined #ocaml
_jol_ has joined #ocaml
sieni has joined #ocaml
Smerdyakov has joined #ocaml
z|away has joined #ocaml
Skal has joined #ocaml
<z|away> "let module X = if b then X1 else X2 in" doesn't work. How would I accomplish this?
<zmdkrbou> ouch
<zmdkrbou> you don't :)
<metaperl> you can in Perl
<zmdkrbou> ...
<ketty> you'll have to use objects for such things...
<zmdkrbou> yep, objects will do
<zmdkrbou> (modules are not first class in ocaml)
<z|away> Any alternatives I can use while sticking with modules?
<mellum> z|away: use a functor?
* Smerdyakov looks at metaperl funny.
<zmdkrbou> hehe
<pango> (seems there have been experiments with first class modules... http://www.eleves.ens.fr/home/frisch/soft.html#patches)
<zmdkrbou> pango: there's been quite a lot of work about first class modules ... for examples mixins, but it won't be introduced in ocaml
<Smerdyakov> z|away, can you give broader context of what you are trying to accomplish?
<zmdkrbou> it doesn't work that good, it seems ... :s
<metaperl> class-based oop keeps trying to be an OK easy to use version of prototyped-based oop in my eyes... roles, traits, mixins, first-class modules, etc...
<metaperl> it's happening in Perl too -- meta-object protocols for classes and more... just because prototyped-based OO gets overlooked
<Smerdyakov> metaperl, have you actually implemented any serious software in a non-Perl language?
<metaperl> no. not since my M.S. degree in 1993 have I done anything serious outside of Perl
<mellum> I don't think that modules as in Ocaml have much to do with "OO"
<metaperl> oh
<Smerdyakov> metaperl, OK, so I don't see how you're qualified to discourse on prototype-based OO. :P
<mellum> Except that in languages specializing on OO you would use OO mechanism to achieve the same
<metaperl> Smerdyakov: it speaks for itself. one is a subset of the other. the subset is convenient but gets itself into trouble
<zmdkrbou> if modules were OO in ocaml there wouldn't an "o" added to the "caml" name :)
<Smerdyakov> And I can add extra useless features to any language. What's your point?
<dylan> there's a patch for first class modules in ocaml, I think.
<z|away> Smerdyakov: Not really, I'm just modifying existing code which uses "let X = module V in X.doStuff x y z ..." but I need to conditionally use Y.doStuff x y z... and was hoping for a quick way to do it.
<dylan> it'd be neat if modules were first class, as functors and functions would be the same.
<ketty> z|away: maybe you can set V to Y before that part?
bluestorm has quit [Remote closed the connection]
<z|away> ketty: I don't think that works either.
<ketty> ohh.. so you sometimes want to use X.stuff and sometimes Y.stuff...
<z|away> yes
<ketty> you could use a functor..
<ketty> on the part "doingStuff"
<ketty> but you need to know which of the two you want when you call functions etc..
<ketty> so, i guess there is no really easy way...
<ketty> except using objects :)
<z|away> Sure.. or a mass copy & paste. Ah well.
<ketty> yeah, that is an option too :)
<pango> what about writing calling code as a functor, instanciate it with X, and with Y, then use one instance or the other based on b ? Whether it's practical really depends on usage, however
<Smerdyakov> z|away, that's not enough context to see what would make sense if writing the program from scratch.
_jol_ has quit ["leaving"]
_jol_ has joined #ocaml
dvorak has joined #ocaml
love-pingoo has joined #ocaml
Skal has quit [Remote closed the connection]
_jol_ has quit ["leaving"]
Revision17 has quit [Connection timed out]
fujihc has joined #ocaml
fujihc has left #ocaml []
cyyoung has quit ["Leaving"]
rillig has joined #ocaml
chessguy has joined #ocaml
chessguy has quit [Read error: 104 (Connection reset by peer)]
cyyoung has joined #ocaml
slipstream has joined #ocaml
vincenz has joined #ocaml
<vincenz> hello
<vincenz> been a while :)
<ketty> hello ^^
<vincenz> any news in the ocaml world?
<vincenz> has a new ocamllib come out yet, cause I had submitted some patches but back then devel of ocamllib was somewhat grinded to a halt
<ketty> hmm... me don't know ^^
<jip> what's ocamllib?
<vincenz> ocamllib is a lib with some std functionality that is missing in the core lib
<ketty> the latest release seems to be from february this year...
<pango> I hope it's a superset of the others ;) (annexlib, missinglib, extlib,...)
<ketty> isn't it the same as extlib?
<pango> ah, yes, I think so too (remembering how extlib html pages are called)
<vincenz> err
<vincenz> extlib
ellisonch has joined #ocaml
finelemon has joined #ocaml
finelemo2 has joined #ocaml
slipstream-- has quit [Connection timed out]
WhatTheDeuce has joined #ocaml
finelemo1 has quit [Read error: 110 (Connection timed out)]
finelemon has quit [Connection timed out]
ellisonch has quit ["Leaving"]
Snark has quit ["Leaving"]
bohanlon has quit [Read error: 104 (Connection reset by peer)]
jcreigh has joined #ocaml
shawn has joined #ocaml
Revision17 has joined #ocaml
multani has quit ["Parti"]
bohanlon has joined #ocaml
jcreigh has quit ["Do androids dream of electric sheep?"]
cyyoung has quit ["Leaving"]
Skal has joined #ocaml
Skal has quit [Remote closed the connection]
asymptote has joined #ocaml
<asymptote> does let x = (f, g, h, i) evaluate those in the order i, h, g, f?
<ketty> you could test that with an easy example..
<ketty> ( = i dont really know ^^)
<asymptote> I can't find documentation on it, and it *seems* to be what it does
<asymptote> I'd just like to know for sure
<pango> I'm not sure it's specified
<asymptote> Well, I mean, the other option being that no order is guaranteed
<asymptote> which might make sense for a functional language
<asymptote> so, as an example, it's not a good idea to fill a tuple with file input functions directly
<pango> it's not purely functional, so *some* evaluation order is specifed
<asymptote> as I just found
<jip> well, in c, the order is undefined
<pango> for example in let v = e in x, e is guaranteed to be evaluated before x
<asymptote> right, the inner scope is guaranteed to be evaluated later
<asymptote> but (w, x, y, z) is a single scope
<asymptote> and what about let v = e and x
<asymptote> ?
<asymptote> This is the first time I've done any significant I/O and suddenly order of evaluation is important like it never has been before me here.
asymptote has quit ["Leaving"]
Revision17 has quit [Connection timed out]
metaperl has quit [Read error: 104 (Connection reset by peer)]
love-pingoo has quit [Read error: 110 (Connection timed out)]
mrpingoo has joined #ocaml
rillig has quit ["exit(EXIT_SUCCESS)"]
smimou has quit ["bli"]