flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
<Proteus_> yeah
<psnively> Interesting.
<psnively> OCaml already has several FFIs, y'know. :-)
<Proteus_> yeah, but it would be hell to write the quantity required for a full binding to ogre.
<det> You can bind-as-you-go
<Proteus_> yeah, that's what I'm planning to do. Or just to subsystems here and there
<Myoma> can't write a program to make the bindings for you?
<psnively> One step at a time. Also consider validating your bindings with Saffron.
<Myoma> what does Saffron do?
<psnively> Sorry, Saffire: http://www.cs.umd.edu/~furr/saffire/
<psnively> Maybe CamlIDL can help generate the glue? http://caml.inria.fr/pub/old_caml_site/camlidl/
<haskellian> But for Andorid you can just release an app and try to sell it right? While for Apple you have to "be approved" by Apple before you even get a chance or am I wrong?
<haskellian> So if Apple don't like your idea but you think it is awesome you can always at least try on Android.
<Proteus_> no, that's right. the google store will be like a youtube for apps
<haskellian> cool
<psnively> You're right re: the Apple Store. There's nothing stopping you from selling iPhone software elsewhere; it's just that everyone wants to be on Apple's store.
<Proteus_> except that it would be a bitch to port objective-c to java
<haskellian> I like that
<psnively> Well, there's always http://cappuccino.org :-D
eelte has quit [Read error: 113 (No route to host)]
<Proteus_> huh
<psnively> I presume Android can somehow run JavaScript? If nothing else, with Rhino...
threeve has joined #ocaml
<Proteus_> well, web apps are certainly going to be a big deal with android's 3g+wifi+bluetooth+cupandstring web access
<psnively> Ah. Android uses WebKit. Of course.
<Proteus_> yeah, same as Chrome
<haskellian> ah so you can sell someone an iPhone app outside the Aplle shop? But I guess that would be really hard?
<psnively> Yeah, I think the idea is that you'd have to do your own marketing, distribution, etc.
<psnively> Which is the Hard Part™.
<Proteus_> .... if it's like..... a web ap and you use pay pal for access or something
<psnively> Interesting. I will have to look at Objective-J on Rhino on Android...
<psnively> As well as OCaml-Java on Android...
<Proteus_> ocaml-dalvik would be a good start, since you wouldn't have to write bindings to all the c interfaces the android system uses
<haskellian> seems like overkill unless you are doing something really big?
<Proteus_> as I understand it ocaml-java lets you call all the java libs without much hassle
<haskellian> I mean if you are doing a webapp you could write that in ocaml and then just have the android frontend/interface in java?
<Proteus_> well sure
<haskellian> so could you use scala or clojure too on android?
<Proteus_> not sure
<psnively> Mmmmm, Scala on Android... good idea.
<haskellian> you like scala? i havent tried it yet.
<Proteus_> not a whole lot of difference between scala-jvm and ocaml-jvm except that scala was designed around it
<haskellian> tried clojure a bit
<haskellian> its ok
<Proteus_> also, android doesn't have a full jvm
<haskellian> but i prefer haskell and so far ocaml over lisp
<Myoma> that doesn't mean it's ok to spam #lisp
<haskellian> sorry was just kidding
<psnively> Geez, they're way ahead of us: http://www.scala-lang.org/node/160
mfp has quit [Read error: 54 (Connection reset by peer)]
<Proteus_> wow
<haskellian> do you know what Melange is? supposedly some program writeen in ocaml
<psnively> I do like Scala. A lot.
<Proteus_> I know basically nothing about scala - why do you like it so much?
<det> If I pass a c function an OCaml value (a closure), an then this C function calls the closures twice, will there be a problem if the first call triggers a collection?
<psnively> Well, if you think of Scala as a nice cross between OCaml and Haskell, targeting the JVM, that's basically it.
<det> Is it possible to tell OCaml to update that value pointer if it changes? set it as a root somehow ?
<Proteus_> how does the performace of scala compare to that of ocaml or java?
<psnively> It compares very well to the performance of Java.
<psnively> det: I dunno. I'd look into Saffire. :-D
<psnively> That unfortunately returns an error page for me at the moment.
<psnively> Hmmmm. Time to check out the Android SDK, the Eclipse plug-in, and Scala on it. :-D
<Proteus_> Cafesterol says it can compile ocaml code that can be run on any java 1.5 VM
<Proteus_> psnively, the android SDK is pretty nice. Get ocamljava bytecode output dancing across the emulated screen!
<psnively> Heh.
mfp has joined #ocaml
<psnively> Too much to play with, not enough time.
<psnively> Scala on Android looks like it could be REALLY nice.
<Proteus_> definitely
<psnively> Time to fiddle with Scala bindings to OpenGL etc... hmmmm.
<psnively> Must. Take. On. Fewer. Personal. Projects.
<Proteus_> I have some pretty computationally intensive things I'd like to do in android apps but I'm really not sure if A, the cpu can handle it and B , how to write high performance java code
<psnively> Yeah, it's a headache.
<psnively> OK, gotta dash. Catch y'all late. Proteus_ and haskellian, thanks for all the great info on Android etc. :-)
<Proteus_> later
psnively has quit []
okagawa has joined #ocaml
okagawa has left #ocaml []
Ched- has joined #ocaml
okagawa has joined #ocaml
okagawa has quit [Client Quit]
haskellian has quit []
Proteus_ has quit [Read error: 104 (Connection reset by peer)]
Proteus_ has joined #ocaml
mbishop has joined #ocaml
Ched has quit [Read error: 110 (Connection timed out)]
Palomides_ is now known as Palomides
sporkmonger has quit []
tar_ has joined #ocaml
tar_ has quit ["byebye"]
threeve has quit []
mbishop has quit [Remote closed the connection]
<hcarty> det: I think you would generally wrap the OCaml callback so that the value pointer is checked and updated if needed on each call
<det> Yeah, I figured it out. Problem is that pointer is inside a struct.
<det> and passing CAMLparam1 a value of the forum a->b makes the preproccessor flip out
<det> form*
<det> So I have to do something like:
<det> value readable = object->readable;
<det> CAMLparam1 (readable);
<det> caml_callback(readable, ...);
<det> object->readable = readable;
<det> Not a big deal. But I'd prefer for the GC to just update the pointer in the struct directly.
<hcarty> det: Ah, I see. That's unfortunate that the preprocessor chokes
authentic has quit [Read error: 110 (Connection timed out)]
Snrrrub has joined #ocaml
Snrrrub has quit [Client Quit]
Proteus has joined #ocaml
Proteus__ has joined #ocaml
Proteus_ has quit [Read error: 113 (No route to host)]
Proteus_ has joined #ocaml
threeve has joined #ocaml
Proteus__ has quit [Read error: 60 (Operation timed out)]
Proteus has quit [Read error: 113 (No route to host)]
Proteus has joined #ocaml
Proteus__ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Associat0r has quit []
rby has joined #ocaml
threeve has quit []
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
Proteus has quit [Read error: 113 (No route to host)]
seafood has joined #ocaml
Proteus_ has quit [Read error: 113 (No route to host)]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
bluestorm has joined #ocaml
Vital303 has quit [Read error: 110 (Connection timed out)]
Vital303 has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
rby has quit ["Leaving"]
struktured has joined #ocaml
seafood has quit [Read error: 54 (Connection reset by peer)]
seafood has joined #ocaml
Proteus has joined #ocaml
seafood has quit []
Proteus_ has joined #ocaml
Proteus has quit [Read error: 104 (Connection reset by peer)]
Proteus__ has quit [Read error: 113 (No route to host)]
seafood has joined #ocaml
igor47 has joined #ocaml
igor47 has left #ocaml []
Snark has joined #ocaml
seafood has quit []
seafood has joined #ocaml
seafood has quit []
Palace_Chan has quit [Client Quit]
ygrek has joined #ocaml
bluestorm has quit [Remote closed the connection]
Asmadeus has joined #ocaml
asmanur has joined #ocaml
Asmadeus has quit ["Changing server"]
Asmadeus has joined #ocaml
filp has joined #ocaml
Yoric[DT] has joined #ocaml
eelte has joined #ocaml
<Yoric[DT]> hi
Linktim has joined #ocaml
Linktim_ has joined #ocaml
middayc has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
<Yoric[DT]> Okay, documentation seems to work.
<Yoric[DT]> smimou: ping
<smimou> Yoric[DT]: pong
jderque has joined #ocaml
authentic has joined #ocaml
domiel has joined #ocaml
dkremer has joined #ocaml
domiel has left #ocaml []
Jedai has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
<Yoric[DT]> Updated preview documentation of Batteries Included: http://batteries.forge.ocamlcore.org/doc.preview/batteries.docdir/ .
Linktim has joined #ocaml
<Camarade_Tux> Yoric[DT], wooo, that's ... long
<Camarade_Tux> do you plan on adding uint32 ? (I found myself needing it for bindings)
<Yoric[DT]> I think so, yes.
bla has quit [Read error: 113 (No route to host)]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Associat0r has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
bla has joined #ocaml
Camarade_Tux has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has joined #ocaml
okagawa has joined #ocaml
Linktim has quit [Read error: 104 (Connection reset by peer)]
bla has quit [Read error: 113 (No route to host)]
okagawa has left #ocaml []
Linktim has joined #ocaml
Associat0r has quit []
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
bla has joined #ocaml
egete has joined #ocaml
<Yoric[DT]> Camarade_Tux: where is uint32?
eelte has quit [Read error: 110 (Connection timed out)]
Associat0r has joined #ocaml
<Camarade_Tux> Yoric[DT], see http://forge.ocamlcore.org/projects/uint64lib/ , I've not tested it myself though as I _just_ had the need for it
<Yoric[DT]> Ok, thanks.
<Yoric[DT]> I don't think there's any package for Godi/Debian/Rpm yet, though.
<Yoric[DT]> That's a bit of a problem.
<Yoric[DT]> If we add it to Batteries, we implicitly demand packagers to also create a package for unit64lib.
okagawa has joined #ocaml
Proteus_ has quit [Read error: 113 (No route to host)]
asmanur has quit ["Lost terminal"]
<ertai> Yoric[DT]: Would a Data.Container.Lazy.List module be of some interest for batteries
<ertai> ?
okagawa has left #ocaml []
<Yoric[DT]> Well, yes.
<Yoric[DT]> It just happens so that we already have on on the svn.
<Yoric[DT]> s/on/one/
<Yoric[DT]> (unless our recent svn misfortunes have removed it)
<Yoric[DT]> mmmhhh...
<Yoric[DT]> Obviously, they have.
* Yoric[DT] should try and fix that.
ygrek has joined #ocaml
<ertai> Yoric[DT]: The one I have is pretty large and lazy and force where automatically added (so a precise lazy semantics)
<Yoric[DT]> Well, feel free to submit it.
<Yoric[DT]> Whenever I find time, I'll merge them.
<Yoric[DT]> If that's ok with you.
<Yoric[DT]> (mine was also pretty large)
<Yoric[DT]> Oh, it's still in the repo, just in a different directory.
<Yoric[DT]> mmmhhh....
<Yoric[DT]> gottago
* Yoric[DT] will return in about 1/2h.
<Eridius> has camlimages really not had a release in 4 years??
<Yoric[DT]> I'm afraid so.
<Smerdyakov> Is there some problem with it as it stands?
<Eridius> yeah, no alpha channel support for PNG
<Eridius> I checked cvsweb, and it looks like they finally added it, but that's not very useful as long as it's just in CVS
* Eridius can't even figure out how to check out the CVS code, only how to view it in cvsweb
<Smerdyakov> Well, you have available to you the standard OSS procedure: make a best effort to contact the maintainer and fork if he doesn't respond adequately.
<Eridius> I don't want to fork, I just want the latest devel version
<Eridius> and I already tried to email 2 of the 2 addresses... it bounced
<Eridius> err, 1 of the 2
marmotine has joined #ocaml
<Camarade_Tux> isn't Jacques Garrigues one of the devel ?
<Eridius> I don't know who that is
<Eridius> the camlimages website lists Jun.Furuse@inria.fr (bounced) and Pierre.Weis@inria.fr
<Yoric[DT]> I think so.
asmanur has joined #ocaml
<Smerdyakov> Jun works at Jane Street now. I'm not sure of his address.
<Camarade_Tux> pierre.weis@inria.fr worked five months ago
<Camarade_Tux> as for checking cvs, try
<Camarade_Tux> cvs -d ":pserver:anoncvs@camlcvs.inria.fr:/caml" co bazar-ocaml/camlimages
<Eridius> well whaddaya know, it worked. I tried several variations on that and they failed, but I haven't touched cvs in yeras
<Eridius> *years
<Camarade_Tux> I had to google for proper command ;p (git, git, git, woooo ! </cheerleader>)
<Eridius> heh
<Yoric[DT]> ertai: you should also contact Vadim Shender
<ertai> Yoric[DT]: In fact I will release it next week and let people integrate it if they want.
bzzbzz has joined #ocaml
<Eridius> damn, building camlimages from cvs doesn't work so well
<Eridius> not only is the library name changed, but trying to use it complains about some function, and I really don't have the patience to figure out what's wrong
<ertai> camlimage is really a pain to use :(
<Camarade_Tux> Eridius, exif or tiff thing ?
<Eridius> I don't think so, but I didn't really pay attention to the name
oriba has joined #ocaml
<gildor> Eridius: take a look at debian source and patches for camlimages
<Eridius> I'd really rather not. I only wanted to play with camlimages
<Eridius> it's not worth the effort
<gildor> i think there is only 2 patches to apply
<Eridius> especially since the CVS version of camlimages changes the names of the libs, and so if I ever want to use pre-existing code that uses camlimages, it won't exactly work
<Eridius> hrm, can I create a record of a type from a module without Open'ing that module?
<Eridius> gildor: that wasn't the error
<Eridius> it was some function name with, like, 5 underscores in it
<Eridius> my guess is related to gtk somehow, but I didn't pay much attention
<gildor> you are talking about the CVS version i think
<gildor> I am talking about the latest release
<Eridius> yes, I'm talking about the CVS version
<Eridius> I have no problem installing 2.2 with godi
<gildor> ok
<gildor> what is the problem of creating record without opening the module
<gildor> you just have to prepend the name of the module on variable
<Eridius> { r = 0; g = 0; b = 0 } doesn't work unless I Open Images
<gildor> {A.var1 = ...; A.var2 = .. }
<Eridius> o_O
<Eridius> huh
<gildor> {Images.r = 0; Images.g = 0; Images.b = 0 }
<Camarade_Tux> (in fact you only need one of the "A.")
<Eridius> speaking of records, is there any way to have two records that share some of the field names in the same module?
<gildor> Eridius: i don't think
jderque has left #ocaml []
<Smerdyakov> Eridius, create sub-modules.
<Eridius> it just seems odd
<Smerdyakov> Eridius, or switch to SML. ;)
<gildor> Eridius: why ?
<Eridius> gildor: just curious
<Eridius> Smerdyakov: hah. I looked at SML, but I thought OCaml was supposed to be a bit more practical
<Smerdyakov> Eridius, nope. They are incomparable along that dimension.
<gildor> I think the problem comes if you pattern match your record
<gildor> if you match only the shared record i think the type system could not guess the right type
<Smerdyakov> Eridius, SML is more practical in a few important dimensions: serious compiler optimization, an official language definition, a community development model for the main compilers.
<Eridius> gildor: well at the very least it would be nice if I could explicitly state the type of record I'm trying to create
<Eridius> "a community development model for the main compilers" uh what?
<Smerdyakov> Eridius, more information at http://adam.chlipala.net/mlcomp/
<Eridius> thanks
asmanur has quit [Read error: 60 (Operation timed out)]
<Smerdyakov> Eridius, what I meant is that the OCaml developers are very stingy about accepting patches from outside their team.
<Eridius> ah
<Camarade_Tux> Eridius, here camlimages compiled correctly (just had to get godi-ocaml-graphics...)
<Eridius> how can I install camlimages from CVS such that ocamlfind knows about it?
<Eridius> similarly, if I configure with --prefix-/opt/godi and try and install, it doesn't use site-lib, it just puts the camlimages dir in lib/ocaml/ directly
<Smerdyakov> I am constantly astounded at how bad standard development tools are at conceptually big-picture things like projects and libraries.
<Smerdyakov> OCaml isn't significantly better than the standard GNU world here.
<Yoric[DT]> ertai: If you're willing to maintain it, I'm willing to integrate it.
<Yoric[DT]> ertai: but I'd rather have a lazy list library compatible with what we need.
egete has left #ocaml []
<ertai> Yoric[DT]: No don't want to be supposed to maintain it, I will just deliver it "as is".
<Yoric[DT]> Then I'm afraid I can't take the code.
<Yoric[DT]> I may copy/paste some bits.
<Yoric[DT]> But we just can't be expected to maintain someone else's code.
<ertai> Yoric[DT]: In fact that's not directly my code, that's a copy/paste+syntax translation from the Data.List haskell module
<ertai> Then we've explicited laziness with an translator
<ertai> So I'm pretty sure of the contents of it
<ertai> However, in the mean time, I will no longer need all these libs for ocaml...
<Yoric[DT]> What do you mean?
bla has quit [Read error: 60 (Operation timed out)]
<Yoric[DT]> In addition, Data.List uses different naming conventions.
yziquel has joined #ocaml
<Yoric[DT]> (i.e. foldl and foldr, etc.)
<Yoric[DT]> Which means that we can't integrate it directly, we still have to rename many functions.
<Yoric[DT]> So you would actually be giving us more work, I'm afraid.
<ertai> Yoric[DT]: Yes all lot of renaming would be needed
<Yoric[DT]> + redocument
<Yoric[DT]> etc.
<Eridius> hooray, I finally got camlimages CVS working
<Eridius> I had to edit src/Makefile.am to fix the installation path, and now ocamlfind knows about it
<Eridius> I also tweaked CFLAGS/LDFLAGS
<gildor> provide upstream with the corresponding patch !
<ertai> Yoric[DT]: however the general approach of mechanically expliciting laziness could be reused
<Yoric[DT]> ertai: I'm sure it could.
<Yoric[DT]> Do you have a paper on that?
<ertai> Yoric[DT]: yes but it's still rather experimental
<ertai> Yoric[DT]: no for the paper
<ertai> Yoric[DT]: it was on an industrial contract, but we hope to release this part as tool for OCaml users
<Yoric[DT]> That would be nice.
<ertai> So it was simpler for me to provide a translated file...
<Yoric[DT]> Well, good luck with that work.
<Yoric[DT]> gottago
<Yoric[DT]> cheers
itewsh has joined #ocaml
bla has joined #ocaml
<ertai> Yoric[DT]: cheers
middayc_ has joined #ocaml
<Eridius> hrm, does Graphics itself not support an alpha channel? Because camlimages refuses to draw an Rgba32 image to a Graphics
Myoma has quit ["Leaving"]
<Camarade_Tux> the documentation states "A color is specified by its R, G, B components. Each component is in the range 0..255."
<Camarade_Tux> (there's Graphics.transp thoughà
<Camarade_Tux> s/à/)
<Eridius> so if I want to do alpha compositing, I have to write it mysefl?
<Eridius> *myself
filp has quit ["Bye"]
<Camarade_Tux> Graphics is not very advanced (and not meant to)
<Eridius> is there a better way to draw to the screen?
<Camarade_Tux> sdl, opengl, gtk, wx, tk ;)
<Eridius> ugh
<Camarade_Tux> you choose, I think sdl and opengl have exactly what you want
<Eridius> it seems silly to use opengl for 2D drawing
middayc has quit [Read error: 110 (Connection timed out)]
<Eridius> especially because if I want to use string drawing, opengl can't use the same fonts as most other things
Proteus has joined #ocaml
<Camarade_Tux> ocamlsdl ( ocamlsdl.sf.net ) can use ttf fonts
<oriba> Eridius, you asked for alpha-channel support... this only makes sense, if the fileformat you use also support it. png does this. I think, camlimages has png support... (not sure, used it long time ago and only for other filesformats).
<det> OpenGL for 2D drawing is a really good idea
<oriba> Eridius, what is your main application for the drawings?
<Eridius> oriba: I just built camlimages from CVS in order to get PNG alpha channel support (2.2 supports PNG but not reading/writing alpha channel)
<det> You can even mix GTK and OpenGl
<Eridius> oriba: it's just a dinky test script
<oriba> det, I agree... OpenGL is quite good or 2D.
ygrek has quit [Remote closed the connection]
jeremiah has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
ygrek has joined #ocaml
sporkmonger has joined #ocaml
<hcarty> Eridius: http://alain.frisch.fr/soft.html#patches -- There is a compiler patch here which allows for shared record fields within one module, but it does not apply cleanly to 3.10.x
threeve has joined #ocaml
hkBst has joined #ocaml
Palace_Chan has joined #ocaml
<Palace_Chan> I manually set up OCaml 3.10.2 from INRIA website yesterday, is there a way for me to get an emacs editing mode without messing with this ? (i.e. in the packaga manager the editing modes, at least tuareg, has OCaml as a dependency, and it is an older version too..)
<Asmadeus> you can get tuareg-mode from their website
<Asmadeus> Package managers are just always assuming too much -_-
<pango_> If I read http://packages.ubuntu.com/hardy/tuareg-mode correctly, it's a recommendation relationship between packages, not a dependancy
Amorphous has quit ["shutdown"]
Amorphous has joined #ocaml
jonafan_ has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
<Palace_Chan> why doesn't this repeat infinitely:
<Palace_Chan> let rec rev l =
<Palace_Chan> match l with [] -> []
<Palace_Chan> | x::xs -> rev xs @ [x];;
<Palace_Chan> if i call it with say [1;2]
<Eridius> Palace_Chan: the (rev xs) call operates on a list one element shorter than you started with
<Eridius> which means that eventually you get the empty list
tomh_-_ has joined #ocaml
<Palace_Chan> Eridius, ohhh, i kept reading it as calling (xs @ [x]) rather than just xs and THEN appending [x]
<thelema> yup, the order of operations is (rev xs) @ [x]
<Eridius> ah
<thelema> @ binds pretty loosely
<Palace_Chan> if i had written rev (xs @ [x]) then it would loop forever no ?
<thelema> yes
<Palace_Chan> kk thanks
<gildor> mfp: ping
<Smerdyakov> It would be an absolutely HILARIOUS loop, recurring through all the cyclic permutations of the list in order forever! HAHA!
<thelema> Smerdyakov: I dunno about hilarious, but it would certainly be an inefficient infinite loop.
<Smerdyakov> It's hilarious to me. Better than most newspaper comic strips.
<Palace_Chan> ocaml-mode on my distro says version 3.10.0.-8 while i manually got OCaml 3.10.2....would it then conflict if i try using it for editing ocaml ?
<Palace_Chan> even for tuareg mode it says version 1:1.45.5-1 but i would imagine those versions being independent of which version of ocaml i have (hopefully)
<Camarade_Tux> I guess no since there was no major change
Amorphous has quit [Read error: 110 (Connection timed out)]
<Palace_Chan> in matching | x::y -> whatever would match a list with head and tail and bind the head to x and tail to y from my understanding...but what would x::y::z match ?
Amorphous has joined #ocaml
<thelema> palomer: first two elements of a list in x and y, and the rest in z
<thelema> err, Palace_Chan
dkremer has left #ocaml []
<Palace_Chan> ah so x::y::z::w would put first second third elements in x y z respectively and the rest in w
<Camarade_Tux> exactly
mgodshal1 has joined #ocaml
<thelema> Palace_Chan: but these longer patterns only match for lists long enough to have the required prefix.
<Palace_Chan> thelema, yea
TypedLambda has joined #ocaml
mgodshall has quit [Read error: 110 (Connection timed out)]
<Palace_Chan> How should i read what this does: let uncurry f = function (x,y) -> f x y;;
<thelema> Palace_Chan: it takes two arguments: f and (x,y)
<thelema> and applies the function f (which must take two arguments) to x and y
mgodshall has joined #ocaml
<thelema> the way it's written, partial application is implied - one would normally apply uncurry to just f, and let-bind the result
<thelema> and then use that result as if it took one pair as argument.
<thelema> (instead of f, which takes two arguments)
* Camarade_Tux would simply have written it : let uncurry f (x, y) = f x y;;
<thelema> Camarade_Tux: that syntax definitely takes up less space, but it lacks the implied partial application.
<Palace_Chan> it's cuz it looks as if "uncurry f" takes an argument (f), but then it returns f applied to two arguments
<Palace_Chan> Camarade_Tux, your's makes more sense
<Palace_Chan> uncurry f (x,y) = f x y;;
<thelema> no, it returns a function that takes a pair as argument and returns f applied to that argument
<thelema> err, f applied to those values.
<thelema> for example : let plus = uncurry (+) in (plus (1,2)) * (plus (3,4))
<Palace_Chan> if you write "let uncurry f (x,y) = f x y;;" it looks from the left hand side of the equals that uncurry takes 'f' and '(x,y)' as arguments and then returns to you f applied to x and y
<thelema> if you had f, x and y all in the same place, it's faster and simpler to not use uncurry, but to simply do: f x y
<Palace_Chan> yea i guess it's the notation that confuses me because in: let a = a + 3;; a is an argument, and the body of a+3
<Palace_Chan> but when the body cotains -> it ticks me off a bit
<Palace_Chan> as in let a = function b -> b+a;;
<Palace_Chan> in there, which one is the body ? it seems as if let takes argument 'a' and then the body declares an anonymous function taking argument b and who returns a + b
<Palace_Chan> oops change let a to let f a
<thelema> better.
<thelema> let f x = blah is just syntactic sugar for let f = function x -> blah
mgodshal1 has quit [Read error: 110 (Connection timed out)]
<Palace_Chan> so let f = function x -> blah can be read "let f equal a function from argument x to blah"
<thelema> yes
<thelema> or maybe better "call as f the function x -> blah"
<thelema> "let f equal" implies assignment, which isn't what's happening.
<Palace_Chan> ahhh now it makes sense to read let uncurry f = function (x,y) -> f x y;; as "let uncurry, which takes argument f, be a function from a pair of arguments to f applied to each"
<thelema> good.
<Palace_Chan> let curry f = function x -> function y -> f (x,y);; then could read "curry takes f as argument, and is itself a function from x to a function from y to f applied to the pair (x,y)"
<Palace_Chan> ugh a little mind bending at first
<thelema> yes, partial application of functions takes some getting used to.
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<kig> "function ..." is sugar for "fun x = match x with ..."
<kig> if you want to write it all out, let curry f x y = f (x,y) becomes let curry = fun f -> fun x -> fun y -> f (x,y)
<kig> where you can see similarity to the type sig, val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
<Palace_Chan> kig, interesting
itewsh has quit [Read error: 113 (No route to host)]
mickael9 has joined #ocaml
mickael9 has left #ocaml []
oriba has quit ["Verlassend"]
<thelema> kig: yup. levels of sugar.
ygrek has quit [Remote closed the connection]
Myoma has joined #ocaml
mgodshal1 has joined #ocaml
mgodshall has quit [Read error: 110 (Connection timed out)]
struktured_ has joined #ocaml
Snark has quit ["Ex-Chat"]
itewsh has joined #ocaml
<Palace_Chan> what is the colon doing in: let int_cell : int ref = ref 0 ?
<Palace_Chan> the ":"
<Eridius> specifying the type
<Eridius> although that's not really necessary here, (ref 0) is already typed as int ref
<Eridius> it would be more useful with something like let int_list : int list ref = ref []
<Palace_Chan> can't you say something like: let int_cell = ref 0
<Eridius> yes
<Palace_Chan> what is the diff between that and let int_cell : int ref = ref 0
struktured has quit [Connection timed out]
<Eridius> in this case, nothing
<Eridius> but in the case of let int_list = ref [], the type there is 'a list ref
<Eridius> so let int_list : int list ref = ref
<Eridius> so let int_list : int list ref = ref [] actually constraints the type to int list ref
<Palace_Chan> whereas let int_list = ref [] could be a 't list
<Eridius> 'a list ref
<Palace_Chan> so the ": int list ref" portion goes in between to specify the type
<Eridius> (expression : type) constrains the type of expression
<Palace_Chan> ok, thank you
<Palace_Chan> and something like: let int_set_result : unit = int_cell := 42
<Palace_Chan> why would it be constraining the type to unit if it is assigning an int ?
<Eridius> the result of a := operation is unit
<Eridius> val (:=) = 'a ref -> 'a -> unit
<Palace_Chan> if the return type of int_cell := 42 is unit, why would one want to capture that in int_set_result ? would it suffice to say: let int_cell := 42 ?
<Palace_Chan> or maybe what i just typed makes no sense
<Eridius> it would suffice to say let _ = int_cell := 42
<Eridius> or you could just say int_cell := 42, but if this is at the top level, this might necessitate adding a ;; somewhere
<Palace_Chan> yes
<Palace_Chan> so in let int_set_result : unit = int_cell := 42
<Palace_Chan> int_set_result will always contain unit
<Eridius> yes
<Eridius> it's pretty pointless
<Palace_Chan> rx_zip : int option
<Palace_Chan> is int option a type ?
<Palace_Chan> it looks like option is a keyword
<Eridius> option is a type
<Eridius> None | Some of 'a
<Eridius> type 'a option = None | Some of 'a
<Palace_Chan> so Some(Some(7)) is of type int option ?
<Eridius> no, that would be int option option
<Palace_Chan> and Some(7) ?
<Eridius> that would be int option. I'm curious as to your syntax, though
<Eridius> that's more traditionally expressed as Some 7
<Palace_Chan> I'm 100% new to OCaml and functional programming..and i saw an example where one declared: type nat = Zero | Succ of nat
<Palace_Chan> and then one would write Succ(Succ(Succ(Zero)))
<Palace_Chan> or something like that
<Eridius> that looks pretty ugly
<Palace_Chan> can you write it Succ Succ Succ Zero ?
<Eridius> probably not, I'm not sure about the binding here. But you could write it Succ (Succ (Succ Zero))
<Myoma> no
<Eridius> what's the point of a type like nat, though?
<Palace_Chan> well it was to exemplify how one can declare a type
<Eridius> the more common example I've seen is a tree
<Eridius> type 'a btree = Leaf of 'a | Node of 'a btree * 'a btree
<Palace_Chan> type tree = Root | Child of Root
<Palace_Chan> lol
<Yoric[DT]> Palace_Chan: that won't work.
<Myoma> that's the same as nat :)
<Yoric[DT]> You need [type tree = Root | Child of tree]
<Palace_Chan> yea probably not wouldnt, im looking at Eridius' example
middayc has joined #ocaml
<Yoric[DT]> (the square brackets are not part of the code)
<Palace_Chan> type 'a btree = Leaf of 'a | Node of 'a btree * 'a btree
<Palace_Chan> so either a leaf or a node of a tuple ?
<Eridius> a tuple of btrees
<Eridius> Node (Leaf 3, Leaf 5)
<Palace_Chan> ah, the constructor is called Node, it takes a pair of the declared type
<Eridius> basically
<Palace_Chan> so then if you said let cat : int btree = Node (Node(Leaf 3, Leaf 6), Node(Leaf 5, Leaf 7))
<Palace_Chan> ugh prolly omitted a parens
<Eridius> no that looks correct
<Eridius> though the : int btree is superfluous
<Palace_Chan> because it can infer it i guess
<Eridius> note that the (expression : type) constraint can't override type inference, it can only constrain it
<Palace_Chan> i see, ill try it out in toplevel
<Eridius> so let int_list : int list ref = ref [];; works, but let int_list : int list ref = ref 3;; wouldn't
<flux> perhaps this explains the point better better: let succ : 'a -> 'a = fun i -> i + 1
<flux> s/better //
Mr_Awesome has quit [Read error: 110 (Connection timed out)]
<Eridius> that type expression is actually more generic than the type inference, so succ really is int -> int
middayc_ has quit [Read error: 110 (Connection timed out)]
rog1 has quit [Read error: 110 (Connection timed out)]
Anarchos has joined #ocaml
longh has joined #ocaml
<palomer> yay for datatypes
batcoder-7 has joined #ocaml
<batcoder-7> just got done with a good mid size ocaml projct
<batcoder-7> perfect language
<batcoder-7> how they did it I dont know
<flux> batcoder-7, what was the project about?
struktured__ has joined #ocaml
struktured_ has quit [Read error: 104 (Connection reset by peer)]
Linktim_ has joined #ocaml
longh has quit [Read error: 104 (Connection reset by peer)]
struktured_ has joined #ocaml
<palomer> it's not, erm, perfect...but at least it's better than haskell!
* palomer ducks
palomer has quit ["Leaving"]
<batcoder-7> flux: well it wasnt that crazy but parsed a bunch of xml files and dumped thme into the db >> very quickly heeheh
<batcoder-7> maybe not be huge but it took me a while but i know ocaml better now
Palomides has quit [Remote closed the connection]
seafood has joined #ocaml
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim has joined #ocaml
struktured__ has quit [Read error: 110 (Connection timed out)]
Linktim_ has quit [Read error: 110 (Connection timed out)]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
itewsh has quit ["KTHXBYE"]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Linktim has quit ["Quitte"]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
Asmadeus has quit ["nighters"]
threeve has quit []
<Palace_Chan> are <- and := entirely different things ?
<flux> yes
<Anarchos> Palace_Chan yes : to retreive a field in a record you do a.f, but to retrieve the value from a ref, you must do !cell to retrieve it
<flux> well, actually no
<flux> foo.contents <- 42 is the same as foo := 42
<pango_> # type 'a ref = { mutable contents: 'a } let ref v = { contents = v } let (!) r = r.contents let (:=) r v = r.contents <- v
<Anarchos> but you can mix mutable and immutable fields in a record !
<Palace_Chan> yea
<pango_> references are just records containing a single mutable field, ! and := are just operators to ease their use
<Palace_Chan> so i see how the ":" is a type constrainer as in: let b : int = ref x but how come there are two here,
<Palace_Chan> let bool_of_some_union_ty (t : some_union_ty) : bool
<Palace_Chan> is that saying the argument is t of type some_union_ty but it constrains the return to be of type bool ?
hkBst has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov> Palace_Chan, have you read the OCaml tutorial in the manual?
<Palace_Chan> Smerdyakov, i am actually going through an interactive sort of tutorial, but sometimes it introduces notation not immediately explained
<Palace_Chan> or expressions that appear confusing at first
<Smerdyakov> I only recommend the manual's tutorial or Jason Hickey's book. Any other source may do more harm than good.
<Palace_Chan> by the manual's tutorial do you mean ocaml official website ?
<Palace_Chan> or a tutorial available in the man folder ?
<Smerdyakov> The tutorial that is in the OCaml manual. That is an unambiguous reference.
<Smerdyakov> (Since manual is not "man.")
<Palace_Chan> srry
<Palace_Chan> is there a diff which can allow the compiler to turn recursion into a loop between: let rec count_to_ten (starting_from : int) : unit =
<Palace_Chan> if starting_from >= 10 then () else count_to_ten (starting_from + 1)
<Palace_Chan> and let rec silly (n:int) : int = if n <= 0 then 0 else silly (n - 1)
<Palace_Chan> ?
<Smerdyakov> I don't understand.
<Palace_Chan> well i read this: " It's sometimes possible to make a very simple change that allows the
<Palace_Chan> * compiler to turn your recursion into a loop-- when a function's result
<Palace_Chan> * depends only on the result of a call to another function"
<Palace_Chan> but i do not really see much diff between those two construed example functions
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
<Smerdyakov> Both of your example functions are tail-recursive.
<Smerdyakov> (Which is the right term, instead of "can turn into a loop.")
<Palace_Chan> so non-tail recursive would call a helper function instead ?
<Smerdyakov> I'm not going to try to define tail recursion here. I'm sure Wikipedia has a definition.
<Palace_Chan> so wikipedia basically says that a tail recursive function calls itself at the end
<Smerdyakov> No.
<Smerdyakov> Calls _some_ function
<Myoma> don't confuse tail call and tail recursion
<Anarchos> tail recursive : last call is enough to get the result
<Palace_Chan> ok, so it calls some function but it does so recursively
<Myoma> the best description of a tail call is in R5RS
<Anarchos> R5RS ???
<Myoma> Anarchos: that is a term you can search for
<Myoma> it's defined inductively and you can use the same rules for ocaml
tomh_-_ has joined #ocaml
<Smerdyakov> The best description of tail recursion, for a combination of rigor and specificness, comes from thinking about CPS translations.
<Anarchos> 1st rule : never use acronyms to pretend to be clever than those ignoring it ....
<Smerdyakov> A tail call is a call that uses a continuation that's already in scope.
<Myoma> Anarchos: You'd rather I type out in full what R5RS means for you, than you search for it?
<Anarchos> Myoma it would have been self explaining, thus more useful ....
<Myoma> Anarchos: Wrong
<Smerdyakov> Anarchos, I have to admit, "R5RS" is a fair acronym to expect functional programmers to know.
<Myoma> Anarchos: I'm also not trying to "be clever", I'm suggesting a useful reference
<Myoma> Anarchos: Do excuse me if dt seemed that way
<Anarchos> it just remembered me some bad teachers using acronyms before defining them, thanks for the scheme reference
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
<Palace_Chan> so in order to avoid tail recursion you'd want to take the 'recursion' out of scope ?
<Smerdyakov> Palace_Chan, you should ignore what I said in full, if you don't know what CPS is.
<Palace_Chan> http://en.wikipedia.org/wiki/Continuation-passing_style but yes i am unfamiliar with it
<Smerdyakov> Then ignore what I said.
<Myoma> That wiki article is not a good one
<Myoma> If you want to know what CPS is don't bother reading it
tomh_-_ has quit ["http://www.mibbit.com ajax IRC Client"]
marmotine has quit ["mv marmotine Laurie"]
ulfdoz has quit [Read error: 110 (Connection timed out)]