hcarty changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
thrasibule has quit [Read error: 110 (Connection timed out)]
bohanlon has joined #ocaml
Alpounet has quit [Read error: 110 (Connection timed out)]
onigiri has quit []
BigJ2 has joined #ocaml
<BigJ2> can I use a local variable like this.....
<BigJ2> Let x = 1 and x_string = string_of_int(x) in print_string (x_string ^ " is the value of x. \n") ;;
<julm> BigJ2: yes but the x used to bind x_string will not be the x you've declared on the same line; however if you replace "and" with "in let" it will be that x
<BigJ2> julm: when I compile the line of code as I have it I get a syntax error right now
<julm> use "let" not "Let"
<BigJ2> the "and" creates multiple local variables that are outside the scope of one another?
<julm> yep, orthogonal definitions
<julm> unless you replace the first "let" by "let rec"
<BigJ2> Let x = 1 in x_string = string_of_int(x) in print_string (x_string ^ " is the value of x. \n") ;;
<BigJ2> can you see a problem with my syntax, I am still getting a compiler error...
<julm> BigJ2: let x = 1 in let x_string = string_of_int x in
<julm> print_string (x_string ^ " is the value of x. \n") ;;
<BigJ2> ahhh
<BigJ2> thank u
<julm> yw
<BigJ2> so if I was to continue multiple variable definitions I would need to declare let before each, except for the last function?
BigJ2 has quit []
<julm> each time a new variable depends on a previous variable yep.
marcot has quit [Read error: 60 (Operation timed out)]
jzmer has quit ["WeeChat 0.3.0"]
ertai has quit [hubbard.freenode.net irc.freenode.net]
tiz has quit [hubbard.freenode.net irc.freenode.net]
haelix has quit [hubbard.freenode.net irc.freenode.net]
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
det has quit [hubbard.freenode.net irc.freenode.net]
BigJ has quit [hubbard.freenode.net irc.freenode.net]
sgnb has quit [hubbard.freenode.net irc.freenode.net]
mehdid has quit [hubbard.freenode.net irc.freenode.net]
thelema has quit [hubbard.freenode.net irc.freenode.net]
rbancroft has quit [hubbard.freenode.net irc.freenode.net]
__marius__ has quit [hubbard.freenode.net irc.freenode.net]
th1 has quit [hubbard.freenode.net irc.freenode.net]
gim has quit [hubbard.freenode.net irc.freenode.net]
hyperboreean has quit [hubbard.freenode.net irc.freenode.net]
petchema has quit [hubbard.freenode.net irc.freenode.net]
Camarade_Tux has quit [hubbard.freenode.net irc.freenode.net]
tomaw has quit [hubbard.freenode.net irc.freenode.net]
bohanlon has quit [hubbard.freenode.net irc.freenode.net]
jonafan has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
aij has quit [hubbard.freenode.net irc.freenode.net]
schme has quit [hubbard.freenode.net irc.freenode.net]
fremo has quit [hubbard.freenode.net irc.freenode.net]
rwmjones has quit [hubbard.freenode.net irc.freenode.net]
Asmadeus has quit [hubbard.freenode.net irc.freenode.net]
mbishop has quit [hubbard.freenode.net irc.freenode.net]
bohanlon has joined #ocaml
jonafan has joined #ocaml
ertai has joined #ocaml
rwmjones has joined #ocaml
aij has joined #ocaml
Asmadeus has joined #ocaml
schme has joined #ocaml
fremo has joined #ocaml
mbishop has joined #ocaml
TaXules has joined #ocaml
BigJ has joined #ocaml
sgnb has joined #ocaml
det has joined #ocaml
haelix has joined #ocaml
Ori_B has joined #ocaml
tiz has joined #ocaml
tomaw has joined #ocaml
thelema has joined #ocaml
hyperboreean has joined #ocaml
petchema has joined #ocaml
gim has joined #ocaml
mehdid has joined #ocaml
Camarade_Tux has joined #ocaml
th1 has joined #ocaml
rbancroft has joined #ocaml
__marius__ has joined #ocaml
Alpounet has joined #ocaml
thelema_ has joined #ocaml
thelema has quit [Read error: 104 (Connection reset by peer)]
Alpounet has quit ["Leaving"]
Alpounet has joined #ocaml
slash_ has quit [Client Quit]
lambda22 has joined #ocaml
lambda22 has left #ocaml []
thrasibule has joined #ocaml
Alpounet has quit ["Leaving"]
thrasibule has quit [Read error: 110 (Connection timed out)]
Alpounet has joined #ocaml
Alpounet has quit [Client Quit]
Alpounet has joined #ocaml
Alpounet has quit [Remote closed the connection]
Alpounet has joined #ocaml
Alpounet has quit [Client Quit]
Alpounet has joined #ocaml
Alpounet has quit ["Leaving"]
verte has joined #ocaml
tvn2009 has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
verte has joined #ocaml
ulfdoz has joined #ocaml
ttamttam has joined #ocaml
ulfdoz has quit [Read error: 110 (Connection timed out)]
knight[rage] has quit [Remote closed the connection]
tvn2009 has quit ["Leaving"]
Submarine has joined #ocaml
albacker has joined #ocaml
flux has joined #ocaml
rjones has joined #ocaml
ski_ has joined #ocaml
rjones is now known as rwmjones_laptop
f[x] has joined #ocaml
ttamttam has quit ["Leaving."]
julm_ has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
_zack has joined #ocaml
<flux> goood morning!
<flux> still no clone of the Event-module for lwt?-(
<flux> because I saw one around, but can't find it anymore
<flux> (actually I'd prefer an asynchronous version of it; sync receives, async sends)
<sgnb> flux: you are referring to a react's Event clone?
<flux> perhaps
<sgnb> flux: for feature wishes / patch submission, you should ask on ocsigen mailing-list
<flux> an Event-module that is implemented in terms of the Lwt module
<sgnb> you need a scheduler somehow
<flux> why?
<sgnb> Lwt is about threads
<flux> I mean, everything is basically blocked to read always anyway, doesn't lwt handle things after that?
<sgnb> yes
<sgnb> the scheduler for I/O is basically Unix.select
<sgnb> but if you add arbitrary events, you'll have to schedule them
<flux> so lwt doesn't have support for that?
<sgnb> lwt has support for customizing the scheduler
<sgnb> (e.g. for use with gtk)
<flux> what can be done, is basically handle all pending messages before select
<sgnb> I think this can be done
<sgnb> see Lwt_main module
_zack has quit ["Leaving."]
<flux> but I am under the picture that this has already been done, because the module I'm talking about should exist already, I just can't find it :)
_zack has joined #ocaml
<sgnb> I don't understand what you want exactly
<sgnb> react in itself is already about interdependent events and signal that automagically update when something is changed
Yoric[DT] has joined #ocaml
<sgnb> (and is a dependency of lwt, btw)
<flux> basically I want to write this: let rec thread1 chan_in chan_out = sync (receive chan_in) >>= fun message -> send chan_out ("pong: " ^ message); thread1 chan_in chan_out let thread2 chan_in chan_out = send chan_out "first message"; sync (receive chan_in) >>= fun message -> send chan_out ("pong: " ^ message); thread2 chan_in chan_out let main () = run (fork thread1 >>= thread2)
<flux> (actually I'm able to write something very close to that, but the modules are proprietary)
<flux> (note that sends are not in the monad)
<flux> uh, it misses the creation of channels
<flux> but that should be like let a, b = new_channel (), new_channel () in ..
Yoric[DT] has quit [Client Quit]
<sgnb> send is not in the monad
<sgnb> but it's not blocking in itself
<flux> if could be if we followed the Event model
<flux> where the act of sending is synchronous
rwmjones_laptop has left #ocaml []
<sgnb> you can make it asynchronous by spawning a lwt thread when an event occurs
<sgnb> (I guess)
<flux> well, yes, but I've found asynchronous sends that are not inside the monad are useful too
<flux> that way the monad doesn't need to be present in functions that don't need to block
<sgnb> I said spawning lwt thread, but that could be any non-blocking function
<flux> I'm not actually that familiar with Lwt; can you create an lwt thread without being in the monad?
<sgnb> you can enter the monad whenever you want
<sgnb> you can exit it by blocking on all pending I/O
<sgnb> (not recommended)
<sgnb> (I said I/O, but whatever the scheduler uses)
<sgnb> there is also Lwt_preemptive, which allows use of preemptive threads for code that doesn't know about the monad at all
<flux> I'm thinking construct like List.iter (fun chan -> send chan "hello") [t1; t2; t3; t4] would work without any special magic :)
<flux> spawning an actual thread for that would constitute magic :)
Yoric[DT] has joined #ocaml
<sgnb> Lwt_util.iter would do that
<sgnb> (I guess)
<sgnb> its type is: ('a -> unit Lwt.t) -> 'a list -> unit Lwt.t
<sgnb> I really think you'll find more knowledgeable people on the ocsigen mailing-list (which acts also as the lwt mailing-list)
<flux> well, how would one do the same with Map.iter?
<flux> the point was that there are toons of functions that aren't Lwt-aware
<flux> tons, even
<sgnb> have a look at lwt_util.ml
<sgnb> you can do the same with any data structure
Submarine has quit [Remote closed the connection]
<mfp> flux: so you essentially want a queue that's polled by a Lwt thread?
<flux> mfp, that would be one characterisation of it, yes
<flux> mfp, of course the polling should happen more efficiently
<flux> sgnb, that can be done but only if you have access to the source code
<flux> sgnb, the Map was an example one something you'd need to take out from the ocaml sources, patch, and if you don't stick it back to the compiler the data structure won't be compatible with proper ocaml maps
<flux> but, here's something completely different. I wrote a web page for ganame: http://modeemi.cs.tut.fi/~flux/software/ganame/
<flux> it's a file renaming tool based on genetic algorithms
<mfp> flux: what's wrong with Map.iter (fun k v -> ignore_result (whatever k v)) m ? where (whatever : 'a -> 'b -> unit Lwt.t) ?
<flux> mfp, so that works? I was under the assumption it's difficult to interact with the Lwt system if you are not in the monad
<sgnb> mfp: you won't have a way to determine when all threads will be done
<sgnb> however, you can use fold to achieve this
<mfp> right
<sgnb> flux: it depends on what you want to do
<mfp> flux: that's the way to spawn a "background" Lwt thread (you probably want to wrap whatever to catch exceptions & report them somewhere, though, the same way they're handled in regular Threads)
<sgnb> in lwt, spawing is ignoring :)
<sgnb> s/spawing/spawning/
<mfp> "Thread 1 killed on uncaught exception xxx"
<mfp> I noticed that ignore_result wasn't defined as = ignore though
<ski_> sgnb : is there an operation of type (unit -> 'a Lwt.t) -> 'a Lwt.t ?
<mfp> it had some additional code to rethrow exns IIRC
<mfp> ski_: let exec f = f () ? :-)
<ski_> hm .. fun thunk -> Lwt.return () >>= thunk i suppose
<sgnb> yes
<mfp> isn't Lwt.return () >>= f the same as f () anyway? (1st monad law)
<ski_> the latter might be more strict, i was thinking
<flux> well, real ocaml exceptions are outside the monad laws?
<mfp> but () is not _|_ anyway
<flux> my original question still remains: where can I find the Event-module for Lwt?-)
<sgnb> I sill don't know what you are referring to by "Event-module"
<flux> the Event-module that comes with the ocaml distribution..
<sgnb> oh... that one!
<flux> yes :)
<flux> because it doesn't seem to me there is a good mechanism for interthread communication in Lwt?
<sgnb> there is Lwt_mvar
<sgnb> or Lwt_monitor
<flux> that's apparently some new one, because my lwt in ubuntu 9.04 doesn't have it
BigJ2 has joined #ocaml
<flux> in any case, Event is superior to those ;)
<flux> (if what you need to do is pass messages)
<sgnb> I would say Event is less useful with Lwt
BigJ2 has quit [Client Quit]
<flux> really? what do you use instead of it?
<sgnb> bind
<flux> >>= ?
<sgnb> yes
<flux> hmm..
<sgnb> bind already achieves some kind of inter-thread communication
<flux> have you used Event-module before?
<sgnb> no
<flux> doesn't bind simply sequence operations?
<sgnb> it sequences them, but you can pass also values
<flux> yes.. but I don't see how that replaces what Event module does..
<sgnb> if your data flow is a DAG, you can use bind
<flux> well, Event module doesn't require that
<sgnb> in practice, that's all I need
<flux> indeed if your data flow is DAG, what do you need LWT for? can't you just use lazy?
<sgnb> and for something more elaborated, Lwt_monitor seems apropriate
<sgnb> lazy doesn't allow you to specify scheduling
<sgnb> lazy doesn't interleave I/O
<sgnb> but yes, otherwise it seems similar
<sgnb> and you need to Lazy.force something to use it in another lazy... and that Lazy.force call will be blocking
* ski_ returns from phone
<ski_> sgnb : "use it in another lazy", elaborate ?
<sgnb> Lwt.bind and (fun x f -> lazy (Lazy.force x)) have the same type
<flux> what you can do with Event module is this: Event.select [receive source1; receive source2; receive source3] >>= function | ConstructorFromSource1 _ -> ..
<sgnb> but they have very different behavious
<sgnb> behaviours
<flux> (actually that was already with an invented monadic syntax)
<flux> I'm not sure how you would do the same with Lwt
<ski_> sgnb : surely you're missing an `f' somewhere in there ?
<flux> so receive from multiple message sources and react to the first received message
<sgnb> flux: and how is that differnet from Lwt.select?
<flux> well, my lwt doesn't have it, for one :)
<flux> version 1.1.0 apparently
<sgnb> flux: there are *a lot* of improvements in the new lwt
<sgnb> (that's why we've jumped from 1.1 to 2.0)
<sgnb> flux: I can have one version for you in my PPA, if you want
<sgnb> ski_: of course, I meant (fun x f -> lazy (f (Lazy.force x)))
<flux> indeed, lwt 2.0.0 appears to address a lot of my concerns
<sgnb> and btw, there is already Lwt.choose in your version
<sgnb> (but its semantics is slightly different)
<ski_> sgnb : is there a manual for 2.0.0 online somewhere ?
<sgnb> ski_: I'm afraid not (yet)
<sgnb> we still need to work the documentation
<ski_> (<https://ocsigen.org/docu/2.0.0/Lwt.html> doesn't appear to actually contain any signature info ..)
<ski_> ok
<sgnb> but there are ocamldoc comments everywhere
<sgnb> (in mli files)
<sgnb> the ocamldoc documenation on the website is not updated yet
<ski_> sgnb : i suppose a reason i asked was you seem to have various operations that take a value of type unit -> 'a Lwt.t as argument .. where i assume 'a Lwt.t would suffice given such an operation
<ski_> .. but possibly this is for convenience reasons ?
<ski_> ("such an operation" being one of type (unit -> 'a Lwt.t) -> 'a Lwt.t i.e.)
<sgnb> ('a -> 'b Lwt.t) is the most generic type of functions that composes well with everything
hkBst has joined #ocaml
<sgnb> (unit -> 'a Lwt.t) -> 'a Lwt.t can do much more than 'a Lwt.t -> 'a Lwt
<sgnb> a value of type 'a Lwt.t represents a thread already started
<sgnb> with (unit -> 'a Lwt.t), you can choose when to start the thread
<ski_> can't you do that with Lwt.return () >>= thunk as well ?
<sgnb> you can think of bind as an apply function that composes well with threads
<sgnb> "that" refers to what?
<ski_> (you'll have to excuse me if i ask stupid questions. this is the first time i've seen Lwt, and i'm trying to understand what it does)
<ski_> "that" refering to "you can choose when to start the thread"
<sgnb> [Lwt.return () >>= thunk] is equivalent to [thunk ()]
<sgnb> thunk has still the type unit -> Lwt.t
<ski_> i probably have to read up more on the documentation, before being able to ask coherently
<ski_> (ty, anyway)
<ski_> (i'm happy to see Lwt.try_bind anyway)
animist has joined #ocaml
<flux> sgnb, with ignore_result (blahblah); ignore_result (foifoi); am in any way guaranteed about the order of (beginning) those two operations?
<sgnb> it depends on what you mean by "beginning"
<sgnb> in the strict sense, yes
<sgnb> the ordering is the same as ocaml
<sgnb> but if your thread starts immediately by doing a blocking operation (i.e. I/O) that cannot be performed immediately, then it will be delayed
<sgnb> if you need some ordering, you'll have to use bind somehow
Associat0r has joined #ocaml
_zack has quit ["Leaving."]
onigiri has joined #ocaml
Associat0r has quit []
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
hkBst has quit [Remote closed the connection]
komar_ has quit [Read error: 110 (Connection timed out)]
Alpounet has joined #ocaml
kadee has joined #ocaml
bohanlon_ has joined #ocaml
Anarchos has joined #ocaml
jonafan_ has joined #ocaml
bohanlon has quit [Success]
bohanlon_ is now known as bohanlon
onigiri has quit []
jonafan has quit [Read error: 110 (Connection timed out)]
Alpounet has quit ["Leaving"]
kadee has left #ocaml []
BiDOrD has joined #ocaml
Alpounet has joined #ocaml
BiDOrD has quit [Read error: 104 (Connection reset by peer)]
BiDOrD has joined #ocaml
tobij is now known as churchill
komar_ has joined #ocaml
Anarchos has quit ["Vision[0.9.7-H-090423]: i've been blurred!"]
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
<orbitz> harrop <3 hashtables
<thelema_> orbitz: apparently.
thelema_ is now known as thelema
<orbitz> when it comes down to bashing ocaml he seems to default to taht
<orbitz> IMO ocaml's horrible stdlib is a much better targe
<thelema> ocaml's hashtables are poor in a number of ways. But they're not bad for many uses.
julm_ is now known as julm
thelema_ has joined #ocaml
Alpounet has quit ["Leaving"]
Alpounet has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
Alpounet has quit [Read error: 113 (No route to host)]
alp_ has joined #ocaml
alp_ has quit [Client Quit]
noj has quit [Remote closed the connection]
noj has joined #ocaml
Alpounet has joined #ocaml
thrasibule has joined #ocaml
ttamttam has joined #ocaml
Alpounet has quit ["Leaving"]
Alpounet has joined #ocaml
julm has quit [Read error: 113 (No route to host)]
Submarine has joined #ocaml
ttamttam has quit ["Leaving."]
<palomer> ouch, jon's last reply is interesting
<mfp> "OCaml's data representation strategy that is optimized for Xavier's Coq" hmm
<orbitz> a littl einuendo in there
<Alpounet> a nice one :-)
ski_ has quit ["Lost terminal"]
<thelema_> There's some truth to the idea that most people do best at scratch their own itches.
<orbitz> do you guys think INRIA is too conservative when it comes to advancing the implementation?
<thelema_> I think the community is too little involved in advancing ocaml
<thelema_> mainly ocaml the language and ocaml the compiler
<thelema_> in other areas, the community is reasonably involved.
<det> Doesnt the Ocaml license forbid forks ?
<orbitz> can it? othewise how would we have jocaml or oc4m or whaever it's called
<thelema_> no, it doesn't forbit forks, it just makes them difficult -- QPL
<thelema_> and it keeps inria in control of the base distribution - QPL makes it hard to build off a fork.
<det> Well, this is similar to what killed qmail
<Alpounet> anyway, the mainstream distribution will never advance significantly IMO
<thelema_> I am seeing it killing ocaml
<Alpounet> indeed
<orbitz> maybe jane st will fork :)
<thelema_> they are part of the ocaml consortium - they have an internal fork (maybe), and would piss off the rest of the consortium by forking.
<thelema_> jane street won't fork.
<orbitz> dang
<orbitz> what is the difference bewteen GHC and Ocaml? GHC seems to hav eno problem advancing like crazy, and they seem stable. is GHC a mess in reality though?
<thelema_> license - GHC isn't QPL
<orbitz> is GHC more open to patches?
<thelema_> GHC has contributors all around the world - ocaml has contributors ... at INRIA (and a few people who used to work at INRIA)
<thelema_> yes, GHC is *much* more open to patches
<schme> I thought ocaml already got forked off into F#
ulfdoz has joined #ocaml
Smerdyakov has joined #ocaml
<thelema_> schme: kind-of, yes.
<Alpounet> maybe it's "their local fork" :p
<det> schme, that's not a fork
<det> schme, that is an implementation of a language that shares many similarities
<thelema_> I doubt there's any codebase
<thelema_> and I don't think the implementation is open source.
<thelema_> s/codebase/shared codebase/
<det> last I heard, the F# compiler was still planed to use MS's open source license (GPL compatible)
<thelema_> det: ok, I wasn't sure.
<det> who knows if it will actually happen
<thelema_> oh, planned.
<orbitz> F# still has some nastyness last i heard
<orbitz> the type system isn't quite as powerful
<thelema_> yes, which is why I'm not using it.
<orbitz> and you can sitll get null pointers
<thelema_> well, mostly the null values
<orbitz> I forgot who said it, but someone told me that they compared F# to C# and found that C# had gotten most of the useufl functional niceities in F# so they didn't see a point in F#
<det> I hear the type inference is also weak
<det> C# is actually pretty good
<orbitz> C# even suggests usign Nullable<T>
<orbitz> and with lambda/closures you can lift with it
<orbitz> which is pretty sweet
<det> Nullable<T> is only for value types
<orbitz> what does that mean det?
<det> you cant have a Nullable<string>, for example
<orbitz> oh that stinks
<orbitz> too bad
<det> value type means things like int, char, bool, etc
<orbitz> It does sound liek MS is trying to reallya dvance C# though, I wish they would open it up to the rest of the world more
<orbitz> i would probably use it over Java if there was a decent *NIX impl
<det> well, mono isnt the greatest ...
<det> mono doesnt even have a proper garbage collector
derdon has joined #ocaml
<det> Nullable isnt as nice as an Ocaml option
<det> because no pattern matching
<sgnb> the OCaml license doesn't pose problem as long as your fork remains free
<thelema_> it really does - source code distribution as INRIA-ocaml + patches is ugly
<sgnb> a patch is easy to generate with any decent VCS
<sgnb> people use a VCS while developing anyway
<sgnb> you need to make patches for releases
<sgnb> (see ocamlduce)
<thelema_> true, but you technically can't make your VCS tree public, as that would be distributing source in a form not partitioned.
<sgnb> I don't think INRIA will sue you if you make your VCS tree public
<sgnb> a VCS is just a way to present patches
<det> it is a way to present source
<det> and maintain history and coordinate merges
<sgnb> the spirit of the license is to keep any derivative's source code open
<thelema_> IIRC, I had this discussion with Xavier(?) on caml-list, and he said as much. They're not planning on suing, but it's technically in breach of license if that tree is public.
<det> no it's not
<det> if that were true, it would be GPL
<sgnb> det: GPL has no legal value in France
<det> maybe so
<sgnb> now, CeCILL would be the first choice
<det> but their license explicitly disallows distributing modified source under any license
<orbitz> use darcs then :)
<orbitz> automated patch application software
<sgnb> put even GPL is painful in its own way
<thelema_> GPL is fine for a compiler.
<sgnb> (but IMHO necessary)
<sgnb> (BSD/MIT is way too permissivec)
<schme> Dunno what is too permissive about it.
<derdon> when do I need references?
<sgnb> derdon: rarely
<sgnb> derdon: avoid them if you can
<derdon> sgnb: okay, I already thaught so. and when do I *need* them?
<orbitz> derdon: the Stream api is kin dof weak, if you plan on modifying data in it you migh tned a refrence
<derdon> can I make the execution of my scripts faster with using references?
<orbitz> maybe? probably hard to predict
<Smerdyakov> derdon, OCaml without references is Turing-complete.
<thelema_> derdon: depends on what you're doing. Using references may allow a different algorithm with less allocation.
<Smerdyakov> The OCaml runtime system tends to be slow when it comes to references. (Which is counterintuitive to the "imperative = fast" way of thinking)
<derdon> are references in OCaml comparable to pointers in C?
<sgnb> derdon: no
Amorphous has quit [Read error: 104 (Connection reset by peer)]
<sgnb> derdon: references have their inefficiencies of their own
<sgnb> there are a lot of places where using tail-recursive function is just better
<derdon> I don't understand what references are :(
<sgnb> but indeed, in some rare case (e.g. queues / doubly-linked lists), you have to use references
<sgnb> references are cells of mutable data
<sgnb> they are what is called "variable" in C
<derdon> what are "cells" in this case?
<sgnb> what are called "variable" in caml are just aliases
<Smerdyakov> sgnb, that's not accurate.
<Smerdyakov> sgnb, C variables aren't first-class.
<sgnb> Smerdyakov: hu?
<derdon> you're confusing me
<Smerdyakov> derdon, have you read the tutorial in the OCaml manual?
<Smerdyakov> sgnb, you can't write a C function that accepts a variable as argument or returns a variable.
<sgnb> derdon: think of caml variables as aliases
<derdon> Smerdyakov: only the first chapter. actually, I prefer an openbook from O'Reilly
<sgnb> derdon: think of caml references as variables in C (i.e. you can change their value)
<Smerdyakov> derdon, I think Jason Hickey's book is the best.
<derdon> sgnb: so ocaml variables are immutable?
<schme> derdon: let x = 1 ;; and you're stuck with 1
<schme> so it is like one would expect things to behave (:
<derdon> but I can change the *content* of the varaible if this type supports it
<det> Ocaml doesn't have variables
<orbitz> schme: let x = 1 in let x = 2 in x !!!
<derdon> det: what does it have then? names and values?
<Smerdyakov> OCaml has a syntactic construct called "variables."
<det> # let i = 1;;
<det> val i : int = 1
<det> # let f x = i + x;;
<det> val f : int -> int = <fun>
<det> # let i = 1000;;
<det> val i : int = 1000
<det> # f 5;;
<det> - : int = 6
<derdon> orbitz: Warning Y: unused variable x.
* Alpounet misses mlbot
<Smerdyakov> derdon, seriously, if you have only read the first chapter of the OCaml intro that you're using, then you're not well served by trying to learn by asking questions here.
<schme> derdon: and changing the *content* is where references come in.
<derdon> Smerdyakov: yes, you're right. shame on me!
robocop has joined #ocaml
<robocop> hello
<robocop> I've got a question with batteries : how use the module Numeric and the function of_string ?
<robocop> I'm trying : Numeric.of_string "5", but I've got a : Unbound value of_string
Amorphous has joined #ocaml
Smerdyakov has quit ["Leaving"]
slash_ has joined #ocaml
<thelema_> Numeric just defines module types, iirc
<thelema_> what kind of value do you want - int, int32, int64, bigint?
Alpounet has quit [Remote closed the connection]
<orbitz> robocop: the specific module has an .of_string i believe
<thelema_> robocop: ping?
<thelema_> robocop: try Int.of_string
Smerdyakov has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
<robocop> re
<robocop> ha okey !
<robocop> thanks a lot thelema_
<robocop> okey, Num.of_string "5" works
<robocop> but, if I want to add two Batteries.Num.num, how I can do ?
<robocop> # (Num.(+)) (Num.of_string "5");;
<robocop> - : Batteries.Num.num -> Batteries.Num.num = <fun>
<robocop> ok
<orbitz> you figure it out robocop ?
Submarine has quit [Remote closed the connection]
<robocop> yep :)
<robocop> thelema_: I can't get the syntax like a + b isn't it ?
<robocop> okey :p
onigiri has joined #ocaml
<Camarade_Tux> for those curious about ocaml-gir (my binding generator for glib2-based libraries), have a look at http://ocaml.pastebin.com/m2efa2df (ditch the "WARNING" line), it's the output of a run for dbus-glib, it show the missing part is GType, GObject, GQuark... which support should be done through lablgtk2
<Camarade_Tux> hcarty: ^^
julm has joined #ocaml
eni_ has joined #ocaml
albacker has quit [Nick collision from services.]
eni_ is now known as albacker
eni_ has joined #ocaml
eni__ has joined #ocaml
eni_ has quit [Read error: 60 (Operation timed out)]
albacker has quit [Read error: 110 (Connection timed out)]
Alpounet has joined #ocaml
<orbitz> "However, HLVM is currently missing some core features. Most notably,
<orbitz> polymorphism and a parallel GC. "
<orbitz> those are 2 pretty biggies arne't they...
Submarine has joined #ocaml
f[x] has quit [Read error: 110 (Connection timed out)]
<Alpounet> yes
<Alpounet> but since I've participated to HLVM
<Alpounet> I can tell you that there already is a significant work behind
<Smerdyakov> HLVM will never support dependent types! :D
<Alpounet> unlikely to, indeed, Smerdyakov :-)
<Smerdyakov> Or, at least, not support the style that type theory people want.
<Alpounet> by the way, Harrop doesn't care for such stuffs.
julm has quit [Read error: 110 (Connection timed out)]
<Alpounet> He wants to have a sort of OCaml with an LLVM backend, with good performances and multicore capabilities
<Smerdyakov> I'm not surprised. I think that proof-carrying code is key to future software systems.
<Alpounet> I'd also enjoy that, but the industry is *DEFINITELY* not ready (yet, and for a long time IMO) for putting efforts in adopting such practices.
<Smerdyakov> All the better for those of us equipped to found start-ups based on this stuff.
<Alpounet> Good luck to get fundings :-)
julm has joined #ocaml
<bluestorm> At least, proof-carrying code research is freely available out there
<bluestorm> while HLVM tutorial/introduction/documentation is not
<Alpounet> why are you comparing proof-carrying code research and HLVM ? o_O
<orbitz> Smerdyakov: how is your startup coing?
<Smerdyakov> Because I claim any useful intermediate language must be suitable for encoding arbitrary properties of code.
<Smerdyakov> I mean not just the properties, but their proofs, too.
<Smerdyakov> orbitz, all-right-ish. I'm more in research mode for the next few months. I'm looking for people to implement non-trivial examples, to provide evidence that the new metaprogramming features are good.
<Alpounet> Smerdyakov, I doubt Harrop is thinking about integrating that. But it could be feasible.
<Smerdyakov> Alpounet, it will not be feasible without a lot of work that wouldn't have been done otherwise.
<Smerdyakov> Alpounet, HLVM probably hardcodes a set of types, whereas I want all types to be defined from first principles.
<orbitz> Smerdyakov: is your start up making a end user product where the users are not developers, or is it making products for developers to writ ebetter code, or something else?
<Smerdyakov> orbitz, top secret!! :D
<orbitz> dam you!
* orbitz tracks you down in boston next time i'm there
<Alpounet> Smerdyakov, yeah. But it isn't of any interest for Harrop for the moment.
<Alpounet> I mean in industry people are mostly like Harrop.
<Alpounet> Efficiency, quick development.
<Alpounet> Just look at mainstream languages.
<orbitz> i get into bruhahas at work because i try to instill in people that java makes you write shit, nobody listens :(
<orbitz> :`(
<Smerdyakov> "Efficiency" and "quick development" are not at all at odds with PCC.
<Smerdyakov> In fact, I think Foundational PCC supports _both_ goals better than current methods.
<orbitz> Smerdyakov: it is if you don't understand it
<Smerdyakov> You can ship safe programs that use new code generation techniques and optimizations; you just need to prove that you did it right.
<Smerdyakov> And this freedom makes it easier to use new programming languages, because you have freedom in how you implement them, without needing to worry about primitive bytecode verifiers rejecting your fancy new binaries.
<orbitz> IMO it is unrealistic to assume your average developer is any more intelligent or interested in their craft than your average plumber
<Smerdyakov> orbitz, did I say anything to the contrary?
<orbitz> how many plumbers do you know that are intersted in listening to how to make their plumbing safer when they feel they are doing fine now?
<bluestorm> Smerdyakov: I'm not sure usable tools are out there to produce interesting proofs about your program with only a reasonable (small) effort
<Smerdyakov> Why do I care?
<Smerdyakov> bluestorm, I _am_ sure. This is what I've worked on since 2003.
<bluestorm> hm
<orbitz> my point is your goal is well and good, i just don't think most programmers care nor see teh value. i was under the impression we were talking about how to get your ideas accepted and used
eni__ has quit [hubbard.freenode.net irc.freenode.net]
jonafan_ has quit [hubbard.freenode.net irc.freenode.net]
tiz has quit [hubbard.freenode.net irc.freenode.net]
haelix has quit [hubbard.freenode.net irc.freenode.net]
det has quit [hubbard.freenode.net irc.freenode.net]
Ori_B has quit [hubbard.freenode.net irc.freenode.net]
sgnb has quit [hubbard.freenode.net irc.freenode.net]
ertai has quit [hubbard.freenode.net irc.freenode.net]
BigJ has quit [hubbard.freenode.net irc.freenode.net]
julm has quit [hubbard.freenode.net irc.freenode.net]
Alpounet has quit [hubbard.freenode.net irc.freenode.net]
onigiri has quit [hubbard.freenode.net irc.freenode.net]
Amorphous has quit [hubbard.freenode.net irc.freenode.net]
schme has quit [hubbard.freenode.net irc.freenode.net]
fremo has quit [hubbard.freenode.net irc.freenode.net]
mbishop has quit [hubbard.freenode.net irc.freenode.net]
TaXules has quit [hubbard.freenode.net irc.freenode.net]
Asmadeus has quit [hubbard.freenode.net irc.freenode.net]
aij has quit [hubbard.freenode.net irc.freenode.net]
rwmjones has quit [hubbard.freenode.net irc.freenode.net]
tomaw has quit [hubbard.freenode.net irc.freenode.net]
mehdid has quit [hubbard.freenode.net irc.freenode.net]
rbancroft has quit [hubbard.freenode.net irc.freenode.net]
__marius__ has quit [hubbard.freenode.net irc.freenode.net]
th1 has quit [hubbard.freenode.net irc.freenode.net]
gim has quit [hubbard.freenode.net irc.freenode.net]
hyperboreean has quit [hubbard.freenode.net irc.freenode.net]
petchema has quit [hubbard.freenode.net irc.freenode.net]
Camarade_Tux has quit [hubbard.freenode.net irc.freenode.net]
<Smerdyakov> That's OK. Most programmers shouldn't be programming, and I'm glad to find incidental ways to nudge them out of the profession.
<orbitz> fair enough
<Smerdyakov> Also, I get the feeling that you aren't very familiar with PCC.
<bluestorm> Smerdyakov: are you talking about your research, or other hidden startupy things I have no information about ?
<Smerdyakov> Its use requires no more expertise from most programmers than use of new OS implementation strategies does.
<Smerdyakov> bluestorm, research
<bluestorm> ok
<Submarine> Smerdyakov, howdie
julm has joined #ocaml
Alpounet has joined #ocaml
eni__ has joined #ocaml
onigiri has joined #ocaml
Amorphous has joined #ocaml
jonafan_ has joined #ocaml
__marius__ has joined #ocaml
rbancroft has joined #ocaml
th1 has joined #ocaml
Camarade_Tux has joined #ocaml
mehdid has joined #ocaml
gim has joined #ocaml
petchema has joined #ocaml
hyperboreean has joined #ocaml
tomaw has joined #ocaml
tiz has joined #ocaml
Ori_B has joined #ocaml
haelix has joined #ocaml
det has joined #ocaml
sgnb has joined #ocaml
BigJ has joined #ocaml
TaXules has joined #ocaml
mbishop has joined #ocaml
fremo has joined #ocaml
schme has joined #ocaml
Asmadeus has joined #ocaml
aij has joined #ocaml
rwmjones has joined #ocaml
ertai has joined #ocaml
<bluestorm> btw., was there not a Coq book you were writing or something ?
<bluestorm> I'm considering learning Coq by myself this year, and would possibly be interested
* Smerdyakov leaves for a few hours.
<Smerdyakov> Submarine, hi. ;)
<bluestorm> thanks
<orbitz> Smerdyakov: you are right, i have no knowelge of PCC
erickt has quit [Read error: 110 (Connection timed out)]
erickt has joined #ocaml
bluestorm has quit [Remote closed the connection]
<BigJ> what is the difference between declaring a local variable using in vs and?
<flux> bigj, you mean versus let a = 4 and b = 5 in .. vs let a = 4 int let b = 5 in .. ?
<flux> bigj, well, it only matters in a few cases
<flux> bigj, for example: let foo a b = let a = b and b = a in Printf.printf "a=%d, b=%d\n" a b
<flux> bigj, another case is using the keyword 'rec', which allows mutually recursive functions
<BigJ> flux yes
<flux> in general I use 'in' unless I need to have recursive definitions
<flux> I suppose it's just a matter of taste
<flux> also, you cannot do this: let a = 5 and b = a + 5 in ..
<flux> you must do: let a = 5 in let b = a + 5 in ..
<flux> (because the bindings of a 'let' come into your scope only after the let-expression, with the exception of 'let rec')
<BigJ> ok, thanks.
<BigJ> which paradigm do you mostly program in, in ocaml?
<flux> you mean functional, imperative or object-oriented?
<BigJ> ya
<flux> it depends, but in the small I use functional; in the large there may be some imperative traits, or the if the problem fits it, I may use objects.
<flux> at times I've also used objects for merely organizing program structure
<flux> it can be useful if many parts of your programs interact with many other parts
<flux> well, useful and useful.. it can be convenient
<flux> be aware that object oriented programming in ocaml is something I consider an advanced subject, though
<flux> using it can produce unexpected compiler error messages if you don't know what's going on.. and I'm pretty sure there are still be things in it I still don't master ;).
<BigJ> is it possible to combine each type within a program or if you write a program is one going to be stricly function, one strictly imperative, and the other stricly object oriented?
<flux> it depends on the program
<flux> for example it might have algorithms that are imperative (use arrays) just for the sake of efficiency
<flux> in the small (so the most of your code, small functions using other small functions) you would always be expected to write in a functional fashion
<flux> (although I lately broke this code when writing ganame..)
<flux> making modules interact with each other in complicated ways can be difficult without the use of other concepts, such as Monads
<flux> which are great, and you should learn them too, btw
<flux> but otherwise one might end up using side effects. and I don't think it's all bad, it can be very light from the readability and "type weight" point of view.
<Camarade_Tux> flux: have you planned making ganame support id-tags? I have a bunch of files to process :D
<flux> camarade_tux, what a coincidence, it's mentioned in the TODO-file as first items I think. in Finnish, though :-)
<Camarade_Tux> flux: btw, the link titled "Berke Durak's O'Caml software page" in ganame.html is borken (points to itself)
<flux> yes..
<Camarade_Tux> flux: well, I hadn't read the TODO yet but now it's like I hadn't read it either ><
<Camarade_Tux> flux: also, you can't put anything in PD in France on your own (beside killing yourself and waiting a few decades)
<flux> the link was missing from <a..>, thanks
<flux> is berke durak a french name?
<Camarade_Tux> not really but I think Berke is French
<flux> actually I misread the page. but it indeed does say that " Here are a few fragments of raw public-domain Ocaml programs.
<flux> "
<flux> (I remembered only the first sentence, which said " Small Ocaml modules or programs. Feel free to use or adapt them. For convenience, I have placed most of them in the public domain.
julm has quit [Remote closed the connection]
<flux> " and was open to intepretation because it didn't indicate which were PD and which not)
julm has joined #ocaml
<Camarade_Tux> but yes, he's french
<flux> in any case, maybe I'll replace the levenstein with some other cost function, because it's taking a big chunk of cpu time :)
<Camarade_Tux> he ;p
<Camarade_Tux> for the record, I'm advising people against PD whenever I encounter it, it only really exists in anglo-saxon right so it's pretty annoying (I mean putting it by yourself)
<Camarade_Tux> you can just use the wtfyw licence :)
<flux> in any case, if the owner of the rights thinks its PD, but in reality it cannot be, can anyone else but the author sue?
<Camarade_Tux> yeah, the result is just something weird you probably won't have trouble with but you can't be sure about
<flux> actually the LGPL3 genepool library that annoys me more
<flux> because of the problem with LGPL and O'Caml
<flux> but in general it's nice and simple library, so I don't think I have other practical needs to reinvent it
<Camarade_Tux> ah, actually it's not wtfyw but dwtfyw
<Camarade_Tux> flux: true that license is more annoying
Submarine has quit [Client Quit]
<flux> maybe a special chapter about the issue should be written by Someone to the ocaml-tutorial.org site, so future ocaml developer would learn about it and avoid the issue :P
<flux> too bad it's not often one finds people willing to give legal advice on the net ;)
<Camarade_Tux> ianal ;-)
<flux> camarade_tux, how do you think the id3-tag support should work, then?
<Camarade_Tux> hmmm, magic? xD
<flux> camarade_tux, I think in practical terms it would need some %ID or similar tags.. unless your example files actually exist and you can give examples in terms of those
<Camarade_Tux> I have gigabytes of badly tagged/named files
<Camarade_Tux> (actually more like >100GB)
<flux> ganame FOO.MP3="Ode to joy.mp3" BAR.MP3="Staying alive.mp3" -- *.MP3 could actually work, if you provided exactly the right examples
<flux> (and there was id3 tag support)
robocop has left #ocaml []
<flux> I too have some mp3s to sort, but I'm not confident ganame is the right tool for it ;)
<Camarade_Tux> I'd run everything on backups or wouldn't right for now ;)
<Camarade_Tux> or have ganame make a guess and ask you to validate or not
<flux> ganame makes guesses, and it can fail to find a program
<flux> however, once it does find one, it will list all results and ask you to commit
<Camarade_Tux> and for music, it'd be really better to have it take a look at the filename too
<flux> (too bad it's impossible to manually enter the program or otherwise reuse it)
<Camarade_Tux> marshall? is it a closure?
<flux> it's a sum type
* Camarade_Tux should get the source for when he loses internet access
<Camarade_Tux> I don't know how it looks like but sexplib could be nice
<flux> I can convert it to a string, the reverse part is missing
<flux> I'm hoping camlp4 could help me a bit with this
<flux> yes, sexplib could work, but I'm hoping something that'd also help in randomly generating and mutating the structures
<flux> camarade_tux, I think the problem with renaming MP3's is that in general there's no pattern in it..
<flux> camarade_tux, however, I've heard this works: 1) use a tool that for files that lack an id3-tag generate one from the filename 2) rename all files using some tool that just uses the id3 tag information and disregards the file name
<Camarade_Tux> true, and earlier today I was listening to Noir Désir's 666,667 Club, I don't know how
<Camarade_Tux> this could be treated
<Camarade_Tux> flux: he, could work
<Camarade_Tux> woot, ganame can decode 1337-sp34k ^^
<Camarade_Tux> (well, almost)
infoe has joined #ocaml
<infoe> hello
<Camarade_Tux> hi infoe
<flux> camarade_tux, I added a simple mapping feature because a guy on another channel said it didn't work ;)
<Camarade_Tux> flux: haha ^^
<flux> camarade_tux, (it generates a mapping for each example per the character index, so abc=123 maps a=1, b=2, c=3 etc)
M| has quit [Read error: 131 (Connection reset by peer)]
thrasibule has quit ["No Ping reply in 180 seconds."]
thrasibule has joined #ocaml
zaemis has joined #ocaml
thrasibule has quit [Read error: 60 (Operation timed out)]
BigJ has quit [Read error: 60 (Operation timed out)]
M| has joined #ocaml
julm_ has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
<derdon> what is the best way to print a float array?
eni__ is now known as albacker
zaemis has left #ocaml []
<Alpounet> Array.iteri ?
albacker has quit ["Leaving"]
<derdon> thanks, but I Array.iter is what I was looking for :)