<rrenaud>
i could use when for the h1::t1, h2::t2 pattern, but then i'd have to duplicate the h1::t1, h2::t2 part for each pattern
<thelema>
nope, that's the good way to do that
<rrenaud>
okay, fair enough
Associat0r has quit [Quit: Associat0r]
<rien>
hey folks
<rien>
I'm reading some of Norman Ramsey's replies on stackoverflow
<rien>
trying to decide on which to choose for writing an interpreter, sml or ocaml. he recommends the former over the latter but I wouldn't be able to get any help from you guys :)
<thelema>
rien: in the long run, it probably doesn't matter which you pick - both are good languages.
<thelema>
You probably won't use the Objective part of OCaml for writing a simple interpreter
<rien>
I was thinking the same, they're really very similar. Oh yes, definitely won't need any OO
<rien>
I really want to rewrite that Write a Scheme in 48 Hours from haskell to OCaml.
enthymeme has quit [Quit: rcirc on GNU Emacs 23.1.1]
<thelema>
rien: well, do it.
<rien>
I will. when I get to the tough parts of translating monadic code to ocaml, I'll come here for help :)
<thelema>
If you really want to do it within the timeframe in a totally new language, try learning the language first, learning the theory of interpreting second, and then start the timer
<thelema>
rien: you can use monads in ocaml too
<thelema>
they're just much less necessary
<rien>
I'd rather not use monads
<rien>
I don't think I fully understand them, despite all the time I spent trying to
<rien>
I can certainly parrot everything I've read about it but I can't write a monad, for instance
<thelema>
The option monad makes sense to me, but I've not been able to generalize that concept
<rien>
what's the option monad? maybe or lists?
<thelema>
maybe
<thelema>
called "option" in ocaml
<rien>
oh, right. I understand that only as a functor, something that I can map over. I don't understand option as a monad
<thelema>
monads are things that you have return and bind for, right?
<rien>
yes
<thelema>
return for option is just (fun x -> Some x)
<thelema>
and bind for option is just (fun m f -> match f with None -> None | Some x -> Some (f x))
<rien>
right, and bind is something that pattern matches on the option, takes the thing from inside the container, maps a function over it and wraps a return on it again
<rien>
but I don't understand how that's important/useful/etc
<rien>
I'm not asking you to explain, mind you
<rien>
I don't think it's that important
<rien>
well, it is in purely functional languages
<thelema>
Can't help you with the theory. I'm sure there's a ton of things that fit the basic pattern, but the most important of those in haskell, the IO monad, is implicit in ML
<rien>
and that's why I'd rather code in ML :)
<thelema>
me too
tautologico has joined #ocaml
tautologico has quit [Quit: tautologico]
joewilliz is now known as joewilliams_away
philtor has quit [Ping timeout: 258 seconds]
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
eye-scuzzy has joined #ocaml
eye-scuzzy has quit [Client Quit]
eye-scuzzy has joined #ocaml
boscop_ has quit [Ping timeout: 240 seconds]
boscop has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
boscop_ has quit [Ping timeout: 246 seconds]
rspeyer__ has joined #ocaml
rspeyer__ has quit [Quit: rspeyer__]
rapha_ has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
vivanov has quit [Ping timeout: 252 seconds]
vivanov has joined #ocaml
philtor has joined #ocaml
rapha_ has quit [Quit: rapha_]
StepanKuzmin has joined #ocaml
StepanKuzmin has quit [Remote host closed the connection]
ymasory has quit [Quit: Leaving]
StepanKuzmin has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
emmanuelux has quit [Quit: =>[]]
StepanKuzmin has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml
philtor has quit [Ping timeout: 240 seconds]
Yoric has joined #ocaml
dnolen has quit [Quit: dnolen]
rapha_ has joined #ocaml
ikaros has joined #ocaml
jderque has joined #ocaml
avsm has quit [Quit: Leaving.]
boscop has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
fx_ has quit [Remote host closed the connection]
boscop_ has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
jderque has quit [Quit: leaving]
ftrvxmtrx has quit [Ping timeout: 252 seconds]
boscop_ has quit [Ping timeout: 246 seconds]
larhat has joined #ocaml
larhat has quit [Quit: Leaving.]
larhat has joined #ocaml
<rproust>
rien: thelema: the bind for the option monad is more like (fun m f -> match f with None -> None | Some x -> (*no Some here*) f x)
<rproust>
so that the type is ('a option -> ('a -> 'b option) -> 'b option)
Yoric has quit [Quit: Yoric]
ttamttam has joined #ocaml
arubin has quit [Ping timeout: 260 seconds]
f[x] has joined #ocaml
ftrvxmtrx has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [Read error: Operation timed out]
ikaros has quit [Quit: Leave the magic to Houdini]
jamii has joined #ocaml
ftrvxmtrx has joined #ocaml
ftrvxmtrx_ has quit [Ping timeout: 260 seconds]
emmanuelux has quit [Remote host closed the connection]
<kaustuv>
rproust: match *m* with ... you mean?
boscop has joined #ocaml
<kaustuv>
actually, I think the definition of bind should be:
<kaustuv>
function None -> (fun _ -> None) | Some x -> (fun f -> f x)
yezariaely has joined #ocaml
<kaustuv>
This way when the first None is encountered, the continuation can be immediately dropped and gc'd
Cyanure has joined #ocaml
<rproust>
kaustuv: yeah, I copy-pasted the typo along with the code
<rproust>
kaustuv: idk for the gc optimization you propose, I don't have enough knowledge of ocaml's internals
boscop has quit [Ping timeout: 248 seconds]
boscop has joined #ocaml
yezariaely has quit [Ping timeout: 276 seconds]
Derander has quit [Ping timeout: 276 seconds]
boscop has quit [Read error: Connection reset by peer]
<kaustuv>
I guess it doesn't matter if bind is fully applied, which is the common case.
thomasga has joined #ocaml
yezariaely has joined #ocaml
Yoric has joined #ocaml
yezariaely has left #ocaml []
rapha_ has quit [Quit: rapha_]
Modius has quit [Read error: Connection reset by peer]
Modius has joined #ocaml
rapha_ has joined #ocaml
rapha_ has quit [Client Quit]
sgnb has quit [Remote host closed the connection]
myu2 has joined #ocaml
myu2 has quit [Client Quit]
thomasga has quit [Quit: Leaving.]
lopex has joined #ocaml
sepp2k has joined #ocaml
wagle has quit [Ping timeout: 276 seconds]
_andre has joined #ocaml
thomasga has joined #ocaml
fraggle_ has quit [Ping timeout: 240 seconds]
boscop has joined #ocaml
boscop_ has joined #ocaml
boscop_ has quit [Read error: Connection reset by peer]
boscop has quit [Ping timeout: 246 seconds]
sgnb has joined #ocaml
boscop has joined #ocaml
boscop has quit [Ping timeout: 258 seconds]
boscop has joined #ocaml
boscop has quit [Read error: Connection reset by peer]
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
boscop has joined #ocaml
fraggle_ has joined #ocaml
brooksbp has joined #ocaml
brooksbp has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
lopex has quit [Ping timeout: 252 seconds]
lopex has joined #ocaml
edwin has joined #ocaml
thelema_ has joined #ocaml
thelema has quit [Read error: Connection reset by peer]
SoftTimur has quit [Ping timeout: 252 seconds]
robinnn has joined #ocaml
robinn has joined #ocaml
SoftTimur has joined #ocaml
dnolen has joined #ocaml
bohanlon has joined #ocaml
avsm has joined #ocaml
thomasga has quit [Quit: Leaving.]
avsm has quit [Quit: Leaving.]
dnolen has quit [Quit: dnolen]
dnolen has joined #ocaml
dnolen has quit [Client Quit]
dnolen has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
dnolen has quit [Quit: dnolen]
dnolen has joined #ocaml
dnolen has quit [Ping timeout: 240 seconds]
jderque has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Quit: Leaving.]
tnguyen has joined #ocaml
robinn has quit [Quit: Leaving]
<SoftTimur>
Hello all, I am using gedit to edit ml files, does anyone know how to format the code automatically (like touareg in emacs)?
<SoftTimur>
of color the texts automatically
ikaros has joined #ocaml
edwin has quit [Disconnected by services]
edwin1 has joined #ocaml
edwin1 is now known as edwin
robinnn has quit [Quit: Leaving]
tnguyen has quit [Remote host closed the connection]
<rproust>
Don't know for gedit, but GUI editors generally have a syntax/language/coloration/indetation menu entry
<rproust>
kate/kwrite has one
thomasga has joined #ocaml
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
lopex has quit []
Oejet has joined #ocaml
oriba has joined #ocaml
jderque has left #ocaml []
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
ftrvxmtrx has joined #ocaml
<thelema_>
SoftTimur: I wrote the ocaml highliting for gtksourceview, it should be automatically enabled by .ml files, if not, choose it in the View -> Highlight Mode -> sources menu
<thelema_>
SoftTimur: there is no auto-indenting in gedit, the only thing I know of that does that is emacs (although vim might too)
thelema_ is now known as thelema
<SoftTimur>
thelema_: indeed, I see "View -> Highlight Mode -> sources menu"
Associat0r has joined #ocaml
oriba has quit [Quit: Verlassend]
<SoftTimur>
thank you
<adrien>
vim sure does autoindent ;-)
SoftTimur has quit [Quit: Leaving.]
fraggle_laptop has joined #ocaml
<thelema>
adrien: thanks, I'll remember that
iris1 has joined #ocaml
joewilliams_away is now known as joewilliams
<iris1>
Dear experts, I would like to use tags with ocaml and emacs, but I ran into a couple of problems. I found otags and downloaded a version (unfortunately it's for 3.09, and my ocaml is 3.11, but I don't think this is causing my problem). When I try to make it, it tries to use Pcaml and dies. I think the problem is that Pcaml is part of camlp4 which I don't have. What's the simplest way to install camlp4 if I don't want to replace my existing
<iris1>
installation (which is via homebrew on OS X)? Thank you!
<iris1>
Incidentally, I found an announcement on the ocaml mailing list from last August, announcing otags version 3.11. Unfortunately it points at http://askra.de/otags, which is now dead. Is there a canonical way to retrieve it from somewhere? Thank you!
lopex has joined #ocaml
<thelema>
iris1: I'm surprised the homebrew ocaml didn't include camlp4 - I assume there's no homebrew for camlp4?
thomasga has quit [Quit: Leaving.]
<iris1>
That's right. But now that I looked carefully, I noticed there is one for camlp5. I am going to try to hack that to make it camlp4... Thank you very much!
<thelema>
camlp5 is what used to be camlp4
<thelema>
camlp4 git switched out around 3.10 or so
<thelema>
s/git/got/
<thelema>
in any case, otags shouldn't need camlp4 - I'm looking up how to turn that off
SoftTimur has joined #ocaml
<thelema>
I take that back, it does. Well, install camlp5 and use otags -camlp4 camlp5
<iris1>
I will try. Thanks!
ftrvxmtrx has quit [Read error: Operation timed out]
ftrvxmtrx has joined #ocaml
Associat0r has quit [Quit: Associat0r]
fraggle_ has quit [Read error: Connection reset by peer]
wagle has joined #ocaml
Yoric has quit [Quit: Yoric]
fraggle_ has joined #ocaml
jamii has quit [Ping timeout: 240 seconds]
Modius has quit [Ping timeout: 246 seconds]
ftrvxmtrx has quit [Quit: Leaving]
larhat has quit [Quit: Leaving.]
fraggle_laptop has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
andreas has joined #ocaml
<andreas>
Hi!
<andreas>
I'm looking into potentially doing a project in ocaml, and I have a question regarding the limitations of the implementation. Is it still true that arrays are limited to about 16MB on 32 bit machines? And is there a way to automatically use overflow-checking integer arithmetics without touching all the code?
<thelema>
yes, yes, there are multiple safe_int modules that when opened replace the usual operators with safe arithmetic
<andreas>
Could you recommend one?
<thelema>
except the array limit isn't 16MB, it's 16M entries
Rickasaurus has quit [Read error: Connection reset by peer]
Rickasaurus has joined #ocaml
Associat0r has quit [Ping timeout: 246 seconds]
eye-scuzzy has quit [Read error: Operation timed out]
eye-scuzzy has joined #ocaml
gio has joined #ocaml
<gio>
hi
Derander has joined #ocaml
oriba has quit [Quit: Verlassend]
gio has left #ocaml []
<doknokem>
is it possible to make a sorting function that takes a comparator as a parameter for the list
Asmadeus has quit [Read error: Operation timed out]
Asmadeus has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
Amorphous has quit [Ping timeout: 276 seconds]
boscop has joined #ocaml
Amorphous has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 246 seconds]
dnolen has joined #ocaml
doknokem has quit [Read error: Connection reset by peer]
alexgordon has joined #ocaml
kusco has joined #ocaml
<kusco>
When working with modules, how does one handle module dependencies? For example, say I have Foo and Bar as modules, with Bar requiring types defined in Foo.
<kusco>
What call does one put at the top of the Bar definition to pull in Foo?
andreas has joined #ocaml
<hcarty>
kusco: You don't have to put anything in the Bar module to access types or values from Foo. You can prepend them with Foo.
<hcarty>
kusco: ex. Foo.t to refer to type t from module Foo
avsm has joined #ocaml
<hcarty>
kusco: Or you can put "open Foo" at the top of Bar to have direct access to all values and types from Foo without needing the Foo. prefix.
<kusco>
I see...so there must be an path option to the ocaml interactive shell to tell it where to look?
<hcarty>
kusco: If it's compiled, you can use #load "foo.cmo";;