gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
dsheets has joined #ocaml
smerz has quit [Remote host closed the connection]
munga has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
ski has quit [Ping timeout: 256 seconds]
ski has joined #ocaml
struktured has quit [Ping timeout: 265 seconds]
struktured has joined #ocaml
ski has quit [Ping timeout: 246 seconds]
ski has joined #ocaml
ski has quit [Ping timeout: 246 seconds]
phao has joined #ocaml
munga has quit [Ping timeout: 252 seconds]
struktured has quit [Ping timeout: 244 seconds]
struktured has joined #ocaml
Progster has quit [Ping timeout: 245 seconds]
cyphase has quit [Quit: http://www.cyphase.com/]
ski has joined #ocaml
cyphase has joined #ocaml
ankit9 has joined #ocaml
Xizor has joined #ocaml
eni has joined #ocaml
Hussaind has joined #ocaml
taruti_ is now known as taruti
Asmadeus_ is now known as Asmadeus
eni has quit [Ping timeout: 256 seconds]
osa1 has joined #ocaml
munga has joined #ocaml
osa1 has quit [Client Quit]
Yoric has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ankit9 has quit [Quit: Leaving]
eni has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
pango is now known as pangoafk
ocp has joined #ocaml
Progster has joined #ocaml
cago has joined #ocaml
mika1 has joined #ocaml
Xizor has quit [Ping timeout: 260 seconds]
silver has joined #ocaml
Snark has joined #ocaml
gnuvince has quit [Ping timeout: 245 seconds]
djcoin has joined #ocaml
bnwr_ is now known as bnwr
gnuvince has joined #ocaml
emmanuelux has joined #ocaml
Yoric has quit [Read error: No route to host]
Sablier has joined #ocaml
sivoais has quit [Ping timeout: 245 seconds]
sivoais has joined #ocaml
emmanuelux has quit [Ping timeout: 264 seconds]
sivoais has quit [Ping timeout: 248 seconds]
sivoais has joined #ocaml
Submarine has quit [Ping timeout: 265 seconds]
sivoais has quit [Remote host closed the connection]
sepp2k has joined #ocaml
sivoais has joined #ocaml
sivoais has quit [Ping timeout: 252 seconds]
sivoais has joined #ocaml
Ptival has quit [Read error: Connection reset by peer]
Ptival has joined #ocaml
sivoais has quit [Read error: Connection reset by peer]
ankit9 has joined #ocaml
sivoais has joined #ocaml
cdidd has joined #ocaml
sivoais has quit [Remote host closed the connection]
sivoais has joined #ocaml
sivoais has quit [Ping timeout: 248 seconds]
sivoais has joined #ocaml
ankit9 has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
ankit9 has joined #ocaml
<csmrfx> wow, #perlists are like the worst a-hoe's on freenode
svenl has joined #ocaml
ankit9 has quit [Ping timeout: 256 seconds]
Progster has quit [Ping timeout: 244 seconds]
milosn_ is now known as milosn
mort___ has joined #ocaml
beckerb has joined #ocaml
ankit9 has joined #ocaml
thomasga has joined #ocaml
Hussaind has left #ocaml []
ankit9 has quit [Ping timeout: 256 seconds]
eni has quit [Ping timeout: 244 seconds]
ankit9 has joined #ocaml
munga has quit [Remote host closed the connection]
Yoric has joined #ocaml
emmanuelux has joined #ocaml
_andre has joined #ocaml
_yezariaely has left #ocaml []
yezariaely has joined #ocaml
Progster has joined #ocaml
ankit9 has quit [Ping timeout: 248 seconds]
avsm has joined #ocaml
ankit9 has joined #ocaml
<phao> I am still learning ocaml.. but a question here.. is it common go put related modules in separate files
<phao> and "importing" all those modules by open <file>
<phao> ?
<bnwr> phao: depends on the project size
<phao> ops
<phao> related module on a separate FILE
<phao> and open that FILE
<mrvn> phao: lets say it isn't uncommon
<phao> to use all the modules.
<phao> bnwr, what I think is strange is the opening the file to access the modules
<bnwr> phao: you can't open a file
<mrvn> I usualy put stuff into seperate modules so their namespaces are seperate. That somewhat goes against using open.
<phao> bnwr, I am just talking about using the open statement
<bnwr> if you put modules in a file, they are really submodule of the module which name is similar to that of the file
<phao> separating them on files is ok, the strange is doing like file.module.member
<phao> mrvn, but you have your code all in one file?
<phao> bnwr, ok, I meant that, but didn't stated as clearly
<mrvn> phao: depends on size and wether the module is used from multiple sources.
<bnwr> phao: for very small projects you can use one file (makes build simpler)
<flux> phao, I usually avoid opening modules
<mrvn> I usualy start with one file and then split it when it gets too big
<phao> ok
<bnwr> phao: for big projects you can do the opposite: scatter a module in small files and join them with includes
<phao> I guess having modules inside files shouldn't be common
<flux> phao, I use this approach in some projects that may not be relevant to you: I have common.ml which defines module aliases: module F = FooBarBaz.Bah etc, and then I open Common in other modules
<flux> this allows me to have consistent module name aliases between different files
<flux> this may not be appropriate for your situation.
<phao> Looks good
<bnwr> phao: look at React and Batteries sources for comparison
<flux> I find that in general when there's an 'open' it gets more difficult to see where a the control flow goes
<phao> yeah, it just looks like it'll get like java
<phao> where you have name.name.name.<...>.name
<phao> (only in that regard, hehe)
<flux> if you have a particularly dot-happy function, you can use local module aliases or even local module opening
<phao> ok
<flux> let open Foo in.. or let module B = BazBaz in ..
<flux> so it's still easy to guess where the names come from.
<phao> I didn't know about let open Foo in ...
<phao> that solves the problem, the let module I knew
<flux> I think it requires 3.12.0
<phao> thx
<flux> also there is this syntax perhaps better suitable for small expressions: ModuleName.(foo + bar)
<flux> it's the same as let open ModuleName in (foo + bar)
<phao> hmm
<phao> ok
<phao> thx all
<flux> happy coding :)
<mrvn> I used that a lot recently for Module.({ x=1; y=2; })
<flux> mrvn, well, for that there's the shortcut: { Module.x = 1; y = 2; }
<flux> which is an older one
<mrvn> flux: oh, cool.
<flux> but I suppose it's not needed that much anymore due to those new features
<flux> except for pattern matching maybe?
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
ssbr has quit [Ping timeout: 244 seconds]
avsm has joined #ocaml
ssbr has joined #ocaml
ssbr has quit [Changing host]
ssbr has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<ssbr> _what_ ocaml for loops are inclusive of both ends
<ssbr> that is awful :(
<flux> on the other hand, looping backwards looks more sane ;)
osa1 has joined #ocaml
<flux> in python it works like: for i in range(10-1, -1, -1): ..
<orbitz> hah
<ssbr> flux: or like for i in reversed(range(10)): ...
<orbitz> I dont' think I've ever used af or loop
<ssbr> orbitz: I understand why ! ! ! ;)
<orbitz> ssbr: does that produce a generator thouhg?
<orbitz> That is, that only makes sense if the rangeis small
<ssbr> orbitz: reversed is lazy and range is eager
<flux> that doesn't generate a generator anyway, xrange would generate a generator
<ssbr> maybe it makes more sense as reversed(xrange(10)) ;)
<flux> does that work lazily then?
<ssbr> reversed(xrange(10)) does
<flux> so it's a special case for reversed(xrange.. ?
<orbitz> ssbr: ho do you laizly reverse?
<ssbr> well, the trick is that xrange isn't a generator, it's a lazy sequence
<ssbr> so you can do xrange(10)[5]
<orbitz> So/
<orbitz> In order ot reverse you still need to have all the numbers and play them backwards
<ssbr> orbitz: right
<orbitz> So how do you do that lazily?
<ssbr> so you start from len(xrange_obj) and count down, yielding xrange_obj[i]
<ssbr> (as a generator)
<orbitz> reveresd(range()) doesn't do that touhg
<mrvn> Only works if the generator has a length and random (or reverse) access
<orbitz> unless it's somehow specialcased
<ssbr> orbitz: it does do that :(
<ssbr> mrvn: right, reversed doesn't work on generators, only sequences
<ssbr> (a sequence is an array-like thing, with defined length and get-item syntax foo[i])
<ssbr> orbitz: hm. It does appear that reversed special-cases things, though. I'm not sure how or why.
<orbitz> So if you reversed(range(100000000000000)) will that work in O(1) memory?
<flux> xrange ;)
<ssbr> orbitz: the reversed will, the range won't
<ssbr> reversed(range(1000000000000000000000000)) is O(1) memory though
<ssbr> 9fuhjDFhd
<ssbr> reversed(xrange(...))
<orbitz> harhar!
<ssbr> I missed the "x" :( :( very confusing
<orbitz> I don't undertand how reversed(xrange(100000000000000000)) is constant memory
<flux> I just tried it, it works in constant memory.
<orbitz> How does reversed get the end of the input without evaluting it to its entire sequence?
<mrvn> orbitz: because xrange is an opject with [] operator. Not a list of all numbers.
<orbitz> ah ok
<flux> orbitz, sequences appear random-access
<mrvn> object even
<orbitz> so it's some magic
<orbitz> Ok, that makessense then
<ssbr> orbitz: not that magical. xrange objects know a formula so that when you ask for item i, they can compute the answer
<ssbr> but yeah, glad that's cleared up :)
<mrvn> orbitz: think of it as a sequenze with reverse iterator. reversed just swaps iterator and reverse iterator around.
<orbitz> Yep i get it
<flux> related: it seems batteries is getting rid of Enum.clone, due to it being quite difficult to implement in a robust fashion
<flux> I wonder if it supporting lazy sequences is ever going to gain traction in batteries ;)
<ssbr> mrvn: if only that were true ! :(
<orbitz> Lazy sequences are great
<ssbr> most iterators in python are very nonreversible
<orbitz> I have a little seq moduel that implements some lazy APIs for me over Stream
<orbitz> Probably not very performant,but works for me
<ssbr> you've got your priorities on straight then :)
<orbitz> I really need to fix that api. I have no idea what consume does
<orbitz> or iterate...
<ssbr> now that api looks familiar
<orbitz> ssbr: I took it more from Haskell's List module
smondet has joined #ocaml
<ssbr> ah, well, that's where itertools took it too
silver has quit [Quit: I put on my robe and wizard hat]
diego_diego has joined #ocaml
diego_diego has quit [Client Quit]
NaCl has quit [Ping timeout: 265 seconds]
ankit9 has quit [Quit: Leaving]
fraggle__ has joined #ocaml
fraggle__ has quit [Read error: Connection reset by peer]
Progster has quit [Ping timeout: 244 seconds]
tlockney has quit [Excess Flood]
tlockney has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
beckerb has quit [Quit: Konversation terminated!]
Submarine has quit [Quit: Leaving]
Sablier has quit [Read error: Connection reset by peer]
osa1 has quit [Quit: Konversation terminated!]
mika1 has quit [Quit: Leaving.]
cago has quit [Quit: Leaving.]
Yoric has quit [Ping timeout: 246 seconds]
lin has joined #ocaml
avsm has quit [Quit: Leaving.]
Sablier has joined #ocaml
<thelema> flux: batteries has *three* lazy sequence modules
<thelema> Seq, Enum and LazyList
<phao> is the open ocaml statement like the using statement in C++?
<orbitz> yes
<phao> orbitz, thx
NaCl has joined #ocaml
lin has quit [Quit: Leaving]
<phao> funny, it's cool to syntax highlight types with underline
avsm has joined #ocaml
<phao> sorry to bother again
<phao> is there any good reason why putting code in different file leads to different module?
<phao> I mean, it looks really strange
<phao> I mean, automatically leads to a different module.
<phao> It's strange that, if I want to separate my program in X different modules (using module ... = struct ... end, and so on syntax) I cannot have more than one file w/o adding more than these X modules I wanted.
<phao> Such as, if I want module A, B and C, and put A and B on file foo, and C on file bar, I will end up with 5 modules: A, B, C, foo, bar.
<phao> Can't this be avoided?
avsm has quit [Quit: Leaving.]
djcoin has quit [Quit: WeeChat 0.3.2]
<orbitz> phao: what is the question?
<orbitz> phao: -pack
<orbitz> is your friend
<orbitz> If i follow what you're asking
ocp has quit [Ping timeout: 248 seconds]
<phao> doing open foo; and open bar; would also solve it
<phao> but that looks wrong
<orbitz> You want N files to produce 1 module?
<phao> No
<phao> I want to produce only modules I "declare" with the module keyword, and everything else
<orbitz> and everything else...?
<phao> well, "everything else" being the struct keyword, sig, end, ... and the things you also use to define a module
<orbitz> Why do you only want to define modules with the module keyword?
<orbitz> That means every file will have at least 1 level of indentation...always
<phao> It just looks like it'll be annoying doing, as in the example
<phao> foo.A.member
<phao> or Bar.C.member
<phao> using the let module, or let open all the time
<orbitz> Exposing records outside yoru module is silly
<orbitz> And I'm not sure what your alternative thought is. What should the contents of a file not in a module block become?
<phao> global
<phao> or
mort___ has quit [Quit: Leaving.]
<phao> only visible in that file
<orbitz> How is the language forcing it ot be a global better htan you just doing open Module?
<phao> I can't see difference. That's why I thought people did lots of open Module in here
<orbitz> There is a idfference: I can choose not to open a module
<phao> Yes.
<phao> So that's what you do?
<phao> You do this open statement?
<orbitz> When that is the result I want, yes
<orbitz> Forcing whatever someone puts in a file to become global is the worst of all worlds
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Connelly has joined #ocaml
<Connelly> does anyone know how to find the ocaml lib path on mac?
<_habnabit> Connelly, same as on any platform?
<Connelly> i assume so
<phao> orbitz,
<phao> [13:57] <phao> only visible in that file
<Connelly> nevermind found it
<orbitz> phao: How would I ever share code then?
<phao> orbitz, it's a default behavior I don't think looks good. Not that I can suggest a better alternative though.
<phao> orbitz, you'd do that by defining a module explicitly
<orbitz> but that module is inside of a file
<orbitz> which you just said is only visible to that file
<phao> I was talking about the code that don't specify modules
<phao> such as some function outside any explicit module definition
<orbitz> So you want to add a new module concept? What problem does increased complexity add?
<orbitz> solve*
<phao> idk if this would make things more complex
<phao> I imagine it'd make it more simple though
<orbitz> It would, you've added a new concept
<orbitz> How is adding another concept decreasign comlexity?
<phao> by making life easier
<phao> or programming, here
<orbitz> How?
<orbitz> phao: You still need to access the module you define in the .ml file somehow, so how have you saved doing M.foo?
<phao> I saved you having to do filename.M.foo
<orbitz> But I can just do Filename.foo
<phao> how?
<orbitz> echo "let foo = 1" > thing.ml; now I have Thing.foo
<phao> Sure
<phao> I don't think you understood what I said
<phao> let it go
<orbitz> Does what you said fix any actual problem? I don't have ot do Filename.M.foo I can just do Filename.foo, which seems to be what you thought was wrong
<phao> This example you said
Connelly has quit [Quit: Page closed]
<phao> has nothing to do with what I asked
<orbitz> How so?
<phao> Imagine you have a file
<phao> named filename
<phao> and in it, a module, named M
<orbitz> you mean filename.ml ?
<phao> yes
<orbitz> k
<phao> and inside that module M, a function foo
<orbitz> and I've defined an inner moduel called M
<orbitz> yep
<orbitz> Why did i define an inne rmodule naemd M?
<phao> because you wanna have more than one module defined in this file
<orbitz> Why?
<phao> I think recursive modules need that
<phao> but idk why
<orbitz> I don't know anything about recursive modules
<orbitz> But
<orbitz> Assuming you aren't doign recursive modules, why woudln't you just put foo in filename.ml, not in an inne rmodule in it?
<phao> I was imagining putting many related modules in the same file
<orbitz> Don't do that
<orbitz> see -pack, like I orignally said
<phao> ok
<orbitz> ocamlc -pack -o foo.cmo all.cmo my.cmo other.cmo modules.cmo
<orbitz> now I have Foo.All, Foo.My, Foo.Other Foo.Modules
<orbitz> So now, presumabely, the problem is you don't want to access Foo.All.bar with the Foo?
<phao> well, sort of yeah
<orbitz> Sort of? what's the devilish detail?
<phao> I just think it would be annoying doing all these name.othername.otherothername.
avsm has joined #ocaml
<orbitz> moduels alwayrs start iwth a capital ltter
<orbitz> phao: So you dont' want the Foo there or you do?
<phao> I don't wanna have to type it so many times
<orbitz> But you want to type it sometimes?
<phao> I don't mind the module Foo being there honestly
<phao> orbitz, as little as possible
<phao> but.. idk, maybe, when writing programs for real, this won't be such an issue
<orbitz> It isn't
<orbitz> Just use open
<orbitz> you can only polute your own namespace
Yoric has joined #ocaml
BiDOrD has quit [Ping timeout: 265 seconds]
BiDOrD has joined #ocaml
<flux> thelema, but is any one of them used as pervasively as Enum?
Xizor has joined #ocaml
pangoafk is now known as pango
Progster has joined #ocaml
osa1 has joined #ocaml
Snark has quit [Quit: Quitte]
ftrvxmtrx has joined #ocaml
thomasga has quit [Ping timeout: 245 seconds]
<adrien> btw, some people might enjoy the mention of: http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=lablgtk/lablgtk.git;a=shortlog;h=refs/heads/gtk3 (read the link in its entirety :-) )
Anarchos has joined #ocaml
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
Schadenfreude has quit [Ping timeout: 265 seconds]
Schadenfreude has joined #ocaml
<thelema> flux: not throughout batteries, but what does that matter for whether "supporting lazy sequences [will] gain traction in batteries"? You want us to support all of them pervasively?
testcocoon has quit [Quit: Coyote finally caught me]
avsm has quit [Quit: Leaving.]
testcocoon has joined #ocaml
_andre has quit [Quit: leaving]
emmanuelux has quit [Read error: No route to host]
emmanuelux has joined #ocaml
eni has joined #ocaml
avsm has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 256 seconds]
phao_ has joined #ocaml
phao has quit [Disconnected by services]
phao_ is now known as phao
thomasga has joined #ocaml
thomasga has quit [Client Quit]
Yoric has quit [Quit: Instantbird 1.2a1pre -- http://www.instantbird.com]
as has joined #ocaml
as has quit [Client Quit]
eni has quit [Ping timeout: 248 seconds]
smondet has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
niteria has joined #ocaml
<niteria> is there a book on type hackery?
<niteria> things like phantom types, gadts etc.
phao has quit [Read error: Connection reset by peer]
<bitbckt> niteria: in theory or practice?
<niteria> in practice
<niteria> or both
<niteria> TaPL is about implementation
<niteria> I want to learn about usage
<bitbckt> I'm not aware of any good practical guides.
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<orbitz> I don't know abotu gadt's, but there is a reasonable amountof literature on the net for phantom types
Snark has joined #ocaml
Snark has quit [Remote host closed the connection]
niteria has quit [Quit: leaving]
cdidd has quit [Remote host closed the connection]
Schadenfreude has quit [Quit: leaving]
Schadenfreude has joined #ocaml
Progster has quit [Ping timeout: 244 seconds]
Xizor has quit [Ping timeout: 260 seconds]
sepp2k1 has quit [Remote host closed the connection]
Progster has joined #ocaml
avsm has quit [Quit: Leaving.]
gnuvince has quit [Read error: Operation timed out]
hcarty has quit [Ping timeout: 252 seconds]
hcarty has joined #ocaml
avsm has joined #ocaml
Schadenfreude has quit [Quit: leaving]
Progster has quit [Ping timeout: 260 seconds]
hcarty has quit [Ping timeout: 252 seconds]
avsm has quit [Quit: Leaving.]
hcarty has joined #ocaml