dark_light 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/
danly is now known as RadicalMasculini
RadicalMasculini is now known as danly
pango_ has joined #ocaml
Skal has quit [Read error: 104 (Connection reset by peer)]
khaladan_ has joined #ocaml
pango has quit [Remote closed the connection]
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
khaladan_ has joined #ocaml
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
dark_light has quit [Remote closed the connection]
khaladan_ has joined #ocaml
khaladan has quit [Read error: 60 (Operation timed out)]
khaladan_ is now known as khaladan
love-pingoo has quit ["Connection reset by pear"]
sponge45 has joined #ocaml
danly has quit ["Leaving"]
llama32 has joined #ocaml
zak__ has joined #ocaml
llama32 has quit [Read error: 110 (Connection timed out)]
khaladan_ has joined #ocaml
zak__ is now known as llama32
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
ikaros_ has joined #ocaml
iZZy`` has quit [Read error: 110 (Connection timed out)]
Revision17 has joined #ocaml
dibblego has joined #ocaml
Revision17 has quit ["Ex-Chat"]
danly has joined #ocaml
Revision17 has joined #ocaml
sponge45 has quit ["zzzzzzzzzz"]
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
ramkrsna has joined #ocaml
Demitar_ has joined #ocaml
danly has quit ["Leaving"]
Demitar has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
MisterC has joined #ocaml
Skal has quit [Read error: 110 (Connection timed out)]
<seafood> Hi guys. I'm an Ocaml newbie. I've got a question about how to use modules and open.
<Mr_Awesome> im here
<seafood> Okay, so I have a file called "Expr.ml" which contains a few module type signatures and modules.
<Mr_Awesome> go on
<seafood> I fire up ocaml (the interactive shell) and want to use a particular module called, say X, which is inside Expr.ml
<seafood> How do I do this?
<seafood> The first thing I did was: open Expr
<seafood> But how do I instantiate the module X?
<Smerdyakov> #use "Expr.ml";;
<Smerdyakov> X.whatever;;
<Mr_Awesome> or
<Mr_Awesome> open X;;
<Mr_Awesome> whatever;;
<Smerdyakov> Mr_Awesome, no.
<Smerdyakov> Mr_Awesome, unless you also mean to include the #use.
<Mr_Awesome> what do you mean no?
<seafood> Ahah. Now it says "unbound module Var". Looking at Expr.ml reveals that it has "open Var" in it.
<Mr_Awesome> yes i did
<Mr_Awesome> is Var defined in Expr.ml?
<seafood> Mr_Awesome: Okay I sorted out my Var problem by specifying the right include paths with -I on the command line.
<seafood> I think I'm good to go. Thanks!
<seafood> Mr_Awesome: Hmmm. I'm getting problems with modules referring to other modules. Do I need to use multiple #use commands?
<seafood> #use "Expr.ml" is now complaining of "Reference to undefined global `Helpers'"
<Smerdyakov> seafood, if you're doing anything halfway serious, use the command-line compiler.
<Smerdyakov> seafood, for interactive experimentation, build libraries that you can load in one go.
<seafood> Smerdyakov: How do I do that?
<Smerdyakov> Read the manual.
<seafood> Smerdyakov: Will do
sponge45 has joined #ocaml
Smerdyakov has quit ["Leaving"]
khaladan_ has joined #ocaml
<seafood> Who's up still?
<seafood> I'd like to discuss the ocaml interactive environment and how it could possible be improved.
<seafood> Why couldn't it, in principle do exactly the same thing as ocamldep and load the dependencies itself?
<seafood> Why do I have to write #load "blah.cmo" declarations in the right order?
<Mr_Awesome> you can premake your own toplevel for quicker access
<Mr_Awesome> the toplevel isnt the most important tool in the ocaml suite though
khaladan has quit [Success]
khaladan_ is now known as khaladan
pango_ has quit [Remote closed the connection]
<sponge45> seafood, the problem of dependencies between libraries is addressed by findlib. The thing with modules is that you may choose between different libraries that implement the same module. That's a good thing I think, except that it doesn't solve your problem. Well, if you are using the toplevel for testing pieces of your program, then you can build a library (.cma) from the .cmos and/or a custom toplevel as suggested by Mr Awesom
setog3 has quit [Read error: 60 (Operation timed out)]
<flux__> infact I think toplevel indeed does solve the problem
<flux__> because it provides toplevel facilities
<flux__> so you want #require "library"
<flux__> s/want/can/
Ag_47 has joined #ocaml
Ag_47 has left #ocaml []
Mr_Awesome has quit ["and the Awesome Level drops"]
Revision17 has quit ["Ex-Chat"]
_fab has joined #ocaml
Revision17 has joined #ocaml
johnnowak has joined #ocaml
johnnowak has quit []
sponge45 has quit ["zzzzzzzzzz"]
rashnu has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
shawn has joined #ocaml
dibblego has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
Leonidas has joined #ocaml
<rashnu> any idea why this doesnt work? map(fun x -> let z3 = z3*x in z3)z4;; where z3 = 4 and z4 = [1;2;3]
<rashnu> output should be [4;8;24] and instead is [4;8;12]
<rashnu> z3 is not updating :\
<rashnu> n1 has any suggestions on how i could get z3 to update?
<flux__> well
<flux__> let z3 = .. isn't an assignment
<rashnu> what is it then?
<flux__> it's a binding. so z3 is whatever it is only in that context. in z3*x in .. - the latter z3 is the previous z3
<flux__> so you want to multiply each element with each other?
<flux__> times 4
<rashnu> yea
<flux__> then may I suggest this: List.fold_left (fun accu x -> accu * x) z3 z4
<rashnu> well, what really want to know is how i could keep z3 updated
<flux__> well, you could use references too, but it is doubtful you really require them
<flux__> then the code would go like let z3 = ref 4 in List.iter (fun v -> z3 := !z3 * v) z4
<flux__> and !z3 would refer to the value
<rashnu> hm..
pango has joined #ocaml
<rashnu> the fold_left function u gave returns the value of all of them multiplied, i was looking at a list
<rashnu> with all of them multiplied by the previous
<rashnu> hence my usage of map
<flux__> oh, well you can either write your own recursive function to do that or use fold_left (but it's a bit more complex)
<rashnu> so.. there's no way to use map?
<flux__> let (_, list) = List.fold_right (fun (accu, l) x -> (accu * x, x * accu :: l)) z3 z4
<flux__> I don't think so
<pango> (z3, [])
<flux__> right
bebui has quit ["leaving"]
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
<rashnu> is there a function to see the current nth of the list ur in?
<flux__> no
<pango> there's two reasons why List.map doesn't fit the job of a rolling product: 1. each element is considered in isolation 2. I don't think the List.map specifies the order in which elements are considered; So even if you work-arounded the first problem with an (ugly) reference, there's a (small) possibility that your code would break at a later date
llama32 has quit [Read error: 110 (Connection timed out)]
beschmi has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
<flux__> hmm.. I suppose it is more memory-efficient (thinking GC) to run 100 ocaml threads than run 100 ocaml processes, forked from a main proecss?
<pango> I'd say so too
<flux__> I apparently have some issues of ocaml threads stalling at times, and I can't track why..
<flux__> and I'm not proficient enough to use ocamldebug, all I do is 'run' and then it immediately stops at the List-module :)
<mellum> Well, IIRC ocaml does no locking by itself. So it's very easy to introduce bugs. Are you really sure you need threads?
<flux__> it would be a pain to convert it to not use threads
<flux__> I basically do message passing anyway, not real shared state
<flux__> the threads do many things and some things in sequence
<mellum> Well, then I'd probably use processes, just to make sure
<flux__> I suppose I could convert it to continuation passing style and then no non-threading, but even then I would basically do the threading myself..
<flux__> s/ no / to /
<flux__> but things that block (establishing network connections, performing database queries) would need to be handled also
<flux__> should I understand that ocaml threading is not considered stable?-o
<zmdkrbou> threads in ocaml work like *****
<flux__> the thing is that I also have my own message passing module there
<flux__> which could have a bug, although it doesn't appear to have :-)
<flux__> there is one quote in the net that the threading appears very stable (except inside the microsoft debugging environment the fellow had the problem)
khaladan_ has joined #ocaml
<beschmi> threading should be stable, xavier leroy is the same person who implemented linuxthreads (for kernel < 2.6)
<beschmi> i only had problems with bindings to c libraries, debugging threaded applications with ocamldebug (and threading bugs i introduced on my own)
<zmdkrbou> yes it should be stable, but it's really not :)
<flux__> I actually use postgresql bindings
<flux__> and had to patch it to release the global lock for PQexec (so long queries won't stop everything)
<flux__> however, I think the issue remains without that patch..
<beschmi> zmdkrdbou: it _is_ stable for me with only base libraries
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
<flux__> maybe I could use vmthreads
love-pingoo has quit ["Leaving"]
<flux__> is the only advantage of using native threads that they might be more c-library friendly?
<pango> the implementation of vmthreads requires more hacks than system threads :)
<flux__> atleast it would be less dependant on linux?-)
<flux__> I just recently learned that there are posix functions makecontext, getcontext, setcontext, etc
<flux__> which allow writing portable user-mode threading
<flux__> s/allow/enable/
khaladan has quit [Connection timed out]
khaladan has joined #ocaml
danly has joined #ocaml
Smerdyakov has joined #ocaml
bluestorm has joined #ocaml
_JusSx_ has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
smimou has joined #ocaml
khaladan_ has joined #ocaml
johnnowak has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan_ is now known as khaladan
triple_ has quit [Read error: 110 (Connection timed out)]
Leonidas is now known as ThomasWaldmannn
ThomasWaldmannn is now known as Leonidas
johnnowak has quit []
love-pingoo has joined #ocaml
setog3 has joined #ocaml
<setog3> hi all
<setog3> I want to solve equation with ocaml, but I don't know how to proceed, I have some equation like u_1 = k u_2 + v u_1 + 3 u_2 + 1 , u_2 = 2 u_3 +1 , and u_3 = 1 ; and I want the result u_3 = 1 ; u_2 = 3 ; u_1 = 3 k + 3 + 1 + v u_1
<setog3> and the last result u_1 = (3 k + 3 +1)/(1-v)
sponge45 has joined #ocaml
<setog3> so, wich type must I use ? must I use directly function ? does we have something like formel math in ocaml ?
sponge45 has quit [Remote closed the connection]
<love-pingoo> setog3: ocaml doesn't do that for you
<love-pingoo> you have to write the resolution procedure (of find somebody who did)
sponge45 has joined #ocaml
<setog3> ok , but which type must I use to define the expression ?
<setog3> must I use a tree ? a string ? something else ?
<love-pingoo> a string is certainly not convenient
<love-pingoo> you should define your own tree-like structure
<love-pingoo> type expr = Plus of expr*expr | Var of string | Mult of expr*expr | etc.
<love-pingoo> what about using matrices, actually ?
<setog3> yes !!!
<love-pingoo> the only tricky thing is to use Array.make_matrix and not Array.make (Array.make _ _) _ _
Demitar has joined #ocaml
MisterC has quit [Read error: 104 (Connection reset by peer)]
love-pingoo has quit ["Connection reset by pear"]
Demitar_ has quit [Read error: 104 (Connection reset by peer)]
<setog3> matrices is the best I think .. I only need to write the gauss methode and all is done
bluestorm is now known as bluestorm_aw
_fab has quit [Read error: 60 (Operation timed out)]
Demitar__ has quit ["Ex-Chat"]
Demitar has quit ["Ex-Chat"]
Demitar has joined #ocaml
Demitar has quit [Client Quit]
bluestorm_aw has quit [Remote closed the connection]
malc_ has joined #ocaml
Demitar has joined #ocaml
Demitar has quit [Remote closed the connection]
Demitar has joined #ocaml
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
malc_ has quit ["leaving"]
_JusSx_ has quit [Client Quit]
smimou has quit ["bli"]
<setog3> han it's difficult ..