gl changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn , A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ , A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list | http://icfpcontest.org/ !!
Skal has quit ["Client exiting"]
CiscoKid has joined #ocaml
CiscoKid has quit [Read error: 110 (Connection timed out)]
CiscoKid has joined #ocaml
CiscoKid_ has joined #ocaml
CiscoKid has quit [Read error: 104 (Connection reset by peer)]
CiscoKid_ is now known as CiscoKid
bk_ has quit ["I'll be back"]
shaggy has joined #ocaml
Godeke has quit [Remote closed the connection]
_shawn has quit [Read error: 104 (Connection reset by peer)]
async has joined #ocaml
Nutssh has joined #ocaml
shawn has joined #ocaml
vezenchio has quit ["--- reality is that which, when you stop believing in it, doesn't go away ---"]
benja has joined #ocaml
<benja> hi
<benja> how can I expand a quotation in order to have a collection of "let xxx = a" ?
<CiscoKid> I'm not sure what you mean. Are you looking for something akin to eval?
<benja> basically, I want my expander to read some variable from a xml file
<CiscoKid> OCaml's not a very dynamic language. That gets in the way of the strong static typing that makes it so great.
<CiscoKid> You can put them in a hashtable or something, though.
shaggy has quit [Client Quit]
<benja> I'm writing a mini binding to gconf. So I,m writing a preprocessor extension to read a gconf schema file a translate it in functions call to get and set the key
<benja> s/file a/file and/
<benja> does that make any sense ?
<CiscoKid> I'm not familiar with gconf. Dynamic bindings can be tough in a static language, though. I haven't tried.
<benja> I don't think it's dynamic because the parser read the schema file before the real compilation occur
<benja> what I want to do is: <:load_schemas<filename>> and that would translate each xml key node in a 'let key = gconfclient#get_key "key"' expression
<CiscoKid> Oh, you mean you're generating ocaml code?
<benja> yeah
<CiscoKid> Oh, hmm... I'm not sure I understand the problem, then. I thought you were going for eval.
<benja> the problem is that I can translate a <<quotation>> in multiple let statement because the ocaml parser expect and single expression
<benja> s/can/ can't
<CiscoKid> I guess I'm not sure I understand your whole problem.
<benja> when my expander return something like "let x = 8;; let y = 9;;" the ocaml parser reject it because he
<benja> 's expecting a single expression
<CiscoKid> You mean inside a function? It's let x = 9 in
Herrchen has quit [Read error: 110 (Connection timed out)]
<benja> no I want to declare two value
<CiscoKid> let x = 8 and y = 9 in [...]
<benja> hoooo
<CiscoKid> Outside of a function, what you said should be fine, though.
<benja> I'm gonna try that. I feel sudently stupid that I didn't try that :s
<CiscoKid> Heh. Feeling stupid is half the battle!
Nutssh has quit ["Client exiting"]
<benja> mm it still don't work
<benja> I can't create a "let " statement because it's not an expression
<CiscoKid> Can you show me the code that's not compiling?
GreyLensman has quit ["Leaving"]
<benja> <:myquotation<plop>> ;; let _ = print_endline plop
<benja> my quotation return something like "let plop = \"abcd\""
<benja> and the errro is:File "conf.ml", line 3, characters 0-32:
<benja> While parsing result of quotation "load_schemas": (consider using option -QD)
<benja> Parse error: 'and' or 'in' expected (in [expr])
<benja> Preprocessing error
<CiscoKid> Can you post a link to a full .ml with your problem?
<benja> I think I could work if I declare a class
<CiscoKid> I've never done OO in OCaml, oddly enough.
<benja> I will try to do it with a class or a module expression
<CiscoKid> Oh, wow, I could've saved you a lot of time...you're doing stuff I've never used at all. :)
<benja> ah ok
<benja> ocaml is very powerfull but it's not so easy to learn
<benja> there is so much stuff ;)
<CiscoKid> Yeah, it's pretty broad. I've only done functional stuff with it. It's pretty nice in that regard. I'm writing a fault-tolerant app in erlang in another window right now, though.
<benja> I started to look at the pre-processor and lexer stuff yesterday and I have a big headache ;)
<benja> is erlang a functional language ?
<CiscoKid> Yeah.
<benja> how is it compared to ocaml ?
<benja> I've heard some nice thing about it and learning erlang is still on my todo-when-I-have-time list
<CiscoKid> It's not as fast (what is?). Its main strength is distributed and/or fault-tolerant applications.
<benja> sounds very cool to me
<CiscoKid> It's fairly pleasant. No vars, process-centric. Kind of a different paradigm there. You end up making tons of processes to handle little threads of execution, but it's really easy.
<benja> what kind of application are you working on ?
<CiscoKid> It's my environmental monitor for the house. Runs in a cluster over a couple of machines and validates that my temperatures are all in a predefined state. If it doesn't hear from something in a while, or something's out of range, it sends emails and stuff. Also redistributes the data it receives (via multicast) over a TCP socket for any remote monitors that want to watch live data.
<benja> wouw !
<benja> that's very cool
<benja> is there some nice bindings for erlang ?
<CiscoKid> It runs in a multi-node cluster thingy and when a node fails, it'll pretty much immediately take over. When the master node comes back on, it will perform an application takeover.
<CiscoKid> The cool part is that I've been using it for a couple of weeks now.
<CiscoKid> Um, some. snmp, megaco, stuff like that. It's got a lot of its own thing, though. mnesia, for example, is cool. :)
JPL-Justin-away has quit [Read error: 60 (Operation timed out)]
JPL-Justin-away has joined #ocaml
wmg has joined #ocaml
wmg has quit ["Leaving"]
Herrchen has joined #ocaml
ne1 has quit ["To understand recursion, you must first understand recursion."]
gim has joined #ocaml
kosmikus|away is now known as kosmikus
Snark has joined #ocaml
<Snark> slt
benja has quit ["Leaving"]
Boojum has joined #ocaml
kinners has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
kinners has quit [Client Quit]
Boojum is now known as Snark
CiscoKid has quit ["http://lice.codehack.com"]
Boojum has joined #ocaml
Snark has quit [Nick collision from services.]
Boojum is now known as Snark
fab has joined #ocaml
fab is now known as _fab
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
Boojum is now known as Snark
Boojum has joined #ocaml
Snark has quit [Nick collision from services.]
Boojum is now known as Snark
smimou has joined #ocaml
smkl has quit [Read error: 54 (Connection reset by peer)]
TramDormanta is now known as Tram
smkl has joined #ocaml
bk_ has joined #ocaml
farizeo has joined #ocaml
fariseo has quit [Read error: 60 (Operation timed out)]
karryall has joined #ocaml
Pilot has joined #ocaml
Pilot has quit [Read error: 54 (Connection reset by peer)]
Lemmih has quit ["Download Gaim: http://gaim.sourceforge.net/"]
Pilot has joined #ocaml
bk_ has quit ["leaving"]
bk_ has joined #ocaml
cmeme has quit ["Client terminated by server"]
Godeke has joined #ocaml
cmeme has joined #ocaml
Dybbuk_ has quit [calvino.freenode.net irc.freenode.net]
Dybbuk_ has joined #ocaml
noss has joined #ocaml
Lemmih has joined #ocaml
<Pilot> i've got this problem with lablgl:
<Pilot> there's a method in the raw module: val of_float_array : float array -> kind:([< fkind] as 'a) -> 'a t, where t is type (+'a) t
<Pilot> i pass it a float array and a kind, say [|0.|] ~kind:`double
<Pilot> and toplevel tells me "...method has type ([< Raw.fkind > `double ] as 'a) Raw.t where 'a is unbound"
<Pilot> i don't understand what's meant - i dont care to bind it to a name
<karryall> you're defining a class, right ?
<Pilot> yes
<karryall> methods can't have polymorphic arguments in class
<karryall> so you have to add a type annotation
<karryall> so that the polymorphic variant doesn't introduce a type variable
<Pilot> i see, but what type should i use?
<karryall> method of_float_array a (kind : Raw.fkind) = Raw.of_float_array a kind
<karryall> maybe
<Pilot> ill try that
cmeme has quit [Read error: 54 (Connection reset by peer)]
<karryall> the other option is to define your method as a polymorphic method
<Pilot> i need to type this: ~kind:`double
<Pilot> my attempt: (~kind:`double):Raw.fkind , doesnt work
<karryall> is this in the method definition or during the invocation ?
<Pilot> i'm just trying to invoke it
<karryall> but how did you define it ?
<Pilot> i didn't define of_float_array, it is a method from lablgl
<karryall> no, Raw.of_float_array is not method, it's a function
cmeme has joined #ocaml
<Pilot> yes it is, i'm just calling it from within a method
<karryall> I see, kind is not an argument of your method ?
<karryall> then try this : of_float_array array ~kind:(`double : [`double])
<karryall> or ~kind:(`double : Raw.fkind)
<Pilot> *happy*
<Pilot> thank you!!
<Pilot> so what do i actually do here? i bind a variant `double to variant type [`double].
<Pilot> what if i used another variant type?
<karryall> what happens is that without the type annotation `double, has type [> `double]
<karryall> then when you call of_float_array, this becomes [< Raw.kfind >`double] which is reflected in the result's type
<karryall> this is a polymorphic type, hence the trouble
<Pilot> if a variable has type [> `double], does it mean it can later be assigned something like `float, because [> `double | `float ] is an extension to [> `double] ?
<karryall> exactly, that's what the > means
<Pilot> but can a variable [> `double | `float ] be restricted to the type [> `double ] or [`double] (thats what i do) ? then what is the '<' good for?
<karryall> the < means that the set of variants cannot be extended
<karryall> you cannot restrict [> `double | `float ] to [`double], that would means forgetting about the `float tag, that's not safe
<karryall> you can restrict [> `double] to [`double], this means you're closing the set of permitted tags
<Pilot> so if i define a type t = [`x|`y|`z], any variable of this type has initially type [> `x|`y|`z]
<Pilot> and not [`x|`y|`z]
jdrake has joined #ocaml
noss has quit ["Leaving"]
<karryall> there's not such thing as 'a variable of this type' since types are inferred
<karryall> if you write (fun (x : t) -> ...)
<karryall> then x has type [`x|`y|`z] because of the type annotation
<karryall> the constructor `x has type [> `x] initially, which is unifiable with t
vezenchio has joined #ocaml
<Pilot> i'm beginning to understand. thanks again
kosmikus is now known as kosmikus|away
ganymede has quit [Read error: 60 (Operation timed out)]
clog has joined #ocaml
gl has left #ocaml []
gl has joined #ocaml
noss has quit [Read error: 110 (Connection timed out)]
karryall has joined #ocaml
bk_ has quit ["leaving"]
bk_ has joined #ocaml
<Snark> good night
Snark has left #ocaml []
jarod has joined #ocaml
jarod has quit [Client Quit]
jarod has joined #ocaml
Pilot_ has joined #ocaml
<Pilot_> pilot: you are to release my nick
<gl> /msg nickserv help recover
<Pilot_> no problem to do that, but i usually warn before
<Pilot_> btw, hi :)
<gl> hi
Pilot is now known as Zaius
<Zaius> no problem
Pilot_ is now known as Pilot
<Pilot> --- [Pilot] is an identified user
<Pilot> bb, people!
<Zaius> bye
Pilot has left #ocaml []
CiscoKid has joined #ocaml
jdrake has quit [Read error: 60 (Operation timed out)]
<_fab> i need to ensure that a write to a file is completed, but i can't find any ocaml function that calls "sync". is there any other way?
<Smerdyakov> flush doesn't do it?
<_fab> no
<Smerdyakov> Hm... close and re-open the file? :D
<_fab> it just writes the remaining bytes from the buffer
<_fab> this would work, but its ugly imho
<Smerdyakov> Fly to INRIA and ask?
<Riastradh> Use the FFI to extract the file descriptor and perform the system call yourself?
<_fab> Riastradh: FFI?
<Riastradh> Foreign Function Interface
<Riastradh> I.e. call C functions to do it for you.
<_fab> c bindings?
kosmikus is now known as kosmikus|away
<karryall> _fab: Unix.openfile has a O_SYNC flag
<_fab> karryall: i tried it with ocamltop and strace, but it doesnt seem to sync after write
<karryall> what's your platform ?
<_fab> linux
<_fab> ah, ok, it's a flag for libc's open...
<karryall> yes
<_fab> so a flush is enough?
<Smerdyakov> Courtesy flush requested!
<karryall> I think so
<_fab> thanks
Zaius has quit ["Miranda IM! Smaller, Faster, Easier. http://miranda-im.org"]
smimou has quit ["?"]
platypus has joined #ocaml
tautologico has joined #ocaml
gim has quit ["dodo"]
wnewman has joined #ocaml
GreyLensman has joined #ocaml