<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>
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>
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>"?
<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.
<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)]