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 ["Hasta luego!"]
rwmjones_ has quit ["Closed connection"]
carrumba has quit []
<Yoric[DT]> 'night
Yoric[DT] has quit ["Ex-Chat"]
seafood_ has joined #ocaml
jstanley has left #ocaml []
seafood_ has quit []
thelema|away has quit [Read error: 110 (Connection timed out)]
postalchris has quit [Read error: 110 (Connection timed out)]
camln00b has quit ["Ex-Chat"]
pattern has joined #ocaml
ecc has quit [Read error: 101 (Network is unreachable)]
ecc has joined #ocaml
middayc_ has quit [Read error: 110 (Connection timed out)]
Jedai has joined #ocaml
postalchris has joined #ocaml
brian`` has quit [Read error: 110 (Connection timed out)]
TheLittlePrince has joined #ocaml
postalchris has quit ["Leaving."]
seafood_ has joined #ocaml
AxleLonghorn has joined #ocaml
hsuh has quit [Remote closed the connection]
yminsky has quit [Read error: 104 (Connection reset by peer)]
Jedai has quit ["KVIrc 3.2.6 Anomalies http://www.kvirc.net/"]
AxleLonghorn has left #ocaml []
seafood_ has quit []
hsuh has joined #ocaml
hsuh has quit [Remote closed the connection]
ReachingFarr has joined #ocaml
seafood_ has joined #ocaml
zbrown has quit [Remote closed the connection]
zbrown has joined #ocaml
thelema|away has joined #ocaml
pattern has quit [Remote closed the connection]
pattern has joined #ocaml
thelema|away is now known as thelema
<flux> thermoplyae, there are some dumping libraries for debugging purposes though; and for generic outputting options such as sexplib any ty_with exist
__suri has quit []
ReachingFarr has quit ["Leaving."]
thermoplyae has quit ["daddy's in space"]
mwc has joined #ocaml
petchema has quit [Read error: 113 (No route to host)]
brooksbp has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
olleolleolle has joined #ocaml
Snark has joined #ocaml
smimram has quit ["bli"]
thelema is now known as thelema|away
smimou has joined #ocaml
thermoplyae has joined #ocaml
seafood_ has quit []
seafood_ has joined #ocaml
brooksbp has quit [Read error: 110 (Connection timed out)]
thermoplyae has quit ["daddy's in space"]
hkBst has joined #ocaml
seafood_ has quit []
OChameau has joined #ocaml
Tetsuo has joined #ocaml
filp has joined #ocaml
TheLittlePrinceO has joined #ocaml
TheLittlePrinceO has quit [Client Quit]
TheLittlePrince has quit [Client Quit]
TheLittlePrince has joined #ocaml
TheLittlePrince has quit [Read error: 104 (Connection reset by peer)]
middayc has joined #ocaml
TheLittlePrince has joined #ocaml
<schme> Does ocaml support scheme-like continuations?
petchema has joined #ocaml
<flux> there is a library for call-cc. it does use some dirty tricks to accomplish it, though, and I don't think supports native code.
<flux> I think there is also a monad-based call-cc library
<flux> which would of course work with any ocaml
<schme> Hmmm..
<schme> I'll look into that, thanks.
<flux> report back what you find :-)
<schme> Judging by my current rate of actually learning how to use ocaml I think I'll report back in 3 years or something (:
<schme> I found this "There is no callcc in Ocaml. You may have used this feature with other implementations of ML, say SML-NJ. The implementation technology of the latter is based on continuations, which makes callcc easily available. Ocaml implementation is not based on continuations, but on stacks: it proved to be fairly more efficient, but you lose callcc."
<schme> egh.
<schme> I guess it could be solved by dirty hacks, ya :)
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
olleolleolle has quit []
hsuh has joined #ocaml
hsuh has quit [Remote closed the connection]
letrec has quit [Read error: 104 (Connection reset by peer)]
letrec has joined #ocaml
Tetsuo has quit [Remote closed the connection]
olleolleolle has joined #ocaml
olleolleolle has left #ocaml []
Jedai has joined #ocaml
brooksbp has joined #ocaml
brooksbp has quit [Client Quit]
seafood_ has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
seafood_ has joined #ocaml
seafood_ has quit [Client Quit]
letrec has quit [Read error: 110 (Connection timed out)]
seafood_ has joined #ocaml
jonathanv has joined #ocaml
seafood_ has quit []
Snark has quit ["Ex-Chat"]
jonafan has quit [Read error: 113 (No route to host)]
petchema has quit [Read error: 110 (Connection timed out)]
TheLittlePrince has quit [Client Quit]
thelema|away has quit [Read error: 110 (Connection timed out)]
TheLittlePrince has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
jlouis_ has joined #ocaml
TheLittlePrince has quit [Client Quit]
jlouis has quit [Read error: 110 (Connection timed out)]
WhiteSands has joined #ocaml
<WhiteSands> Hi all. I'm sorry for asking this in here but in SML. What does eqtype stand for? Where can I find a language reference for SML?
WhiteSands has quit []
svenl has quit [Read error: 104 (Connection reset by peer)]
svenl has joined #ocaml
Tetsuo has joined #ocaml
jlouis has joined #ocaml
petchema has joined #ocaml
Illocution has left #ocaml []
jlouis_ has quit [Read error: 110 (Connection timed out)]
Optikal_ has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Morphous has joined #ocaml
TheLittlePrince has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
robyonrails has joined #ocaml
bluestorm has joined #ocaml
robyonrails has quit ["Leaving"]
<hcarty> You are more likely to get a good answer in #sml
<hcarty> Oops... gone
Amorphous has quit [Read error: 110 (Connection timed out)]
bongy has joined #ocaml
TheLittlePrince has quit [Client Quit]
bongy has quit [Remote closed the connection]
mwc has quit ["Leaving"]
jonathanv is now known as jonafan
Optikal_ has left #ocaml []
thelema has joined #ocaml
bongy has joined #ocaml
bongy has quit [Read error: 104 (Connection reset by peer)]
olleolleolle has joined #ocaml
olleolleolle_ has joined #ocaml
olleolleolle_ has quit [Remote closed the connection]
olleolleolle has quit [Read error: 104 (Connection reset by peer)]
OChameau has quit ["Leaving"]
marmottine has joined #ocaml
Optikal_ has joined #ocaml
<Optikal_> Does anybody know a good laymans definition of a monad for someone who is not well versed in functional programming?
<bluestorm> how much "not well" ?
<bluestorm> if you are not fluent with higher-order functions, it will be quite difficult
<Optikal_> No, I am fluent with that
<bluestorm> hm
<bluestorm> can you read basic Haskell code ?
<Optikal_> How about: What problem are they intended to solve?
<bluestorm> if so, the beginning of http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf is a really good introduction
<Optikal_> No, I've never used haskell. I have used SML and OCaml though
<Optikal_> I can probably get the gist of it though
<bluestorm> you could read the first 10 pages of this paper
<Optikal_> k
<bluestorm> there are other quite known introduction around the web
<jonafan> well, i have good news and bad news
<jonafan> i wrote a functioning OptionMonad in C#
<bluestorm> interesting but not that easy for a beginner imho
<Optikal_> Yeah, I read that one
<Optikal_> Didn't get it
<jonafan> actually i guess that's pretty heavily biased towards bad news
<bluestorm> jonafan: :p
<jonafan> C# doesn't like it
<Optikal_> Arn't 'options' built into .NET these days?
<Optikal_> Since 2.0 I think
<jonafan> i.. don't think so
<bluestorm> Optikal_:
<jonafan> unless you mean like null
<jonafan> but null doesn't work for value types
<Optikal_> jonafan: No, I mean real options
<Optikal_> I have used them with .NET 2.0
<bluestorm> monad are an interesting theoretic tool that has two purpose
middayc has joined #ocaml
<bluestorm> 1) provide generic libraries (monadic) for a certain, very common, shape of code/manipulatoin
<bluestorm> 2) allow pure langages to hide side-effects in some constructions (monads) that retain referential transparency
<bluestorm> in my experience, the first point of view is easier to grasp, and that's what the bastaad.pdf paper is doing
<bluestorm> hm
<Optikal_> OCaml is considered an 'impure' functional language, right?
<bluestorm> i may eventually end up writing my own "monads tutorial", as nearly everyone that just learned monads does
<bluestorm> of course mine would be better :]
<bluestorm> Optikal_: yes
rwmjones has left #ocaml []
<bluestorm> we have state mutating primitives
<Optikal_> Can it be used in a 'pure' way?
filp has quit ["Bye"]
<bluestorm> yes you can
<Optikal_> ok
<bluestorm> you just have to forbid usage of "impure" structures (eg. references, Array.set, input/output functions, etc.)
<Optikal_> Are there any problems which can not be solved using purely 'pure' methodologies?
<bluestorm> hm
<bluestorm> in some ways there are
<Yoric[DT]> bluestorm: 3) make sure that functions can't perform side-effects of a given kind without the programmer's awareness
<bluestorm> but the main difficulties (Input/output, references, etc.) can be handled with monads
<Optikal_> I don't understand why you would bother implementing impure structures if there wern't
<bluestorm> there is an old article that shows that some particular algorithmic processus can be performed in O(n) in an impure language, but has a O(n log n) minimal bound in pure languages
<Yoric[DT]> Because the solutions are sometimes much more lightweight & efficient when you have impure structures.
<Optikal_> I see
<Yoric[DT]> Trivial example, without resorting to algorithmic complexity: printf is useful.
<bluestorm> however, it's not clear if monadic code couldn't do the same as impure code actually (monads were not around by the time this paper was published)
<bluestorm> hm Yoric[DT]
<Yoric[DT]> Adding a printf monad to your program is lots of work if you only want one printf in the middle of the code for debugging program.
<bluestorm> there is quite a ton of "functional unparsing" papers around :-'
<Yoric[DT]> s/program/your program/.
<Yoric[DT]> bluestorm: :)
<Yoric[DT]> bluestorm: my point was not about printf per se, print_int would be the same problem.
brooksbp has joined #ocaml
* Yoric[DT] needs to look at the paper "Calling Hell from Heaven and Heaven from Hell", or something such.
jderque has joined #ocaml
ita has joined #ocaml
<thelema> I'm making a module to factor OrderedType out of Map and Set, but to also have a module type with equal:t -> t -> bool
<thelema> does anyone have a good name for this module?
<bluestorm> hm
<bluestorm> OrderedType ? :-'
<thelema> no, it'll also have a ComparableType module type with the val equal
<thelema> and it'll give definitions for Int, Float, and probably more
<thelema> err, modularized versions of int, float with the appropriate comparison functions
<bluestorm> hm
<bluestorm> i'm not sure it's a good idea to create an Int module inside a special "comparisons" module
<thelema> Types?
<thelema> Set.Make(Types.Int)
<bluestorm> burp
<bluestorm> thelema: if it can help, i've done something similar a few weeks ago, and called it "numeric" http://bluestorm.info/ocaml/numeric/numeric.mli.html
<bluestorm> (actually the idea was to provide a homogenous signature for numeric modules, but it can be used for Set and Map too)
<thelema> I was looking for this.
<thelema> I couldn't find this. License?
thermoplyae has joined #ocaml
<thelema> bluestorm: hmm, going to http://bluestorm.info gives me php source
<bluestorm> hm
<bluestorm> there isn't any actually
<bluestorm> if you want it, i could of course provide it with a free licence
<thelema> Can I get it as LGPL2+linking exception
<bluestorm> (on my own i'd go GPL, but LGPL is not that bad)
<thelema> If I'm to include it in a stdlib, it's probably got to be the same license as the rest of the stdlib.
<thelema> pa_refutable?
bla has joined #ocaml
<thelema> I don't see any use of pa_refutable in the .ml file
<bluestorm> hm
<bluestorm> pa_refutable was used in the implementation, http://bluestorm.info/ocaml/numeric/numeric.ml.html
<bluestorm> but actually it's more of a fancy feature, it's easy to remove
ttamttam has joined #ocaml
<bluestorm> hmmm
<bluestorm> erratus : pa_refutable was used in an _older_ version of the implementation :-'
thermoplyae has quit ["daddy's in space"]
<thelema> good. I didn't find any use of refutable in what I saw.
<bluestorm> i'm gonna look for the licencing stuff, just a mn
<bluestorm> thelema: the use was
<bla> Update for interested: cleaned code and some more pictures featuring refraction rendered with ocaml raytracer: http://bla.thera.be/archives/17
<bluestorm> let refutable [(<.); (>.); (<=.); ...] = List.map wrap_op [(<); (>); (<=); ...]
<bluestorm> wich i think is quite nice
<thelema> ah. That's not bad at all.
<bluestorm> but was kinda slow (lot of high-order function and all)
<bluestorm> not very nice for potentially heavily-used functions (numeric code and so on)
rwmjones has joined #ocaml
<Optikal_> That one did a pretty good job for me
<thelema> bla: what copyright line would you like (It's getting included in my larger heirarchy of module types file... "Copyright 2008 bluestorm <bluestorm@bluestorm.info>"?
<bluestorm> seems fine
<bluestorm> is that fine ?
<thelema> great for me
<thelema> I assume you'd like me to obfuscate your gmail address in the copyright statement?
<bluestorm> hm
<bluestorm> i think it would be better
<thelema> done
<bluestorm> it's not that important as my mailbox is full of spam already
<bluestorm> but if i were you i'd do the same with yours
<bluestorm> moreover, if you distribute these files inside a bigger package with a coherent licencing, you could of course factorize eg. the "linking exception" in an external file
<bluestorm> s/could/may/
<thelema> I already use that email address for mailing lists - it's out there.
<bluestorm> hm
<thelema> so back to my original question, I've got OrderedType, ComparableType (ordered+equal), Printable, Serializable, and your NUMERIC type. Any ideas for a name to organize this all under?
<bluestorm> hm
<bluestorm> i don't understand the point of having both OrderType and ComparableType
<bluestorm> as ComparableType should be signature-compatible with OrderedType, and you can build an ComaparableType from an OrderedType
<bluestorm> (equal a b = 0 = compare a b)
thermoplyae has joined #ocaml
<thelema> almost. for floats, you'll probably want an epsilon such that x=y <=> abs(x-y) < epsilon
<bluestorm> hm, i see
<bluestorm> but i think you could ask a ComparableType in all cases actually
<bluestorm> as every Comparable module has an idea of what equality is (even if, eg. in the float case, it may want to be refined)
<thelema> Map and Set only use OrderedType, so I'll let them keep that (for backwards compatibility)
<bluestorm> Yoric[DT]: have you used the type-conv extension yet ?
<bluestorm> thelema: hm
<bluestorm> as they're only signatures, you can use a ComparableType-signed module for Map and Set
<bluestorm> but actually i think it's not that bad to have two very similar signatures
<thelema> yes, but then everyone will have to provide an equal function in their existing OrderedType implementations
<bluestorm> as the added granularity is probably worth the added verbosity
<jonafan> oh C# monads, you were not meant to be
<bluestorm> :p
<jonafan> OptionMonad<double> ret = OptionMonad<double>.Return(1).Bind<double>(add).Bind<double>(divby).Bind<double>(add).Bind<double>(divby).Bind<double>(divby);
<bluestorm> hm
<bluestorm> don't you have some kind of Generics ?
<bluestorm> thelema: are your "standard library enhancement" efforts available somewhere ?
<jonafan> those < > are generics
<Yoric[DT]> bluestorm: no, I haven't.
<bluestorm> it's a quite nice thing that allows extension-writers to add specific behaviour to type-declarations
<bluestorm> sometimes i'm thinking about extending it to other kind of declarations
<bluestorm> hm
<bluestorm> type-conv support syntax like type foo = bar with show
<bluestorm> and then call the code you provided for the "show" type-conv module
<bluestorm> gives you the AST of the type declaration, and you (the extension writer) send back eg. a pretty-printing function derived from it
<bluestorm> wich is added after the type declaration
shortcircuit has quit ["Probably rebooting."]
postalchris has joined #ocaml
<Yoric[DT]> looks similar to deriving, doesn't it ?
<bluestorm> hmm
<bluestorm> iirc, deriving is quite heavy
brooksbp has quit []
<bluestorm> hm
<bluestorm> yes, it's a really lightweight version of deriving
shortcircuit has joined #ocaml
_andre has joined #ocaml
<_andre> hello
<thelema> hi _andre
<_andre> does anyone know if there's a problem with the mailing list server?
<_andre> i sent a message yesterday and it still hasn't shown up
<thelema> not that I know of.
<Yoric[DT]> bluestorm: looks interesting
<Yoric[DT]> _andre: I received (and answered) several e-mails yesterday which haven't appeared in the mailing-list yet.
<bluestorm> i've based my ty_constr extension on it
* Yoric[DT] concludes that there may be some problem.
middayc_ has joined #ocaml
<Yoric[DT]> bluestorm: which one is that ?
<Yoric[DT]> oh, yeah, I remember
<mfp> has anybody benchmarked deriving's pickler against the usual combinators?
<mfp> (should be faster)
<bluestorm> Yoric[DT]: i'm been thiking that we may need a extended version of that on other syntaxic constructs
<bluestorm> i think the idea of "adding a specific behavior to that thing" is quite common
<bluestorm> and this approach has the big advantage of not cluttering the keyword space
<bluestorm> "with" and voila
<bluestorm> (for example, i might be interesting to change let refutable foo = bar into let foo = bar with refutable ?)
<bluestorm> anyway, i wanted to say they might be a good idea hidden somewhere in that direction, and that i'd be interested in your opinion if you have any someday
<Yoric[DT]> I completely agree.
<Yoric[DT]> This sounds like a very good idea.
<Yoric[DT]> In particular, I guess deriving could be rebuilt on top of that.
middayc has quit [Read error: 110 (Connection timed out)]
mwc has joined #ocaml
brooksbp has joined #ocaml
brooksbp has quit [Client Quit]
thermoplyae has quit ["daddy's in space"]
thermoplyae has joined #ocaml
_andre has quit ["*puff*"]
bongy has joined #ocaml
bongy has quit [Client Quit]
<mbishop> What's the ocaml equvilant to "foo ^= bar" in C?
<ita> mbishop: strings?
<thermoplyae> there isn't one, so far as i know
<thermoplyae> let foo = foo lxor bar in
<mfp> let foo = foo lxor bar
<mbishop> yeah, though so
<mbishop> thanks
<thelema> mbishop: be aware that this doesn't *really* modify the value of foo.
<thelema> it just makes a new foo with the new value
mamie_cracra has joined #ocaml
marmottine has quit [Read error: 104 (Connection reset by peer)]
<mbishop> thelema: right, but would "foo.[i] <- foo.[i] lxor bar" even work?
<bluestorm> foo := !foo lxor bar ?
<thelema> yes.
<mbishop> yes to who? :P
thermoplyae has quit ["daddy's in space"]
<thelema> yes both.
<mbishop> oh
<thelema> if you have an array, use the first. If you have a single value, use the ref example bluestorm provided
<bluestorm> if that's a repeated part of your code, you can even declare let (^=) xref y = xref := !xref lxor y
<bluestorm> then (foo ^= bar) will work, if foo is an int ref
love-pingoo has joined #ocaml
<thelema> but returns unit instead of foo, as C would.
<bluestorm> hm
<bluestorm> let (:=) a b = a := b; b :-'
<thelema> :P
<mwc> thelema, don't assignment operators in C return the LHS lvalue?
<mwc> as in x = y = z;
<thelema> the old lhs value? no. the new lhs value == the rhs value - "assignment"
mwc_ has joined #ocaml
<mwc> thelema, no, they have the value of the LHS's LVALUE after the assignment (though the lvalue itself wouldn't have changed)
<mwc> that way you can chain assignments
<thelema> x=y=z ==> x=(y=z), no?
<mwc> thelema, well, it does in GCC
<mwc> int a = 0;
<mwc> int b = 0;
<mwc> int c = 5;
<mwc> a = b ^= c;
<mwc> printf("%d %d %d\n",a,b,c);
<thelema> it can't go (x=y)=z, because that would assign x twice.
<mwc> results in "5 5 5" being printed
<mwc> thelema, no, assignment operators are right associative
<bluestorm> hm
<mwc> so x = y = z -> x = (y = z);
<bluestorm> after the "revised vs. classical syntax" troll, we've got ocamlers debating the C syntax :-'
<bluestorm> (and semantics)
<thelema> so why do you think (y=z) returns y's lvalue? why don't you think it returns z?
<mwc> I can't remember if it returns the lvalue or the rvalue
<bluestorm> aren't them actually the same ?
<mwc> since it's on the RHS of the outer assignment, it doesn't matter
<bluestorm> (i mean, *after* the assignment)
<mwc> but it might in some contexts
<mwc> let me thing
<mwc> *think
<thelema> if you parenthesized... (x=y)=z
<thelema> then it would matter
<mwc> true
<mwc> foo.c: In function ‘main’:
<mwc> foo.c:9: error: lvalue required as left operand of assignment
<mwc> so it's the rvalue of z
<thelema> glad we could work that out.
<mwc> I wonder about C++... the right way to define an assignment operator is to return a reference to the LHS
<mwc> oh well, I don't htink I care
<thelema> C++ can kiss my... camel
middayc_ has quit []
<mwc> anyhoo, we've discovered that let (^=) xref y = xref := !xref lxor y; !xref is the correct way to define it
<mwc> the Lvalue vs. Rvalue question was if the last thing needed to be xref or !xref ;)
ttamttam has left #ocaml []
<bluestorm> mwc, "correct" depending on you needs
<bluestorm> if you don't use that foo = bar ^= baz; thing, returning unit seems more sane
<mwc> true, but there was an intent to make it as much like C as possible
<mwc> since the original question was about a ^= equivalent
<thelema> we pushed the question past its logical conclusion, that's all.
<mwc_> yeah, I do that a lot ;)
ReachingFarr has joined #ocaml
jonathanv has joined #ocaml
jderque has quit [Read error: 113 (No route to host)]
jonafan has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Connection reset by pear"]
jonathanv is now known as jonafan
mamie_cracra has quit ["Quitte"]
Tetsuo has quit ["Leaving"]
thermoplyae has joined #ocaml
mwc_ has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
bluestorm has quit ["Konversation terminated!"]
<ReachingFarr> Does anyone know why Ocamlyacc would accept my .mly file but when I try to compile the .ml file that it generates Ocamlc gives me a Syntax error?
middayc has joined #ocaml
middayc has left #ocaml []
middayc has joined #ocaml
hsuh has joined #ocaml
hsuh has quit [Remote closed the connection]
hsuh has joined #ocaml
hkBst has quit ["Konversation terminated!"]
SIGVTALRM has joined #ocaml
mfp has quit [Read error: 110 (Connection timed out)]