rwmjones changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.1 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
ita has quit [Remote closed the connection]
<damg> is it possible to reuse shared libs created by ocamlopt in other ocaml modules?
mpc has quit []
Robdor has quit [Remote closed the connection]
<neale> why wouldn't it be?
<damg> I can't find any proper information on this topic :/
<neale> Well I don't actually know the answer, but I can't think of a reason why it wouldn't be possible.
<neale> I mean isn't that all the standard library is?
<damg> hm, my stdlib is a set of static libs plus a few glue libs (or I missed something about the lablgtk, bigarray etc libs)
hkBst has quit ["Konversation terminated!"]
kotarak has quit [":qa!"]
middayc has quit []
zkincaid has joined #ocaml
jlouis has joined #ocaml
<ikatz> random ocaml question,
<neale> I don't see one
<ikatz> how are the operators '=', '<', and '>' implemented such that they work across types
<neale> magic :)
<ikatz> whereas + - * / have +. -. *. and /.
<ikatz> i KNEW IT!
<ikatz> :)
<neale> yeah, actually I have no idea.
<thelema> comparisons didn't get implemented in ocaml, they're implemented in C for each backend
<neale> I'd guess that it's because there are so few concrete types at the C level
<ikatz> so the overloading in ocaml happens because the overloading is defined in the C backend?
<ikatz> my next question is whether i have any sort of access to that through ocaml... my guess would be "no"
<thelema> more or less, yes. The backends know what to do with every implementation of an ocaml value. In general it's not too difficult.
<thelema> ikatz: look at the Obj module.
<neale> anyway those operators are defined like
<neale> (=) : 'a-> 'a -> bool
<neale> (sorry, lots of lag today, Dalas lost a router)
<thelema> but you'll have to learn about how things are represented.
<thelema> because types get erased during compilation - they don't exist at runtime.
<ikatz> ok, i'll check that out. it's not related to anything i'm working on, just a curiosity :)
<neale> ikatz: speaking as someone who's recently had to learn about how things are represented: you don't want to go there unless you have to.
<ikatz> are there any other operators that work for 'a * 'a ?
damg has quit [Read error: 104 (Connection reset by peer)]
Tetsuo has quit ["Leaving"]
<thelema> you mean 'a -> 'a -> (anything)?
<thelema> or do you mean ('a * 'a) -> something?
<thelema> I guess in either case... I can't think of anything primitive.
<thelema> 'a -> something has many functions
<thelema> but functions that take two values of any type and does something with them... can't think of any
<Yoric[DT]> The implementation of = < <= >= > works for any 'a because they depend only on the binary in-memory representation of values.
<neale> thelema: <= and >= of course ;)
<Yoric[DT]> And a few other things exist that work for 'a -> 'a -> something.
<Yoric[DT]> I can only think of comparaison-related functions, though.
<Yoric[DT]> max, min
<Yoric[DT]> !=
<thelema> for ('a * 'a), there's fst and snd, the projection functions
<Yoric[DT]> (or is that <> ?)
<thelema> <>
<thelema> != is [not ==]
<Yoric[DT]> ok
<neale> oh!
Yoric[DT] has quit ["Ex-Chat"]
<neale> # (!=) == (not (==));;
<neale> This expression has type 'a -> 'a -> bool but is here used with type bool
<neale> thelema: you lie! ;)
<neale> Alas, poor Yoric.
<thelema> neale: :P
seafood_ has joined #ocaml
<ikatz> thelema: thanks
<ikatz> i was noticing how valuable it was to have general-purpose comparison functions available
<ikatz> speaking of which, is there a special name for that class of comparison operators and min/max functions?
<thelema> not that I know.
<thelema> They mostly derive from Pervasives.compare and Pervasives.(=)
<thelema> (excepting ==, which does a very simple pointer comparison / integer comparison, unlike = which does structural comparison
<ikatz> ok :) i have a bad habit of neglecting to learn proper names for things and fumbling explanations as a result
<neale> ikatz: that sort of dealie is always causing stuff for me too.
<thelema> sometimes we have nice fancy names for things, in this case, if we have one, I don't know it.
<ikatz> it looks like i may have written some unnecessary equality functions
<ikatz> structural equality is a fairly powerful feature!
<thelema> yup. We like OCaml.
<neale> speak for yourself
jlouis_ has joined #ocaml
<neale> I'm rewriting this in Perl.
<ikatz> i like the idea of ocaml... but its compiler is not always my friend
<neale> ikatz: how so? I've found the compiler to be fab.
<neale> And the debugger is a mile beyond awesome.
<ikatz> neale: just learning the tricks of putting code in multiple files took me a while
<neale> seriously?
<ikatz> well... i was having trouble with modules and naming
<neale> huh
<neale> I had no trouble whatsoever with that
<ikatz> because a file mycode.ml automatically generates a module called Mycode
<neale> what language were you using before?
<ikatz> mostly java and visual basic
<neale> ah
<ikatz> i'm no stranger to organizing code... but i didn't come across the automatic module thing in the manual
<neale> this sort of thing is fairly widespread among languages with modules
<neale> I'm a heavy Python user which is probably why I didn't bat an eye about OCaml's module naming.
<neale> Python does it the same way
<neale> Scheme is similar
<neale> flat namespace though
<ikatz> my problem was naming the module... i had wrapped my code in a "module Mycode = struct ... end"
<neale> haha
<neale> well
<ikatz> so the compiler was expecting Mycode.Mycode.myfunction
<ikatz> unbeknownst to me
<neale> you could have precompiled with cat
<neale> cat mycode.ml main.ml > realmain.ml
brooksbp has joined #ocaml
<ikatz> and i think i noticed something where if you have a "module type MYCODE = sig ... end" in the same file, it doesn't create the module automatically
<neale> right because that's just a type declaration
<neale> that's a functor IIRC
<ikatz> we..
<ikatz> "well"...
<ikatz> having the module and the sig in the same file made the compiler allow me to call my module functions without the duplicate module name
<ikatz> either that or i got lucky with an "open Mymodule" in my desparate attempts to get it to work
<neale> ikatz: something I've found tremendously helpful is to read the .ml and .mli files in the standard library.
<ikatz> i have done some of that
<ikatz> i noticed a bunch of dirty tricks in getting the standard module names to be usable without "include"ing them
<neale> such as?
<ikatz> looking for them...
<Smerdyakov> ikatz, you are sounding like your main problem was making up your own semantics for OCaml. Try reading the manual next time. :P
<thelema> ikatz: only the Pervasives module gets opened automatically, everything else works as code you write.
<neale> I have to admit getting the compiler to work was frustrating for me
<neale> ocamlfind helped a lot
<neale> omake helped even more
<ikatz> /usr/lib/ocaml/moreLabels.ml
brooksbp has quit []
<neale> okay...
<neale> what about it
<ikatz> one of those things i didn't understand while reading the code
<neale> well that's not a very interesting module
<neale> what it's doing is pulling in those three modules, which now apparently are all labelled, for things that are still using the MoreLabels module
<neale> IOW you can s/MoreLabels\.// in your code now and it will still work
<ikatz> didn't help me much in figuring out why the compiler was accepting the builtin modules but not my own :)
<neale> oh
<ikatz> the manual is a little short on common pitfalls of compiling
jlouis has quit [Read error: 110 (Connection timed out)]
<neale> well that was an unfortunate choice to start looking.
<ikatz> i traced it back to there
<ikatz> can't remember where i started
<neale> you were using moreLabels?
<ikatz> but i remember getting to that one and thinking "whoa... this is not making it easier to understand what my problem is"
<neale> I'd have to say list.ml is a good starting point.
<ikatz> i wan't using morelabels
<ikatz> i think i was trying to figure out Map
<neale> oh, yeah
<neale> that'll make your head spin
<ikatz> i was having some trouble getting types to work between a map module that i made with the functorial interface
<ikatz> and the rest of my code
<Smerdyakov> There's nothing complicated about Map in particular. It's a standard example of functor use.
seafood_ has quit []
<ikatz> Smerdykaov: which is why i was so frustrated to have trouble with it :)
<neale> Smerdyakov: functors would be the complicated thing, to those who have never encountered such beasts.
<ikatz> i get the concept of functors... but getting types to work has been a royal pain
<neale> ikatz: sounds like you probably should have started with a few more "hello world" programs.
<ikatz> again, the manual has only a short section on that and its not very helpful in saying "if this is the error you get, this is what your'e doing wrong"
<neale> you know
<neale> I spent about a year trying to wrap my head around OCaml
<ikatz> neale: these experiences were a while ago
<neale> eventually I gave up and learned scheme instead
<neale> then when I came back OCaml was a breeze
<neale> (scheme was easy)
<neale> or rather
<neale> (was-easy scheme)
<neale> but I do remember thinking OCaml was like black magic
<thelema> ikatz: imagine a function that returns a module. Let that function take another module as its parameter, and you have a functor.
<ikatz> i get that
<ikatz> i've used that too
<thelema> then what's the problem with types?
<neale> of course the only documentation I could find was in French, and I'm still having trouble working through "Harry Potter et la Chambre des Secrets"
<ikatz> i just run into trouble where "expression has type string but is used here with type Mymodule.t"
<ikatz> when Mymodule.t = string
<thelema> does it equal that in the signature for Mymodule?
<ikatz> that's off the top of my head
<neale> ikatz: we're trying to solve your made-up examples
<ikatz> that's true
<neale> ikatz: because we all want to be helpful and explain specific things for you
<ikatz> we're talking about problems i once had... this discussion is entirely handwaving
<thelema> if Mymodule.t isn't defines as string in its signature, Mymodule.t != string
<neale> so next time you start scratching your head bring that to us and then we'll feel like we're doing the world some good :)
<ikatz> thelema: that is exactly the problem i was having
<ikatz> the manual assumed that i would do it right the first time, every time :)
<neale> ikatz: not that you need it now but the O'Reilly book seems pretty good, in case you have a colleague who's similarly interested.
<Smerdyakov> ikatz, maybe you should find a good book on OCaml and read it. A book on Standard ML would have helped with that problem, too.
<thelema> ikatz: sounds like you need to use 'with' http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html <- 6.10.4 "the with operator"
<ikatz> i have Harrop's book, its not too bad
<Smerdyakov> ikatz, the manual may not have helped you, but this is really the standard example of functors covered in every ML programming class.
<neale> Smerdyakov: they don't so much teach ML in American schools.
<neale> well, in most American schools.
<ikatz> that is definitely my experience :(
<neale> You get C++ and Java and a pat on the butt.
<neale> if you're lucky they might mention LISP, probably in the same breath as PROLOG, Modula, and Smalltalk.
thermoplyae has left #ocaml []
<Smerdyakov> neale, I don't see how that is relevant.
<ikatz> i have an SML NJ book, a book on caml from the early 90s, and Jon Harrop's book ... and moderate patience
<Smerdyakov> neale, I asserted neither that ikatz is American or that he has taken an ML programming class.
<Smerdyakov> s/or/nor
<ikatz> well... i am an american trying to teach myself some ocaml
<neale> Smerdyakov: in that case I don't see how mentioning it's a standard example in an ML class is relevant.
<ikatz> i got 6 weeks of SML in one of my university courses, but the rest is slef-taught
<Smerdyakov> neale, it's relevant because you will find some kind of reference for most of these classes.
<ikatz> yes, good old "slef", showing me the ropes. tomorrow he'll teach me typing
<ikatz> if you can recommend good books that contain common pitfalls of the ocaml newbie, i'll be grateful and probably get more sleep
<ikatz> so far i have O'Reilly
<ikatz> as a suggetion i mean, i don't own O'Reilly
<thelema> ikatz: running into type mismatches on functor application isn't a common pitfall of an ocaml newbie.
<ikatz> i'm not sure how to take that :)
<neale> Smerdyakov: ah. Here it is not so easy to find ML books at most bookstores.
<Smerdyakov> neale, I didn't say anything about bookstores. See, for instance, http://www.cs.cmu.edu/~rwh/smlbook/
<Smerdyakov> neale, I haven't read Jason Hickey's new OCaml book, but it's probably good.
<Smerdyakov> (also available free online ATM)
<neale> this whole debate is pointless, he's already figured it out.
<Smerdyakov> I don't think so. He can save painful future figuring out by reading a good book/.
<neale> But I think it might be unwise to assume that people have either taken an ML class or read an ML textbook, given that most other popular languages take great pains to explain the quirks that make them unique.
<ikatz> well... i'm by no means an expert at this point
<ikatz> i'd much rather read a good ocaml book than scratch my head between a manual and my code
<neale> I mean language implementations, not languages.
<ikatz> trial and error is no fun :(
<neale> ikatz: ah where's your sense of adventure?
<neale> I think learning how things work by trial and error is the most enjoyable part.
<ikatz> neale: its certainly not pressing C-c C-c, C-x `, and gritting my teeth repeatedly at 2:30am
<Smerdyakov> neale, I didn't assume that he's taken an ML class or read an ML textbook; rather, I suggested the latter.
<neale> ikatz: are you doing this for money then?
<ikatz> Smerdyakov: what's your favorite ml book?
<Smerdyakov> ikatz, the only one I've ever read is Harper's, which I linked above.
<ikatz> taking an AI class and they said i could program in any language i wanted
<ikatz> and i'd much rather use ocaml than java
<neale> Smerdyakov: My apologies, I completely missed where you mentioned a textbook would have helped.
<neale> I see it now.
<ikatz> i became reaonably skilled at higher order functions but i'm lacking in the functor department
<thelema> ikatz: get used to ocaml by programming at lower levels of abstraction first, then slowly move to higher levels
<ikatz> ok i'll check out the harper one
<ikatz> map and fold are the reasons i chose ml over java in the first place
<thelema> ikatz: use them. I count functors as much higher a level of abstraction than map and fold.
<ikatz> so do i :)
<neale> I glanced briefly at a book with a title like "ML for the C programmer" which I had to put down right after in chapter 1 he suggested students pass tuples to every function so that it feels more familiar.
<thelema> heh.
<Smerdyakov> Tupling is the standard calling convention of SML.
<neale> are you serious?
<Smerdyakov> Yes.
<Smerdyakov> It's a library thing, rather than a language thing, except for the treatment of infix operators.
<neale> doesn't that pretty much obliterate the coolness of easy currying?
<thelema> iirc, ocaml has code to optimize the tuple case
<Smerdyakov> neale, it also makes it easier to write functions that are generic in "complete lists of arguments."
<thelema> neale: sometimes I wish currying were a bit harder, so I could get much better error messages.
<neale> After having used OCaml for a few years I understand why the (French) tutorial I read started out with an introduction to lambda calculus.
<neale> it makes the whole thing seem so nice and simple
seafood_ has joined #ocaml
authentic has left #ocaml []
authentic has joined #ocaml
adu has joined #ocaml
<adu> I'm really starting to like OCaml, and i've never even used it!
<thelema> adu: why do you like OCaml?
<adu> because it has constructs that exactly correspond to my ideas about namespaces
<adu> just reading the docs, and it has stuff like "object ... end" and "module x = ..."
<adu> I've been learning Haskell for the past 10 years, and I've always thought it was so wierd how it does namespaces
<thelema> it has a very good module system, and its objects are pretty good too.
<thelema> keep learning it, you'll find a *lot* more to like.
<adu> Haskell "data" style records are similar to OOP objects, but where everything in the object has a global namespace, which got me thinking that objects in OOP languages put an implicit "namespace { ... }" around everything, and I was facinated that ocacml provides such a syntax
<zkincaid> hey - does anyone use ounit or similar for testing?
<adu> thelema: i bet
<thelema> zkincaid: I've used TestSimple before.
<zkincaid> thelema: is it recommendable?
<thelema> Yes. Although I guess I should prod its distributors to make public at least the 0.02 version they sent me.
<thelema> maybe you can do that. http://www.iinteractive.com/ocaml/
<zkincaid> thelema: Ok, thanks a lot -- I'll look into it
delamarche has quit []
<neale> zkincaid: I use ounit a lot.
<thelema> neale: how does it work for you?
<neale> it works
<thelema> it looks clunky to me.
<neale> I don't know what else to say about it
<neale> it doesn't tick me off
<neale> thelema: yeah but it's a unit test framework
<neale> lots of copying and pasting
<thelema> look at TestSimple?
<neale> I have not.
<neale> ounit is a debian package, worked, so I quit looking.
<neale> in general I'm not super-thrilled Maas-Maarten's code.
<neale> I wouldn't be surprised if there was something better.
<neale> sorry if there *were* something better
<neale> I think I just betrayed my nationality :\
Mr_Awesome has quit ["aunt jemima is the devil!"]
<thelema> :) We still like non-frenchies.
<neale> thelema: you are french?
<neale> I probably wouldn't have made that mistake, were English my second language.
<neale> In my defense I donated a liter of red blood cells today and just finished a beer.
<thelema> neale: unlikely.
<neale> well there was a lot of anticoagulant in the liter too
<neale> come on it sounds cooler when I say it was a liter
<ikatz> are there better french tutorials on ocaml?
<neale> undoubtedly, it seems ocaml is a part of many curricula in France.
<hcarty> thelema: If you are interested, I have made some changes to TestSimple 0.01 to include findlib support and build with ocamlbuild
<hcarty> Stevan Little sent me the updated version and said that he does not have time at the moment to post an update, but I am planning on updating the changes to 0.02 and sending them back to him
<hcarty> It does not make a huge difference, but I find it a bit easier to work with
<neale> I wish the users of pysieved were so helpful.
<hcarty> pysieved? Something you maintain I'm guessing?
<neale> it's my little homestead in the noosphere.
<thelema> hcarty: You don't have 0.02?
<hcarty> thelema: I do now - he sent it to me recently by email. I made the changes to 0.01 from the web site though
<thelema> ok.
<hcarty> I just need to merge the two
<neale> does anyone have a recommendation for an example of using a custom block to encapsulate a C struct?
<neale> I want an abstract block.
AxleLonghorn has joined #ocaml
goalieca has quit ["Ex-Chat"]
<neale> wow that is an amazing resource
<neale> I wish I'd had that last week
goalieca has joined #ocaml
<thelema> it's linked to from ocaml-tutorial.org
* thelema assumed you knew about it
<neale> actually that doesn't talk about abstract types
<neale> er, abstract blocks
<thelema> it doesn't. You don't *need* to use an abstract block to hold a C pointer.
<neale> no but the manual makes it sound like it's a very good idea
<thelema> there's an example of making a custom block in the manual...
<neale> I must have been reading the wrong page then, I don't see one in the section on "Interfacing C"
<neale> I'm sorry
<neale> I'm so off my nut tonight
<neale> I was looking for an example of an abstract block
<neale> and I ound one 20 minutes ago
<neale> you just set Field(thing, 0) = (value)my_struct_pointer
<neale> (after allocating it of course)
__suri has quit []
jonathanv has joined #ocaml
ulfdoz has quit [brown.freenode.net irc.freenode.net]
zkincaid has quit [brown.freenode.net irc.freenode.net]
seafood has quit [brown.freenode.net irc.freenode.net]
Dazhbog has quit [brown.freenode.net irc.freenode.net]
awesame has quit [brown.freenode.net irc.freenode.net]
rwmjones has quit [brown.freenode.net irc.freenode.net]
mbishop has quit [brown.freenode.net irc.freenode.net]
jonafan has quit [brown.freenode.net irc.freenode.net]
evn has quit [brown.freenode.net irc.freenode.net]
ziph has quit []
zkincaid has joined #ocaml
evn has joined #ocaml
jonafan has joined #ocaml
rwmjones has joined #ocaml
Dazhbog has joined #ocaml
awesame has joined #ocaml
mbishop has joined #ocaml
ulfdoz has joined #ocaml
seafood has joined #ocaml
jonafan has quit [Connection timed out]
ben has joined #ocaml
ben is now known as ziph
authentic has quit [Read error: 113 (No route to host)]
<tsuyoshi> it occured to me the other day that you could put a c pointer into an ocaml int
<tsuyoshi> as long as it's not a char pointer
<tsuyoshi> all the other pointers are aligned and so one bit is always zero.. so you could just do like Val_int(((unsigned)pointer) >> 1)
<tsuyoshi> and then you skip the extra allocation for a custom/abstract block, and you don't rely on the gc checking whether it's a pointer into the caml heap
<mbishop> anyone know who runs ocaml.cn?
<neale> tsuyoshi: for some reason I thought ocaml used one bit of an int literal for something or other
<neale> tsuyoshi: so it'd only work if you pointer didn't have the high bit set
<tsuyoshi> yeah it uses one bit, but Val_int takes care of that
<neale> doesn't that limit maxint?
<tsuyoshi> what do you mean?
<neale> like, you'd only get to store 31 bits
<neale> (or 63)
<tsuyoshi> exactly.. but I'm saying
<tsuyoshi> in a non-byte pointer, the low bit is always zero anyway
<neale> oh, right
<neale> that's crafty
<neale> is memory really byte-addressed?
<neale> or is that just on Intel
<tsuyoshi> depends on the processor.. but there are only a few processors these days that don't use byte addressing
<neale> that seems unfortunate.
<tsuyoshi> iirc on arm and alpha they have some kind of exception for nonaligned access (not for bytes)
<tsuyoshi> I remember there was some processor where char pointers were actually larger than other pointers.. I can't remember which one though
<neale> That would be the Cray.
<neale> it had to do all sorts of crazy math to do terminal I/O
<neale> but of course terminal I/O was not something it did a lot of
<adu> bytes are the way to go
<adu> although, i'm a big fan of 65536-bit bytes
johnnowak has joined #ocaml
<adu> but the 8-bit kind is more common...
<goalieca> lol
<goalieca> cray is weird
<adu> how does cray do it?
<goalieca> apparently they also used bjt's
<goalieca> cray does 1 bit operators only
<adu> ?
<adu> i want to learn about all electronics
<adu> but in the end, anything that gcc can be ported to is good enough
<adu> has anyone heard of FPGA?
<neale> fast programmable gate array?
<adu> i remember hearding about a company that was making a compiler for functional programming on an FPGA
<adu> ya
<neale> or the foxy professional golf association
<adu> which i suppose, would make it a functional programming gate array ?!?
<neale> I think its functionality would be entirely dependent on the quality of your program.
<neale> adu: isn't it insanely late in DC?
<goalieca> neale, field programmable
<adu> yes
<goalieca> i do vhdl sometimes
<neale> ah
<adu> neale: its midnight
<neale> I get a 75% :\
zkincaid has left #ocaml []
<hcarty> adu: Hello fellow DC person
<adu> hcarty: hello
* goalieca wonders if anyone else is in vancouver
<neale> you guys should meet up forc coffee!
<adu> i wish more languages tried to be all things to all programmers
<adu> hcarty: do you drink coffee?
<hcarty> And then goodnight fellow DC person, as it really it quite late
<adu> ok
<hcarty> adu: No, but if you want to chat up OCaml some time that's cool
<adu> there are only 3 languages that I can think of that are all things to all people
<neale> I want a functional imperative lazy/strictict evalutation language with optional strong typing and early or late binding.
<adu> lisp, ml, and oz
<adu> neale: does ocaml do that?
<neale> nothing does that.
<adu> o hehe
<adu> Oz is strict by default, but has a 'lazy' keyword to enable laziness
<neale> I forgot what that even means
<neale> I should go to bed
<adu> Haskell is lazy by default, but has the '!' operator to enable strictness
<adu> i wonder if ocaml has something like that
<thelema> adu: ocaml is strict, and has a 'lazy' keyword
<adu> i know nothing about OCaml, but I know a lot of Haskell and a little SML
<adu> thelema: o, cool
gim has quit [Read error: 110 (Connection timed out)]
<adu> thelema: i wonder which came first, ocaml or oz
<neale> right, it's "promise" and "force".
<neale> er, delay
<neale> gah that's it I'm out
* neale &
ppsmimou has quit [Read error: 110 (Connection timed out)]
<thelema> ozzloy: 1991 ocaml: 1996 caml: 1985
<thelema> err, oz: 1991
<adu> where do i find out more information about Caml?
<thelema> oops, ocaml-tutorial.org
<adu> thanks
adu has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
AxleLonghorn has left #ocaml []
catch22 has joined #ocaml
|Catch22| has quit [Read error: 104 (Connection reset by peer)]
netx has joined #ocaml
Jedai has joined #ocaml
catch22 has quit []
teip has joined #ocaml
<teip> how do i define a tuple?
teip has quit [Client Quit]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
ttamttam has joined #ocaml
ttamttam has left #ocaml []
dwmw2_AVF is now known as dwmw2_gone
l_a_m has joined #ocaml
szell has quit [Success]
jlouis has joined #ocaml
filp has joined #ocaml
gim has joined #ocaml
ppsmimou has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
filp has quit [Read error: 110 (Connection timed out)]
Tetsuo has joined #ocaml
filp has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
seafood_ has quit []
munga has joined #ocaml
goalieca has quit ["keep your stick on the ice"]
OChameau has joined #ocaml
Yoric[DT] has joined #ocaml
Yoric[DT] has quit [Client Quit]
Yoric[DT] has joined #ocaml
ppsmimou has quit ["Leaving"]
ppsmimou has joined #ocaml
seafood_ has joined #ocaml
seafood_ has quit [Client Quit]
hkBst has joined #ocaml
<letrec> Hi! In In32 module, the name of logand, logor and logxor is misleading: what they do is bitwise operation, as opposed to logical operations. The I wonder what the log stands for in logand ? Also, is there a way to do real logical and on Int32 numbers then?
<Yoric[DT]> iirc, for ints, it's called land, lor, etc.
<Yoric[DT]> So it's perhaps misleading but it's consistent.
<tsuyoshi> for logical and.. wouldn't you just convert to bool?
<letrec> Well, no need to convert, I'll just write it with if then else. Was just wondering whether it is available from the library.
StoneNote has quit []
<letrec> What is the boolean operator for xor in ocaml?
|Catch22| has joined #ocaml
<jlouis> letrec: that ought to be in the manual
<johnnowak> go bedroom
<johnnowak> ... ooops.
* johnnowak returns to his interactive fiction
seafood_ has joined #ocaml
authentic has joined #ocaml
* Yoric[DT] just loves doing static analysis of C.
seafood_ has quit []
|Catch22| has quit []
<ziph> The only problem I can see with ocaml is you can spend a week writing 300 lines of code.
RobertFischer has quit ["I'm out of here. Check out my blog at http://enfranchisedmind.com/blog or my company website at http://smokejumperit.com"]
<flux> ziph, for how long have you used ocaml?
RobertFischer has joined #ocaml
<ziph> A couple of weeks.
<flux> I'm thinking the unfamiliarity will go away in time
<ziph> I hope not. :)
<ziph> It's very dense expressive code. :)
<RobertFischer> It's like the same buddies here all the time. :)
<RobertFischer> Anyone have experience with Ocsigen and want to give me a frank assessment?
<RobertFischer> Okay, I guess not. That's cool, too.
johnnowak has quit []
<ziph> I haven't done web programming for a while, does it still suck? :)
<RobertFischer> Yeah. Despite promises to the contrary.
bongy has joined #ocaml
coucou747 has joined #ocaml
<RobertFischer> And the whole dynamic language dominance in that area isn't really helping.
* RobertFischer is working on both a Ruby on Rails and Groovy on Grails project right now.
<RobertFischer> Neither is really "there".
<ziph> Ruby looks fairly sucky compared to Python and Smalltalk. Kinda like they missed the real point of both. ;)
johnnowak has joined #ocaml
<ziph> What's the best way of doing "match n with 1 -> ... | 2 -> ..." whilst giving 1, 2, etc symbolic names?
<RobertFischer> Ruby's really nice if your previous experience is Perl or PHP.
<RobertFischer> ziph: What do you mean "symbolic names"?
johnnowak has quit [Client Quit]
<RobertFischer> You want to do something like let x = 1 in match n with x -> ...
<RobertFischer> ?
<ziph> I want to define 1, 2, etc as constants.
<flux> ziph, one way is match n with x when x = bar -> .. | x when x = baz -> .., the other is to have something like (List.assoc constant_1 [constant_1, (fun () -> ..); constant_2, (fun () -> ..)]) ()
<ziph> RobertFischer: I had the realization recently that Ruby's popularity was due to Perl and PHP users upgrading rather than programmers from more modern languages (like Smalltalk *g*)
<RobertFischer> I've been fighting with that world for a while.
musically_ut has joined #ocaml
<ziph> I've never been able to figure out where you'd use Thread#raise (and similar methods in other languages).
hasone has quit [Read error: 110 (Connection timed out)]
hasone_ has joined #ocaml
hasone_ is now known as hasone
<flux> ziph, you mean exceptions?
<ziph> I mean raising an exception on a 'remote' thread.
<flux> oh, right
<flux> that does indeed sound risky
AxleLonghorn has joined #ocaml
<jlouis> sounds risky? It sounds like you are driving a bandwagon of whores through a monastery and expect the monks to behave.
<ziph> I'd like to see that.
<jlouis> The *current* java semantics for thread programming is sinisterly subtle. There are all kinds of pit-falls. So I wonder how many more you add when you have the ability to kill a thread and to raise an exception in a remote thread.
<ziph> Killing a thread is fine if you're writing monitoring or shutdown code.
<ziph> Raising an exception seems pointless though.
<flux> isn't raising an exception much nicer than killing?
<flux> how about if there was an exception CPUTimeSoftLimitExceeded?
<ziph> Do you want it catching it? :)
<flux> I said "soft" right there for a reason ;)
<flux> if it was a long operation it might still want to finish up
<ziph> Send it a message.
<ziph> If it doesn't go away after the message, follow up with a kill. :)
delamarche has joined #ocaml
AxleLonghorn has left #ocaml []
delamarche has quit []
jonathanv is now known as jonafan
middayc has joined #ocaml
<letrec> Why is this not working? let f x = match x with (Int32.one) -> true | _ -> false;;
<letrec> let f x = match x with 1->true|... works!
<ziph> # match 1l with (Int32.one) -> true | _ -> false;;
* ziph pokes the bot.
<ziph> In any case, isn't that similar to "let z = 2 in match x with z -> ..." ?
<ziph> (Except that it wouldn't let you rebind Int32.one)
<letrec> ziph: Rewriting it with a if statement is no problem anyway, but I was wondering was the pattern matching doesn't work there. I've had some bug because of this.
postalchris has joined #ocaml
<ziph> Probably because it doesn't know if you want to bind a variable or use its contents for matching.
<petchema> # 2l ;;
<petchema> - : int32 = 2l
<ziph> # 2l ;;
<ziph> :(
<petchema> xavierbot is not in the channek
<petchema> s/channek/channel/
<ziph> # Irc.join xavierbot "#ocaml";;
<thelema> letrec: Int32.one isn't a literal, so matching against it tries to use that name to set a binding.
<ziph> It works in Erlang. *g,d*
pango has quit [Remote closed the connection]
pango has joined #ocaml
<letrec> I don't really get it. Example: type T = T of Int32.t;; let tone = Int32.one;; let f x = match x with T tone -> true | _ -> false;;
<thelema> letrec: tone is a variable name.
<letrec> This compiles, but you get the warning: Warning U: this match case is unused.
<thelema> let f x = match x with T y -> true | _ -> false
<thelema> just like y is a variable name.
<petchema> matching a value against T tone will bind tone locally, not use previous definition of tone
<letrec> So f always return true ???
Morphous has joined #ocaml
<thelema> letrec: ocaml doesn't do matching like this -- *only literals* get used for comparisons.
<petchema> that's why constructors take a capital, to make it visually obvious what happens during pattern matching
<letrec> Ok, tone is redefined, I understand, thx.
<thelema> let f x = match x with T 1l -> true | _ -> false
<hcarty> letrec: let f x = match x with y when y = Int32.one -> true _ -> false;; should do what you want
<petchema> use 1l instead of Int32.one, and you won't need all this noise
<petchema> Int32 litterals can be written with l suffix, Int64 => L suffix, nativeint => n suffix
szell has joined #ocaml
Jomyoot has joined #ocaml
<Jomyoot> hi
Jomyoot_ has joined #ocaml
Morphous_ has quit [Read error: 110 (Connection timed out)]
<thelema> hi Jomyoot
Linktim has joined #ocaml
ikaros has joined #ocaml
authentic has quit [Read error: 113 (No route to host)]
<stugy> Does anyone know where caml_ba_array is declared? I'm running across it in some C code, but I can't find the declaration or definition.
Linktim_ has joined #ocaml
<thelema> #define Caml_ba_array_val(v) ((struct caml_ba_array *) Data_custom_val(v))
<thelema> stdlib/caml/compatibility.h:#define caml_bigarray caml_ba_array
<thelema> otherlibs/bigarray/bigarray.h:struct caml_ba_array {
<thelema> there we go.
<stugy> ah, there it is
<stugy> thanks. lacaml keeps complaining about it's absence
ziph has quit []
Jomyoot has quit [Read error: 110 (Connection timed out)]
<stugy> odd, I have bigarray.h, but caml_ba_array is nowhere in it
marmottine has joined #ocaml
<thelema> any structs that look like "'void * data; intnat num_dims; intnat flags; ...?
<stugy> oh. It changed since 3.09
<hcarty> stugy: What version of OCaml do you have? If I remember correctly, some C bigarray functions were added/changed around 3.10.0
<stugy> stupid gentoo. You're supposed to be bleeding edge
<hcarty> oops, I should look before hitting enter :-)
<stugy> hcarty: well remembered
<hcarty> stugy: You can try GODI
Linktim has quit [Success]
<stugy> shiny
<stugy> I'll give that a shot, thanks
musically_ut has quit [Remote closed the connection]
Jomyoot has joined #ocaml
<RobertFischer> Gentoo's Ocaml package should not be used.
<RobertFischer> "is considered harmful" might be more appropriate.
<RobertFischer> Use GODI.
* RobertFischer knows the pain well, stugy.
Jomyoot_ has quit [Read error: 104 (Connection reset by peer)]
|Catch22| has joined #ocaml
RobertFischer has quit ["I'm out of here. Check out my blog at http://enfranchisedmind.com/blog or my company website at http://smokejumperit.com"]
<stugy> yes, I'm learning the pain
<letrec> At the moment, I'm hardcoding my pattern matching. I'm writing some stuff like match e with Binop (AND, Const i1, Const i2) -> Const (my_and i1 i2) | ... I was wondering whether there would be a more abstract way of describing these kind of transformations? You could define what has to be matched in a file, and the program would load this and proceed with the match and transformation. Any known example of that?
<stugy> Though sometimes I feel like I have more package managers than packages
<letrec> Long question, thx for reading :)
<thelema> letrec: too many levels of abstraction, I think.
bongy has quit ["Leaving"]
<letrec> So you wouldn't do it? Too complex?
<thelema> I wouldn't. The most I might do, if you had a *lot* of binops would be:
<thelema> Binop (op, Const i1, Const i2) -> Const ((lookup_fun op) i1 i2)
bluestorm has joined #ocaml
<letrec> Issue is, for some op, this transformation doesn't hold. So I cannot use that.
<thelema> Binop (op, Const i1, Const i2) when transform_ok op -> Const ((lookup_fun op) i1 i2)
<letrec> Ok, thx. Can I write: match e with pattern0 | pattern1 -> ... | pattern 2 -> ... ?
ikaros has quit ["segfault"]
<thelema> yes, but you have to use the same identifiers in each pattern.
<thelema> another way to do the transform_ok would be through polymorphic variants.
<thelema> Binop (#transformable, Const i1, Const i2) -> Const ((lookup_fun op) i1 i2)
<thelema> Binop (#transformable as op, Const i1, Const i2) -> Const ((lookup_fun op) i1 i2)
<letrec> Syntax error on: | Relop (LAND, Const i1, e1) | Relop (LAND, e1, Const i1) -> ... ??
<bluestorm> are you sure the error is there ?
<letrec> Yes I am.
<letrec> | Relop (LAND, Const i1, e1) -> ... | Relop (LAND, e1, Const i1) -> ... compiles
ttamttam has joined #ocaml
<thelema> # match 3 with 1 | 2 -> false | 3 | 4 -> true | _ -> false;;
<thelema> - : bool = true
<thelema> letrec: pastebin your broken code.
<letrec> Well, it's huge, and you need 3 modules to compile.
love-pingoo has joined #ocaml
<thelema> some more context around the "syntax error" will do.
Jomyoot has quit []
filp has quit ["Bye"]
Linktim_ has quit [Read error: 110 (Connection timed out)]
<letrec> Syntax error line 7
<bluestorm> because of the additionnal | ?
<thelema> letrec: too many |
<letrec> Oups, yes, sorry
WatersOfOblivion has joined #ocaml
WatersOfOblivion has quit [SendQ exceeded]
WatersOfOblivion has joined #ocaml
OChameau has quit ["Leaving"]
gim has quit [Read error: 110 (Connection timed out)]
munga has quit [Read error: 110 (Connection timed out)]
ppsmimou has quit [Read error: 110 (Connection timed out)]
ita has joined #ocaml
kotarak has joined #ocaml
ppsmimou has joined #ocaml
gim has joined #ocaml
munga has joined #ocaml
<flux> rwmjones, hey, regarding ocaml-newt: put the .mli or the generated .html online too, nicer for the curious bystander ;)
<ita> ocaml-newt?
<rwmjones> flux yes
<rwmjones> I'm preparing a more complete / newer version now anyway
<hcarty> rwmjones: How do you feel about camlidl (for the simple stuff at least) after using it for ocaml-newt?
<rwmjones> hcarty, flux, ita: temporary copy of the documentation as it stands right now: http://www.annexia.org/tmp/newt-html/Newt.html
<rwmjones> hcarty, pain in the derriere
<rwmjones> but I am still using camlidl
<mbishop> Does anyone know who runs ocaml.cn? they need to fix it
<ita> sweet
<rwmjones> Newt is a horrible library to interface with
<rwmjones> it's just a nasty hunk of unchecked, confused C code
<rwmjones> no meaningful way to clean up structures properly, etc.
* rwmjones is submitted patches to fix the egregious problems
<rwmjones> submitting
<hcarty> I think I have gotten off easy ... both PLplot and HDF have fairly simple interfaces so camlidl has handles most of the functions without trouble
rwmjones 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!)
<hcarty> It would be nice to generate a tool using FrontC to generate camlidl input
<rwmjones> hcarty, it'd be nice to use something like FrontC (CIL) to generate bindings ... I don't think going via camlidl would be worthwhile, maybe not even possible. A major undertaking mind you ...
<hcarty> Sadly I think that is beyond what my (f time know_how) will allow
<rwmjones> if I had (say) 6 months I'd take all the C libraries in a big Linux distro and see if it is possible to automatically generate generalised bindings for them, and from those general bindings, generate language-specific bindings
<hcarty> I tried getting Forklift to work, but was unable to do so in the time I had
<flux> fully automatic? I suppose it's _possible_, but the interfaces would be very unocamlish
<flux> but perhaps that would be ok
<hcarty> Swig seems like it could be decent, but the interfaces it generates are rather thick and ugly
<flux> you would perhaps even need to reveal pointer types etc to ocaml
<flux> so they would become unsafe.. much, much annotations would be needed to convert a .h to .mli
<rwmjones> making good bindings is part of the problem, of course
<hcarty> I think camlidl's end results tend to do a decent job of hiding the "C-ish-ness" of the original library IF you are very careful with the input to camlidl
<flux> but perhaps good tools that would help the creation of the bindings could be deviced
<hcarty> AND the functions you are wrapping are fairly simple
<rwmjones> the problem is real the limits of camlidl are apparent quite quickly
ita has quit [Read error: 104 (Connection reset by peer)]
<rwmjones> eg. typedef struct someObject *someObjectPtr;
<rwmjones> is not exactly uncommon in C
<rwmjones> but camlidl really doesn't handle that well
<flux> camlidl could surely be enhanced? but nobody's taken the ball ;) (no, I'm not volunteering..)
<hcarty> rwmjones: Yes, it requires a lot of manual intervention. And if the C library is inconsistent then you lose the benefit of that intervention.
<flux> has anyone taken a look at camlidl implementation?
<rwmjones> with newt I went for a layered approach
<rwmjones> so camlidl generates "internal" bindings (which are relatively unsafe)
<rwmjones> then I wrap with a library to make it safe
<rwmjones> and still have to generate some bindings completely by hand though
<hcarty> flux: I think it could be with some extra tools. camlidl is QPL and the libs are LGPL, so it is modifiable.
<hcarty> In my case most of the functions are similar to f(float* x, int length_of_x) so those are handled by camlidl easily enough
<hcarty> But anything with callbacks and void* in general is wrapped by hand
<hcarty> I think these could be made much easier with the right "camlidl toolkit", but I do not know what pieces should go in to such a thing
ttamttam has left #ocaml []
thelema has quit [Read error: 110 (Connection timed out)]
<flux> hm, I would personally prefer some BSD (no advertising clause)-kind of license for runtime libs. it feels a bit non-respecting to write bindings that have LGPL restrictions for a BSD-licensed library..
<neale> some folks might argue that releasing BSD-licensed code is disrespectful to contributors.
<hcarty> flux: From the perspective of the person writing the binding - the binding code is theirs, not the wrapped library author's. So while I certainly understand your position, I think it can be argued equally effective both ways.
<neale> I, however, don't want to get into that argument.
<bluestorm> i'll be happy with whatever (free, GPL-compatible) licence there is
<flux> I would like a situation where writing ocaml software would impose no bigger responsibilities to you than writing the same programs using C.
<neale> libc is LGPL on GNU/Linux
<neale> I think Oracle still links against it.
<jlouis> In general the easiest way to go is to stick to the original license if at all possible
<neale> yes.
<bluestorm> flux: do the LGPL add obligations to the *users* of the lib ?
<hcarty> Most bindings do stick to the original license though, don't they?
<jlouis> Multi-licenses tend to stir up all kinds of problems.
<flux> bluestorm, I'm writing from the perspective of a software developer, no?
<bluestorm> hm
<bluestorm> i mean, even software developper using the lib you wrote
<flux> neale, there still appears to be some non-GNU systems around..
<bluestorm> software developper users :p
<neale> flux: I'm just pointing out that, at least on systems with glibc, you're already linking against an LGPL library when you use C.
<flux> neale, it doesn't change the point I had, though
<neale> so having an LGPL OCaml library would satisfy your condition of "impose no bigger responsibilities to you than writing the same programs using C."
evn_ has joined #ocaml
<flux> not really, because the LGPL'd part would cover a bigger area
<flux> and lgpl is funny with ocaml anywya, as there are no shared libraries
<neale> Yeah, I should read my scrollback before I say anything else.
<bluestorm> hm
<hcarty> Are there no shared libraries at all with OCaml, or just none for native code? I am unclear on that...
<bluestorm> i still do not understanrd : if you are writing a binding for example, that you use LGPL (+ linking exception for ocaml concernes and so on), what are the "bigger responsibilities" the people using this binding will have (compared to, for example, the initial BSDed C library) ?
<neale> Static linking creates a compilation, not a
<neale> derivative work. It's the same as an aggregation
<neale> of dynamically linked components packaged in
<neale> one single archive.
<flux> the obvious one: if they modify the bindings, they would need to redistribute
<bluestorm> i thought the ~only difference was that the binding code itself was copyleft
<flux> let's say you modify the original bsd-licensed library
<flux> add a feature
<evn_> i think even if you don't you have to allow the target objects to be relinkable with new bindings
<bluestorm> ah, i see your point
<flux> now you have lgpl wrapper, and you need to modify that too
<evn_> which could be super awkward
<flux> but now you need to distribute the source to the lgpl wrapper
<flux> were you writing in C, none of this would be required
<bluestorm> it's quite convincing :]
<neale> what?
<flux> I suppose you have have the chance of writing new bindings under a license of your choosing
<neale> I don't get the argument, all I see is that if you modify LGPL code you have to give the changes back to the author. What's the big deal?
<bluestorm> neale: the deal is that you would not have had with the pure-C BSDed code
<neale> so you're saying that LGPL code is a problem because it's not BSD?
<flux> that's another point. wrappers are usually so thin, the actual library they are wrapping is doing the heavy lifting.
<bluestorm> if, say, you add a ~proprietary feature to the BSD code, then you want to mirror it to the binding
<bluestorm> you'll have to open-source the binding part
<neale> but the binding part is already open source
<bluestorm> wich can be, with that point of view, inconvenient
<flux> lgpl itself isn't a problem. the problem exists only when you wrap an X-licensed library with Y-licensed wrappers, where X <> Y
<hcarty> But the binding author may want that inconvenience to be there... depends on their interests and intentions
<neale> We did this all the time at my last job and it was really no big deal.
menace has joined #ocaml
<neale> You make a change to the underlying non-free code and send out a patch to the free code.
<hcarty> As flux said, if a user/developer is unhappy with that then they can rewrite the binding themselves
<flux> and isn't that great, multiple bindings for one library :)
<neale> I can't imagine why they'd bother, unless they had some sort of philisophical bone to pick with the LGPL.
<flux> I would rather see the bindings as an integral part of the original library
<flux> having two licenses for a single library feels inconvenient.
<bluestorm> neale: i could understand that if you want to add super-secret proprietary features to the C lib, you don't want to make them apparent trough a copyleft binding
<neale> bluestorm: that sort of situation is exactly what motivated the creation of the GPL
<bluestorm> of course
<flux> and that's why libc is LGPL, great
<bluestorm> but neale, if the original author of the library used BSD, it could be to allows such nasty things
<bluestorm> as flux said, it is in some way "respectful" to allow it too
<neale> so what I'm getting here is that you guys disagree with the philosophical backing of the GPL, and that's fine, but it feels like you're using a strawman argument to promote your unrelated philosophy.
<bluestorm> hm
<bluestorm> i generally advocate the use of the GPL
<bluestorm> but in this case, you have to deal with the will of another developper(s) (the C library writer(s))
<bluestorm> flux argued that it was fair (or "polite" if you want) to allow the same things with your bindings that with the original work
middayc_ has joined #ocaml
<neale> I guess I just don't see how it's that big a hassle, it only affects people who don't want to share, and penalizing people like that is the point.
<bluestorm> it may be the point of the binding writer
<bluestorm> but it wasn't the point of the BSDed lib writer
<flux> neale, you could do that with the original library already, so what's the big deal?
<neale> but both are doing valuable work, no?
<neale> shouldn't it be the author's perogative?
<flux> well, the amount of work writing the bindings are assumed to be very small, compared to the original library
<flux> obviously I cannot force any a license to any author: so, yes, and it is.
<flux> I'm just providing a viewpoint on how it "should be" in my opinion
<neale> I suspect situations such as this have arisen in the past, and the result, if the library author has a problem with it, is that someone rewrites BSD bindings which are then bundled with the original library.
<flux> and how useful is that?
<flux> who gains from the work the binding-user author needed to do, to do the exact same task?
<hcarty> It would be very useful to someone who wants to add a closed modification. Less so for others.
<flux> and there aren't that many different approaches to writing bindings to a library
<flux> in my opinion bindings don't really provide much "original work" as to be a significant work to be licensed separately.
<neale> well I'd say that it's philosophically very useful, and that it's irrelevant to discuss the technical utility of a philisophically-motivated action.
<hcarty> Work depends on how thin or thick the binding is - there can be a lot of work in writing a clean, high level binding to a low-level C library
<flux> compared to the original library, though, it is hardly significant?
<flux> unless it provides some new functionality
<hcarty> It may significant to the author of the binding
<neale> it would obviously be significant to anyone who thinks its worthwhile to embark on such a thing.
<flux> well, it's diffucult to argue that :)
<hcarty> If it were insignificant, then the reimplementation of the binding would not be an issue
<flux> yes. I just view that as a global pessimization.
<neale> but I would agree that it seems like a waste of effort when viewed from a technical perspective.
<neale> it seems however that there is a surplus of effort these days.
<hcarty> I respectfully feel the same about the issue of bindings not being worth their own license :-)
<neale> actually, me too.
middayc has quit [Read error: 110 (Connection timed out)]
<neale> I just can't pass up a good argument.
jlouis_ has joined #ocaml
<neale> If you write a little binding you should send it in to the library author.
<neale> unless the library author is Oracle or something.
<neale> then you have a moral obligation to prevent them from trying to sell it.
<flux> can't you just be happy that people use the code and solve problems with it?-)
<hcarty> And can't you just share everything you write? :-)
<hcarty> (joking, of course)
love-pingoo has quit [Read error: 110 (Connection timed out)]
<neale> I have eaten from the tree of knowledge of why software is political and the cherub won't let me back into the garden of just being happy that people are using my code.
<neale> stupid cherub.
<hcarty> Personally, as someone doing research, the thought of having my publicly funded research turned in to something not publicly beneficial is rather distasteful
love-pingoo has joined #ocaml
<hcarty> I could see a privately funded company feeling differently about their own work though.
jlouis_ has quit ["leaving"]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
<bluestorm> [20:43:37] <neale> then you have a moral obligation to prevent them from trying to sell it.
<bluestorm> hm
<bluestorm> Oracle actually "sell" GPL code, don't they ?
<neale> I was just being flippant
leiff has joined #ocaml
<leiff> i'm getting syntax error for a snippet of my code here: http://rafb.net/p/aWC3Fy52.html
<leiff> does anyone know how to fix this? i've documented everything in the link
<hcarty> leiff: Try replacing "and" with &&
<flux> mmh
<flux> doesn't he really want to do an imperative assignment?
<hcarty> I'm just looking at the syntax, not what is being done... likely a bad move on my part
<flux> leiff, you create a new "variable" with let head = ref 0, refer to it with !head and assign to it with head := 42
<flux> however, perhaps it's a good idea to refer to some tutorial or even the official documentation
<neale> Indentation could be better.
menace has left #ocaml []
<pango> beware of sub'
<neale> nothing personal but that function is a mess
<neale> I'm going to agree with flux on the tutorial suggestion
<leiff> hcarty: i'm still getting syntax error now on this line: in match tail with line
<neale> you're going to get a bunch of other syntax errors after that too
<hcarty> leiff: They are correct. I didn't read over the code properly.
<hcarty> I don't think it does what you want it to do
<hcarty> "=" is comparison, not assignment, for one
<leiff> hcarty: yes, i'm using it as a comparison
<leiff> Less is just a type i created
<hcarty> tail is not in scope at that point, unless I am reading this incorrectly
<leiff> how would i do something like this? (if expr then let x = y else let x = z) and then continue on
<hcarty> let x = if expr then y else z
thelema has joined #ocaml
<hcarty> let x = if expr then y else z in ... actualy
<hcarty> ack, actually
<hcarty> ocaml-tutorial.org
* thelema finds curious the idea that OCaml bindings to C code have to be written in C - why can't we write them in OCaml?
leif1 has joined #ocaml
<hcarty> thelema: ciml kind of lets you write them in OCaml
leif2 has joined #ocaml
<thelema> hcarty: that's still writing C.
<neale> I just cleaned up what you had, I made no attempt to figure out what it was supposed to *do*.
<hcarty> thelema: Hence "kind of" :-) ... it may come down to callbacks, void* and things like that
<thelema> hcarty: ciml does contain one piece of the puzzle - automatic conversion to/from base data types
<pango> head :: [] = [head], so there's no real need to handle separately the last two cases
<pango> the first two cases can be merged (| list, [], 0 | [], list, 0 -> list) but it may or may not be seen as an improvement
<WatersOfOblivion> As I understand, CamlIDL, etc. go C -> OCaml. Does anything go OCaml -> C?
<hcarty> thelema: Forklift is an attempt at doing something similar as well
<hcarty> WatersOfOblivion: I do not think there are any automated tools available for that
<mbishop> forklift never seemed to make it off the ground (ho ho)
<pango> and if anything, finding a better identifier for that function could greatly improve readability
<WatersOfOblivion> It would seem that being able to define a bunch of "val external"s and generate C stubs would be convenient, esp. for generating very simple bindings.
<WatersOfOblivion> Prolly could be done with CamlP4
leif2 has quit [Read error: 104 (Connection reset by peer)]
<thelema> I admit that not everything can/should be done on the OCaml side, and there's a use for the existing method of binding with C. But for simple bindings, the conversion to/from C types seems not too difficult to do automatically
<thelema> the existing method requires the C to adapt to OCaml conventions. Can OCaml adapt / automatically interface with C conventions?
<evn_> like swig?
<hcarty> Yes, swig seems to do that. But the result is a little ugly
<hcarty> Every value from C is wrapped in a Swig_C variant type
<hcarty> not Swig_C... c_obj
<thelema> no, swig generates wrapper code in C.
<evn_> hmm
<hcarty> The OCaml interface to that code uses that c_obj type to pass values back and forth though
<evn_> im confused if you're interested in accessing ocaml data from C or C data from ocaml
<thelema> i.e. I'd like to be able to say [external get_an_int : (c_void :> unit) -> (c_int :> int) = "send_an_int"]
<hcarty> Isn't that more or less what ciml does?
<evn_> colloquy put smiley faces in your code :/
<thelema> to access a C function that takes no parameters and returns an int.
<thelema> hcarty: ciml does part of that, yes.
leiff has quit [Read error: 110 (Connection timed out)]
<hcarty> I see.. automating the call to send_an_int
leif1 has quit [Read error: 110 (Connection timed out)]
<thelema> I guess ciml could do that: letext send_an_int unit : int = << Return(send_an_int()); >>
<hcarty> Adding array support would open it up a lot, but probably add a significant amount of complexity to the camlp4.
marmottine has quit ["Quitte"]
wy has joined #ocaml
kotarak has quit [":qa!"]
yminsky has quit [Read error: 110 (Connection timed out)]
wy has quit ["Leaving"]
coucou747 has quit ["bye ca veut dire tchao en anglais"]
yminsky has joined #ocaml
StoneNote has joined #ocaml
WatersOfOblivion has quit ["Leaving"]
|Catch22| has quit [Read error: 113 (No route to host)]
|Catch22| has joined #ocaml
thermoplyae has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
evn_ has quit []
seafood_ has joined #ocaml
bluestorm has quit ["Konversation terminated!"]