groovy2shoes has quit [Quit: Computer has gone to sleep]
<ousado>
wmeyer: ha! he answered, and I got "hello world" working :D
<wmeyer>
thanks for telling me :) if you can share the template on github for everybody would be great
<ousado>
well, so far it's just "fan -printer o testfan.ml > test.ml"
<wmeyer>
ousado: great, I little bit envy you, but today I went for Coq
<ousado>
hehe ;)
<wmeyer>
;)
<wmeyer>
it's good to hear, you are towards your hello world DSL at the moment
<ousado>
checking out the examples now
<wmeyer>
Ok, they might be based on Camlp4
<ousado>
indeed
<wmeyer>
ousado: I hope you will like OCaml a little bit more more now than Haxe :-)
<ousado>
wmeyer: he said he's about to write a blog post about basic usage this week
<wmeyer>
ousado: great
<ousado>
wmeyer: I gotta say I already do like it more..
<wmeyer>
ousado: yeah
<ousado>
it's just that haxe is very simple, and extremely flexible
<wmeyer>
ousado: it's a naturally functional language
<ousado>
wmeyer: btw, in the haxe compiler, they use exceptions a lot for control flow, is that a common thing to do in ocaml or considered bad style?
<dtg>
i heard someone uses exceptions for flow control
ollehar has joined #ocaml
<wmeyer>
ousado: it's a bad style but well established, even stdlib uses it to some extent. I'd rather see more option wrapped values than exceptions. There are local exceptions by Alain Frisch on the branch, which enforce you to catch them locally.
<ousado>
I see, yes, I saw that the std APIs also do that..
<ousado>
I odn't like it at all
<ousado>
*don't
<wmeyer>
general advise: better to avoid them, if you have to use them, just catch as locally as possible or use it as exception on a application level.
<wmeyer>
I don't use them
<wmeyer>
my type checker used the exceptions on a application level
<wmeyer>
but that's because I had to somewhat signal the type checking error
<ousado>
yes.. me neither.. except in macros for that very purpose
<ousado>
they seem to be extremely performant in ocaml though
<wmeyer>
so the idiom: [try Some (List.find (fun x -> ...) lst) with Not_found -> None] is your friend
<wmeyer>
yes they are it's immediate
<ousado>
a C++ compiler written in that style would take forever to process non-trivial amounts of code
<wmeyer>
C++ compiler is however very clever to optimise the code really good usually in most cases
<ousado>
even exceptions?
<wmeyer>
I appreciate we have fast exceptions :-)
<wmeyer>
no, c++ exceptions are slow
<wmeyer>
but they work
<wmeyer>
because for each stack frame the destructors for all the objects needs to be called
<ousado>
yes
<ousado>
I wrote an async networking thing, and when I profiled using exceptions for parser errors etc. it became clear that would amount to an easy DOS attack
<wmeyer>
yes, it's best to not use C++ exceptions, and BTW there are some subtle compiler bugs
<wmeyer>
that are very difficult to fix, when you use combination of C++ features (talking about GNU toolchain for instance)
<ousado>
yes..
<ousado>
I couldn't live without ADTs for half a second anymore. .
eikke has quit [Ping timeout: 255 seconds]
<wmeyer>
Oh I really like ADTs, and C++ designers add closures but never ADTs ...
<ousado>
why they're adding all kinds of stuff, but no ADTs is beyond me, but that's a thing of the past,
eikke has joined #ocaml
<ousado>
hehe ya :)
<wmeyer>
:)
<ousado>
on a related note, ATS2 with improved support for templates and other niceties will be out soon
eikke has quit [Ping timeout: 246 seconds]
<wmeyer>
ousado: nice, never played with ATS really
<ousado>
it's seems to be similar to Coq in quite some ways
madroach has quit [Ping timeout: 248 seconds]
<ousado>
in terms of proof writing and all that
<wmeyer>
ousado: possibly
<wmeyer>
I find Coq very expressive
<wmeyer>
it's just so pleasant to work with types in Coq
<wmeyer>
just don't want to switch to other tool at all
<ousado>
Coq is also written in ocaml, right?
<wmeyer>
Coq is written in OCaml, yes
madroach has joined #ocaml
<wmeyer>
it seems like OCaml was designed for Coq
<ousado>
:)
<ousado>
I really should take a look
<wmeyer>
yes, definitely try :-)
<wmeyer>
of course OCaml is still very fast and type inference is great but feels like: OCaml vs Coq is like C vs OCaml.
<ousado>
O_O
<ousado>
whoa, that's a statement
<wmeyer>
yes is such level of abstraction and feeling. OCaml feels so simple and fast to code in.
oriba has quit [Quit: oriba]
tootooroo has quit [Ping timeout: 264 seconds]
yroeht has joined #ocaml
<wmeyer>
for most application i recommend ocaml without hesistation
tootooroo has joined #ocaml
<wmeyer>
but if you want to have fun with types, I'd not go for Agda or Epigram, but just Coq.
<ousado>
the nice thing about ATS is that it puts dependent and linear types into use for very real-world stuff, it's definitely not "pleasant" to code in and looks quite weird, but in the end you highly likely have correct code
<wmeyer>
yes, I need to have a lookg at ATS
<wmeyer>
it's also quite performant
<ousado>
so I think it's very good for everything close to the metal
<ousado>
yes, it's straight C after all
<ousado>
just written in ML
<wmeyer>
are there any industrial applications of ATS?
<ousado>
nope
<ousado>
but there are some people who use it in production
<wmeyer>
it looks like perfect language for operating systems
<ousado>
yes, there's one already
<ousado>
or maybe more
<ousado>
also for writing device drivers
<ousado>
it's most perfect for wrapping OS APIs though
<ousado>
an ATS layer on top of POSIX and the linux APIs, depending on how much effort you spent, you can make them bullet-proof
<ousado>
*spend
<ousado>
and then use a nice language like ocaml on top of that
<wmeyer>
nice
brendan has joined #ocaml
<wmeyer>
right
* wmeyer
is going sleep
<wmeyer>
ousado: good day
frogfoodeater has joined #ocaml
<ousado>
wmeyer: bye :) and sleep well
<wmeyer>
ousado: thanks :-) cu
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
ollehar has quit [Read error: Operation timed out]
justdit has joined #ocaml
ollehar has joined #ocaml
patronus_ is now known as patronus
patronus is now known as Guest73208
frogfoodeater has quit [Ping timeout: 256 seconds]
ollehar has quit [Ping timeout: 246 seconds]
justdit has quit [Quit: Lost terminal]
frogfoodeater has joined #ocaml
tootooroo has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
frogfoodeater has quit [Ping timeout: 256 seconds]
tootooroo has joined #ocaml
ousia has quit [Quit: ousia]
derek_c has joined #ocaml
tootooroo has quit [Quit: brb]
rks has quit [Killed (pratchett.freenode.net (Nickname regained by services))]
rks_ has joined #ocaml
darkf has quit [Quit: Leaving]
darkf has joined #ocaml
ttamttam has joined #ocaml
tootooroo has joined #ocaml
ggole has joined #ocaml
ttamttam has quit [Ping timeout: 256 seconds]
bernardofpc has quit [Quit: leaving]
bernardofpc has joined #ocaml
derek_c has quit [Ping timeout: 255 seconds]
Yoric has joined #ocaml
ttamttam has joined #ocaml
Snark has joined #ocaml
testcocoon has joined #ocaml
osa1 has joined #ocaml
<osa1>
bt shows positions as characters, is there a way to get position as line/column numbers ?
<osa1>
in ocamldebug
derek_c has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
ggole has quit [Ping timeout: 256 seconds]
ulfdoz has joined #ocaml
ggole has joined #ocaml
mika1 has joined #ocaml
cago has joined #ocaml
thomasga has joined #ocaml
tane has joined #ocaml
djcoin has joined #ocaml
tootooroo is now known as lolcathost
lolcathost is now known as tootooroo
ontologiae has joined #ocaml
Kakadu has joined #ocaml
osa1 has quit [Ping timeout: 245 seconds]
Kakadu_ has joined #ocaml
Kakadu_ has quit [Client Quit]
Kakadu has quit [Quit: Page closed]
Kakadu_ has joined #ocaml
Kakadu_ has quit [Client Quit]
Kakadu has joined #ocaml
Neros has quit [Ping timeout: 248 seconds]
eikke has joined #ocaml
cdidd has quit [Ping timeout: 256 seconds]
tootooroo has quit [Quit: +1 (Yes). -1 (No). i (What I have been trying to tell you all along).]
<ttm>
I don't understand why the print_string function is evaluated in the first case
ttm is now known as The_third_man
<orbitz>
hrm, that link isn't loading for me. pastebin.com down?
<Kakadu>
because foo has no arguments, and looks like simple value and evaluated immediately when module is loaded
<Kakadu>
orbitz: it's OK
<orbitz>
there it goes
<rixed>
The_third_man: because when a module is initialized its 'global bindings' must be evaluated.
<The_third_man>
Ok, that's what I thought, thanks :)
derek_c has quit [Quit: leaving]
<The_third_man>
Do you know why there is this behavior ?
<rixed>
The_third_man: notice another difference: with the first definition the string will be printed only once while with the second it will be printed at each call
<The_third_man>
yeah
<rixed>
"let foo = ..." (in the global scope) tells the compiler that there's this symbol foo which value must be computed at intialization time, while "let foo a b = ..." tells the compiler that there is a function foo that, when called, must result in some computations.
<rixed>
so despite similar in apearance the presence of parameters change a lot of things here.
<The_third_man>
:/
<ggole>
Except the latter is sugar for the former, where the ... is (fun a b -> ...)
<ggole>
Functions aren't really a special case of let
<ggole>
Except syntactically
jbrown has joined #ocaml
<flux>
ttamttam, it also has a use you might not have thought of: let foo = let shared_memoization_table = Hashtbl.create 10 in fun x -> .. (* make use of the table, all calls of f use the same table *)
<Submarine>
though this may be undesirable unless you have a cleanup mechanism
<flux>
if you don't want to do it, don't :)
wwilly has joined #ocaml
<wwilly>
o/
mika1 has quit [Quit: Leaving.]
tane has quit [Quit: Verlassend]
mika1 has joined #ocaml
dezzy has quit [Remote host closed the connection]
mfp has joined #ocaml
dezzy has joined #ocaml
eikke has quit [Ping timeout: 245 seconds]
eikke has joined #ocaml
eikke has quit [Ping timeout: 256 seconds]
mika1 has quit [Quit: Leaving.]
ulfdoz has quit [Quit: deprecated]
weie has joined #ocaml
weie_ has quit [Ping timeout: 256 seconds]
alang_ has quit [Ping timeout: 252 seconds]
alang_ has joined #ocaml
weie has quit [Ping timeout: 260 seconds]
alang_ has quit [Ping timeout: 240 seconds]
weie has joined #ocaml
jbrown has quit [Ping timeout: 256 seconds]
beckerb has joined #ocaml
alang_ has joined #ocaml
weie has quit [Quit: Leaving...]
jbrown has joined #ocaml
paddymahoney has joined #ocaml
ollehar has joined #ocaml
eikke has joined #ocaml
_andre has joined #ocaml
ulfdoz has joined #ocaml
answer_42 has joined #ocaml
smondet has joined #ocaml
frogfoodeater has joined #ocaml
paddymahoney has quit [Remote host closed the connection]
<adrien>
\o
frogfoodeater has quit [Ping timeout: 240 seconds]
<companion_cube>
o/
ollehar1 has joined #ocaml
mika1 has joined #ocaml
SanderM has joined #ocaml
q66 has joined #ocaml
weie has joined #ocaml
mika1 has quit [Quit: Leaving.]
mika1 has joined #ocaml
osa1 has joined #ocaml
<osa1>
let's say I have a ref defined as global in a module and I want to generate multiple instances of that module, how can I to that ? I tried functors but I don't know which parameter should it get
<osa1>
module Test : (_ : UnitModule) = struct let a = ref myDataType end
<flux>
module T = Test(struct end)
<osa1>
is this a common pattern or should I change my design ?
<flux>
well, I wouldn't say common
<flux>
but maybe you can try and see if suits your purposes :)
<osa1>
ok
<orbitz>
what problem are you trying to solve wit hthis design?
<flux>
osa1, I think a more typical design would put that kind of information inside a record and call it with name 't'
<flux>
and an instance of that type would then be passed to each function that needs access to that data
<flux>
this would probably remove the multiple instances of the module
<flux>
but there are probably exceptional circumstances that makes one to use multiple modules in that fashion
<ggole>
Hidden state and data flow, blurgh
<ggole>
You're almost always better off with explicit parameters
<osa1>
I know, I know
groovy2shoes has joined #ocaml
cago has joined #ocaml
paddymahoney has joined #ocaml
cago has quit [Ping timeout: 276 seconds]
mika1 has quit [Ping timeout: 256 seconds]
mika1 has joined #ocaml
mcclurmc has joined #ocaml
cago has joined #ocaml
Uvs has joined #ocaml
adahlberg has joined #ocaml
yacks has joined #ocaml
beckerb has quit [Remote host closed the connection]
beckerb has joined #ocaml
ulfdoz has quit [Ping timeout: 255 seconds]
awm22 has quit [Quit: Leaving.]
darkf has quit [Quit: Leaving]
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
osa1 has quit [Quit: Page closed]
mika1 has quit [Ping timeout: 246 seconds]
yacks has quit [Ping timeout: 264 seconds]
yacks has joined #ocaml
yacks has quit [Max SendQ exceeded]
Neros has joined #ocaml
yacks has joined #ocaml
tane has joined #ocaml
yacks has quit [Ping timeout: 245 seconds]
yacks has joined #ocaml
cago has left #ocaml []
ollehar has quit [Ping timeout: 246 seconds]
tootooroo has joined #ocaml
ollehar has joined #ocaml
anderse has joined #ocaml
yacks has quit [Quit: Leaving]
Submarine has quit [Quit: Leaving]
groovy2shoes has quit [Quit: Computer has gone to sleep]
ollehar has quit [Ping timeout: 264 seconds]
Uvs has quit [Ping timeout: 255 seconds]
Yoric has quit [Ping timeout: 256 seconds]
SanderM has quit [Read error: Connection reset by peer]
lopexx has joined #ocaml
Uvs has joined #ocaml
ttamttam has quit [Quit: ttamttam]
awm22 has joined #ocaml
beckerb has quit [Ping timeout: 245 seconds]
eikke has quit [Ping timeout: 264 seconds]
thomasga has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
Uvs has quit [Read error: Connection reset by peer]
Uvs has joined #ocaml
bholst has joined #ocaml
ttamttam has joined #ocaml
ontologiae has quit [Ping timeout: 248 seconds]
cdidd has joined #ocaml
thomasga has joined #ocaml
Kakadu has quit []
jbrown has quit [Ping timeout: 260 seconds]
awm22 has quit [Ping timeout: 246 seconds]
srcerer_ has joined #ocaml
srcerer has quit [Ping timeout: 240 seconds]
mcclurmc has quit [Ping timeout: 264 seconds]
srcerer_ is now known as srcerer
jbrown has joined #ocaml
pkrnj has joined #ocaml
ollehar1 has quit [Ping timeout: 260 seconds]
ollehar has joined #ocaml
adahlberg has quit [Remote host closed the connection]
lopexx has quit [Ping timeout: 252 seconds]
lopexx has joined #ocaml
emmanuelux has joined #ocaml
Kakadu has joined #ocaml
ousado has quit [Ping timeout: 240 seconds]
ousado has joined #ocaml
tongcx has left #ocaml []
eikke has joined #ocaml
ousado has quit [Ping timeout: 240 seconds]
ousado has joined #ocaml
seanmcl has joined #ocaml
ontologiae has joined #ocaml
adahlberg has joined #ocaml
ollehar has quit [Ping timeout: 248 seconds]
Snark has quit [Quit: Quitte]
tootooroo has quit [Quit: b(not so)rb]
ollehar has joined #ocaml
seanmcl has quit [Read error: Connection reset by peer]
seanmcl has joined #ocaml
tootooroo has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ollehar has quit [Ping timeout: 264 seconds]
ggole has quit []
def-lkb_ has quit [Read error: Connection reset by peer]
ollehar has joined #ocaml
mcclurmc has joined #ocaml
troydm has quit [Ping timeout: 256 seconds]
Associat0r has joined #ocaml
Associat0r has left #ocaml []
lopexx has quit []
adahlberg has quit [Remote host closed the connection]
<ollehar>
is type level recursion possible in ocaml?
<thelema>
ollehar: you mean like type 'a list = N | C of 'a * 'a list?
Anarchos has joined #ocaml
<ollehar>
no, that's a recursive type :)
<orbitz>
can you defien type level recursion then?
<ollehar>
when you iterate that type, you do it on a value level
<orbitz>
do you mean like C++'s template stuff?
troydm has joined #ocaml
<orbitz>
what odes it mean to iterate a type?
ontologiae has quit [Ping timeout: 252 seconds]
<ollehar>
er, trying to find a short example :P
<ollehar>
ok, like this. you have types
<ollehar>
type z
<ollehar>
type 'a s
<ollehar>
type 'a nat = Zero : z nat | Succ : 'n nat -> ('n s) nat;;
<ollehar>
peano numbers where type = number
_andre has quit [Quit: leaving]
derek_c has joined #ocaml
<wmeyer>
it is, but pattern matching not
<ollehar>
if you make this type:
<ollehar>
type comp = Eq : 'n nat * 'n nat -> comp;;
<ollehar>
you can check at compile type for equal numbers:
<wmeyer>
ollehar: type comp = Eq : 'n nat * 'n nat -> comp;; this is an excellent example of using GADTS for proofs.
<wmeyer>
ollehar: I believe however, that I don't need dependent typing as such, I really prefer soft type level constraints and type inference.
<wmeyer>
Haskell is half way between OCaml and Agda
djcoin has quit [Quit: WeeChat 0.3.9.2]
<wmeyer>
and does not seem to be for me a good balance
<ollehar>
wmeyer: why, really? isn't it a good thing to extend the capabilities of static verification?
<wmeyer>
ollehar: of course, but at what cost, and also why not to choose different tool then?
<wmeyer>
OCaml is like a Ninja sword for most applications I write, but when you want full assurence, go for something *different*
<orbitz>
ocaml is swell
<wmeyer>
orbitz: yeah :-)
<companion_cube>
you can use why3, there is a kind of annotated ocaml in it :)
<wmeyer>
actually I just looked on Why3 and (like) :D this is a bridge in between, so it works in pair with high assurance setting and with plain type systems
<companion_cube>
there is a nice collection of verified algorithm implementations
<wmeyer>
btw: refinement types ollehar might be interesting option too
<companion_cube>
including imperative ones
<wmeyer>
Yes, I have to look at Why3, if I have time, I will look at why 3
<wmeyer>
ollehar: maybe adding refinment types inside comments to extract it to model checkers would be a good idea
<ollehar>
wmeyer: ah, thanks for the tips! hard to know what to google for sometimes
<companion_cube>
maybe typeclasses would help asserting things on types :)
<wmeyer>
companion_cube: definitely, they allow to deconstruct types first and then transform them :) but not sure if current proposals (which definitely I like for being so flexible) will support such trickery
<companion_cube>
the current proposal is based on implicit, isn't it?
<wmeyer>
companion_cube: yes
<companion_cube>
that is just so cool.
<companion_cube>
it's what made scala so flexible, too
<companion_cube>
the minute an official OCaml release features typeclasses, I stop writing code for the previous versions :D
<orbitz>
hrm, i'd love to do an ocaml talk at cufp this year, i just don't kow what to talk about
<companion_cube>
wmeyer: what do you mean, advertise scala? :)
eikke has quit [Ping timeout: 264 seconds]
eikke has joined #ocaml
<ollehar>
one of my friends has scala as religion. but now he's working at the university optimizing the erlang vm in C ;)
<wmeyer>
companion_cube: yes :-)) I meant basically glorify how they merged Java into OCaml
<wmeyer>
ollehar: I wish Scala had OCaml community though
smondet has quit [Ping timeout: 240 seconds]
<orbitz>
Scala is too much like C++ for me
<wmeyer>
(not that I know anybody, but the quality of our stuff is usually really is great, where Scala has a lot programmers with Java heritage)
<wmeyer>
orbitz: While I agree, I also need to say it's quite pragmatic and capable language.
<companion_cube>
#scala is cool, but for a few extremists
<companion_cube>
I like scala, but it takes too much memory and does not have tail-call
<orbitz>
itlacks ocamls simplicity that makes it so lovable
<wmeyer>
I keep hearing that, initially I wasn't convinced
<companion_cube>
well, not all of ocaml is simple
<wmeyer>
and OCaml is my love anyway
<wmeyer>
OCaml is simple and gets complex algorithm not that complex not more than they should, but it's consistent and readable. If you ask about more advanced features there are also quite generic and pleasant.
<wmeyer>
Scala however is pragmatic to that extent I can't like it's syntax
<companion_cube>
I think ocaml is a really great tools for even very advanced algorithmic
<companion_cube>
-s
<wmeyer>
companion_cube: definitely I agree!
<companion_cube>
but it still lacks a few features to make it very generic
* companion_cube
obsessed by typeclasses :)
<wmeyer>
I'd like to see type classes that allows me to write backtracking logic monads :-)
* wmeyer
then says: inliner!
<companion_cube>
I'd like to have polymorphic containers ♥
<companion_cube>
the inliner's on its way!
<wmeyer>
companion_cube: so type classes!
<companion_cube>
\o/
<companion_cube>
so great.
<companion_cube>
I'd like my iterators to be shipped with ocaml, too :]
<thelema>
companion_cube: quite unlikely. The growth of the stdlib has been slow.
<wmeyer>
with big containers of beer to Pierre Chambart :)
<companion_cube>
thelema: I know, I know :)
<wmeyer>
thelema: stdlib is just for bootstrapping the compiler isn't it?
<companion_cube>
I don't get why they need both Genlex and ocamllex/ocamlyacc, though
<thelema>
wmeyer: not quite; there's code in it that isn't needed for bootstrapping the compiler
<companion_cube>
wmeyer: you're right, I will pay beer to Pierre if his inliner succeeds
<thelema>
companion_cube: exactly
<companion_cube>
I never understood what refrained gallium's members from adding stuff to the stdlib
<companion_cube>
do they fear it would become bloated?
<thelema>
companion_cube: having to maintain it.
<wmeyer>
yes, there is, but majority of the code is just enough to write OCaml
<thelema>
wmeyer: granted.
<companion_cube>
thelema: they couldn't rely on third party/consortium to do that?
<companion_cube>
or to trustworthy community coders like you
<thelema>
companion_cube: that's what batteries is.
<wmeyer>
companion_cube: it's just easier to roll own stdlib
<companion_cube>
yep, but it would be better if it shipped with the compiler
<companion_cube>
it may have avoided the split core/batteries :(
<wmeyer>
companion_cube: i like stdlib though
<thelema>
companion_cube: that's a distribution problem, which is totally fixable.
<companion_cube>
thelema: but that lead to a fragmentation problem
<companion_cube>
I think D had the same issues with several stdlibs
<companion_cube>
(competing stdlibs)
<thelema>
companion_cube: the core/batteries split will disappear with sufficiently simple enablers for 3rd party library use
<wmeyer>
thelema: the problem is: all of the students will fetch the ocaml distro from the website, instead of fetching OPAM. Still windows problem remains. And the website should already say: please use OPAM.
<companion_cube>
I'm not sure, Core has a totally different API apparently
<thelema>
agreed; having opam built into standard distribution (which ocaml labs should accomplish shortly) is more important
<companion_cube>
indeed
<thelema>
companion_cube: yes, core is not backwards compatible with stdlib.
<companion_cube>
so I don't see how third party could not have to choose among them
<thelema>
companion_cube: in the long run, core and batteries will not be so monolithic, and it'll be reasonable to take the good parts of both
<companion_cube>
I hope so!
<companion_cube>
but things like Enum need to be pervasive within the library to be really useful
Kakadu has quit []
<thelema>
companion_cube: My hope is for BatGen to be a better common ground for what Enum does.
<companion_cube>
the current one?
<thelema>
??
<companion_cube>
oh, mistaken for BatSeq
<companion_cube>
-_-
<companion_cube>
well, I'd like Gen to succeed, yeah ;)
<companion_cube>
what do you think of the current API?
<thelema>
I'm considering strongly differentiating between 'a generator and 'a Gen.t
<thelema>
We'll need both, and Gen.t should be the default
<companion_cube>
Gen.t is the default (the restartable one), in my mind
<thelema>
yes
<companion_cube>
because most of the time you can provide it
<thelema>
I'm trying to figure out how non-restartable streams should be exposed
<thelema>
whether they should have their own sub-library
<companion_cube>
yeah, the current submodule thingy is simple, but a bit redundant
<thelema>
or if they should just be 2nd class
<wmeyer>
thelema: I think you could use Oleg's delimited continuations for implementing yield. Or look at the generators API, he reccently came up.
<companion_cube>
maybe they should be convertible to Stream.t, and Stream get a rich interface, in case you just have a non-restartable stream
<thelema>
wmeyer: the simple generators isn't reasonable to me
<thelema>
companion_cube: s/lexico/compare/, also should have equal function
<companion_cube>
hmmm, right
<companion_cube>
well, 'lexico' was to make clear how the sequences are compared
<companion_cube>
but why not
<companion_cube>
(typeclasses would be so great there ;))
<thelema>
how else to compare?
<wmeyer>
companion_cube: looks pretty good, thanks! I might consider using your ocaml-containers library
<thelema>
I don't think there's any other way that's nearly as natural.
<companion_cube>
thelema: could by set/multiset comparison, for instance
<companion_cube>
wmeyer: ocaml-containers is designed to be a drag and drop set of modules :)
<companion_cube>
so, please do!
<companion_cube>
(I'm having fun with LazyGraph those days, to map things to graphs)
<thelema>
companion_cube: given the inherent ordering of generators, I'd say lexico is much more natural; set/multiset would be done naturally by converting to set/multiset and comparing the results
Anarchos has quit [Ping timeout: 260 seconds]
<companion_cube>
you're right
<companion_cube>
I'm making a synonym
answer_42 has quit [Ping timeout: 276 seconds]
<wmeyer>
companion_cube: I've been keeping starring at ocaml-containers, definitely worthwile bunch of data structures that are missing in stdlib anyway
<wmeyer>
thelema: and I still remember how useful for me sometimes would have been phashtbl ...
eikke has quit [Ping timeout: 260 seconds]
<wmeyer>
it's although not always safe, but provides a good balance for most cases actually
<wmeyer>
i meant polymorphic data structures in general
<thelema>
wmeyer: because of being able to provide a hash function to the constructor?
<thelema>
wmeyer: the builtin hashtbl in stdlib is polymorphic
eikke has joined #ocaml
<wmeyer>
thelema: an yes! forgot
<companion_cube>
yes, but you cannot provide your own hash/eq functions
<wmeyer>
but Maps/Sets not
<thelema>
companion_cube: yes, you have to use a functorized interface to provide hash/eq
<companion_cube>
my point :)
<thelema>
oddly enough I have in some of my own code a polymorphic hashtbl that allows custom hash/eq
<wmeyer>
actually there is no polymorphic Map in the stdlib at all, which is a bit of pain given we have polymorphic compare, right?
<thelema>
wmeyer: a minor pain, which both core and batteries address
<wmeyer>
yes minor! but I like them.
<wmeyer>
there are other bigger problems in stdlib actually
<thizanne>
is there a specific use case for polymorphic Maps/Whatever, or is it just more convenient for the length of the code ?
<wmeyer>
thizanne: perhaps just me being lazy
<wmeyer>
:)
dtg has quit [Read error: Connection reset by peer]
<companion_cube>
thelema: it's convenient when you don't want to functorize everything
<thelema>
yup
<wmeyer>
thizanne: to be serious, I don't find that much pain with functors, but most of my modules that I pass to Make just contain simple Pervasives.compare
<thizanne>
yes, I also like to use a polymorphic Map when it just does what I want
<thizanne>
but I was wondering if any problem could be easily solved with a poly map and not with a functorized one
<thelema>
thizanne: also, some operations are possible on polymorphic maps that have to be re-implemented time and again for functorized maps; for example a map on keys
dtg has joined #ocaml
<thizanne>
so far i'm still looking for it
<wmeyer>
thizanne: the origin or risk with Map is just it polymorhic compare and lack of type classes
<thizanne>
thelema: what do you mean ?
<thizanne>
a map on keys outside the module ?
<thelema>
thizanne: ('a, 'b) map -> ('c, 'd) map
<thizanne>
ah, right
<wmeyer>
thelema: good catch, but you can do it with a functor
<thizanne>
I guess we could just put this map on a double functor but well
tane has quit [Quit: Verlassend]
<wmeyer>
(I did that in past; not for Map)
zip has joined #ocaml
<zip>
afternoon
<zip>
is there an easy way to turn a string into a channel?
<thelema>
zip: not with the stdlib channels
<thelema>
well, you could write it to a file and then open that file.
<thelema>
but I'm sure that's not what you want
<zip>
that's what I've got and it's a thing of horror
<companion_cube>
:/
<zip>
pipe or socket pair?
<companion_cube>
you can try the pipe
<thelema>
Batteries provides an abstracted IO system that has IO.input_string to create an input channel from the string
<zip>
Unfortunately I've got some quite involved stuff which requires a in_channel as a parameter
<zip>
okay, this is ugly, but... what if I checked my string size and if it's less than the kernel pipe buffer size, use a pipe pair, otherwise use a temp file?
<thelema>
zip: you may be surprised how easily type inference allows batteres to slide right into all that code with a simple "open Batteries".
<thelema>
zip: Although if you're seeking or getting channel sizes, you'll have to stick with in_channel.
<companion_cube>
thelema: I had trouble with BatFormat and stuff like List.print :/
<companion_cube>
looks like the print functions do not work on formatters
<thelema>
companion_cube: as always, Format can't be mixed with anything else.
<thelema>
although I think it's not unreasonable for BatFormat's %a to work with List.print
<companion_cube>
it's just that I find Format so convenient to compose together printers...
<zip>
okay. trying socket pair :)
<thelema>
You should be able to chain the printers through format, but not calling both separately
<companion_cube>
should I propose Gen to Core's people? :)
<thelema>
companion_cube: sure; propose that interface be adopted as standard for datatype interchange.
<thelema>
but you don't have to contribute to core; just propose that unit -> (unit -> 'a) with your exception (and maybe a more precise description of semantics) be adopted as interchange standard
<companion_cube>
hmm, right
<thelema>
are you on the core mailing list?
<companion_cube>
I just saw a google group list, is there a proper mailing list?
mattrepl has joined #ocaml
eikke has quit [Ping timeout: 240 seconds]
<zip>
hm so
<thelema>
companion_cube: that's the one.
<companion_cube>
ok, let's sign in then ^^
<zip>
next problem: I have two file_descrs and I want an in_channel and an out_chanel
<wmeyer>
sorry. Does core have mailing list?
<companion_cube>
seems they only have a google group
<thelema>
"interfacing with the standard input/output library"
<zip>
ah sorry it totally is
<zip>
was looking at the wrong file there
<zip>
thank you for the help, btw
<thelema>
zip: n/p
Uvs has quit [Ping timeout: 245 seconds]
<companion_cube>
hmmm, not sure of how I should explain the purpose of Gen
<companion_cube>
data interchange, iteration, abstraction of containers... ?
<wmeyer>
maybe, abstracted container
<wmeyer>
container of beer! :D
<wmeyer>
not really, huh, today i feel exhausted already, and i suppose to go to makespace.org today!
<companion_cube>
"ever dreamt of enumerating beers?"
<wmeyer>
lazy inifinite enumerated abstract iterative container full of beer.
eikke has joined #ocaml
<companion_cube>
it's like a burrito, really
<companion_cube>
:]
<wmeyer>
can't be better from the marketing point of view
<wmeyer>
i need to check what is burrito companion_cube :-)
<wmeyer>
it looks good, I'll maybe have it this weekend
<companion_cube>
I discovered that when i went to california
<companion_cube>
but the joke was about Haskellers' crazy monad tutorials, one of which features "monads are like burritos"
<wmeyer>
wow, i just though about monad, when you i saw that picture - really!
<wmeyer>
could not be better
<wmeyer>
before you actually told me
<wmeyer>
so then, objects are like kebabs
<wmeyer>
(you know which ones)
<wmeyer>
OCaml objects :)
<companion_cube>
:D
<companion_cube>
kebabs have structural subtyping!
<wmeyer>
means that there are better abstractions and worse, I think what is available in Java and OOP is a bit like kebab in many ways
<wmeyer>
yes they do have :-) especially doner ones popular in UK
<companion_cube>
"java objects are spaghetti-like kebabs"
<companion_cube>
deep fried kebabs
<wmeyer>
oh, the ones that are fried, are good, the ones that are on the spit are really bad food in my opinion
<wmeyer>
especially that I really don't eat meat apart from fish and sea food. I gently just accept salads and all the usual stuff but not into meat.
<wmeyer>
is it very popular in France?
<wmeyer>
not that I want to try, even in France!
<companion_cube>
kebabs are quite popular in France, although I don't think deep-fried ones exist :)
<wmeyer>
:)
thomasga has quit [Quit: Leaving.]
xaimus has quit [Ping timeout: 245 seconds]
xaimus has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
derek_c has joined #ocaml
<companion_cube>
thelema: is the core ML moderated?
darkf has joined #ocaml
<ousado>
sigh.. I can't make even the most basic example work. I don't know enough about ocaml, caml4p and obviously fan it seems
<ousado>
haha, it starts with the names.. camlp4
dwmw2 has quit [Ping timeout: 240 seconds]
fasta has joined #ocaml
ollehar has quit [Ping timeout: 252 seconds]
fasta_ has quit [Read error: Connection reset by peer]
Ptival has quit [Quit: leaving]
q66 has quit [Remote host closed the connection]
Ptival has joined #ocaml
watermind has joined #ocaml
<wmeyer>
ousado: :(
ousado has quit [Ping timeout: 252 seconds]
ousado has joined #ocaml
<ousado>
wmeyer: hehe :) well, this is more or less expected
<ousado>
I didn't know the revised syntax so far etc.
emmanuelux has quit [Quit: emmanuelux]
<wmeyer>
ousado: you are a beta tester of Fan!
<wmeyer>
but that's good, I want also to test it, and see if I can generate some code
<wmeyer>
however you will get that working or not actually
<wmeyer>
you didn't try camlp4 before ousado ?
<ousado>
I think I will not
<ousado>
nope
<wmeyer>
it's not easy
<ousado>
and I think the basic concepts are the same
<ousado>
so I'm reading a camlp4 tutorial now
<wmeyer>
Ok, granted, I will have my go with it too
<wmeyer>
currently obsessed a bit with types
<ousado>
I mainly use metaprogramming for dealing with types
<wmeyer>
ousado: so camlp4 toolchain is complex, i can send you some templates, but I think Fan is easier
<ousado>
I'd guess so, too
<ousado>
I can compile things, which end up looking as if it was intermediate code
<wmeyer>
but don't be please discouraged it's a good tool, whatever people say, means it gets job done and it's base for Coq for instance (actually Camlp5)
<ousado>
as in precompiling macros to be reused by fan later
<ousado>
IOW I don't even know which compiler to use after "the first round"
<ousado>
it looks like this: `App (_loc, (`App (_loc, (`Id (_loc, (`Lid (_loc, "+")))), a)), b)
<wmeyer>
Ok, so this is a Fan AST (not a concrete) printer
<ousado>
it's actually the ocaml printer
<wmeyer>
which switch you use to generate it?
<wmeyer>
then it's OCaml printer for lifted Fan AST :)
<ousado>
input is this:
<ousado>
let macrofunc a b = {:exp| $a + $b |};
<ousado>
output is this:
<ousado>
let macrofunc a b = `App (_loc, (`App (_loc, (`Id (_loc, (`Lid (_loc, "+")))), a)), b)
<wmeyer>
Ok, so this just prints for you the Fan AST in Caml syntax
<wmeyer>
yes, it's expanded Fan AST
<wmeyer>
after macro expansion
<ousado>
so I assume that's to be consumed by fan?
<wmeyer>
so it's correct
<ousado>
or ocaml?
<wmeyer>
you used {:exp|} right and this will generate Fan AST for Caml expression
<wmeyer>
so these fragments are first class
<wmeyer>
no, it's already expanded
<wmeyer>
try other quotation
<ousado>
the issue is ocaml complaining about _loc
<wmeyer>
you can always say: print_fan_expr {:exp| 2 * 2}, not that I don't know about function that pretty prints Fan AST
<ousado>
I have no idea what to open or include
<wmeyer>
yes, in Camlp4 you have to open something too which defines this _loc
<wmeyer>
actually ghost loc
ollehar has joined #ocaml
<wmeyer>
you can have a look at examples
<wmeyer>
so _loc here is unknown, because it's a meta AST
<ousado>
I haven't found a single one that compiles
<ousado>
fan complains about invalid expansions
<wmeyer>
ousado: damn it! sorry to put you into that position, but I think you can try to look at the stuff there
<wmeyer>
or complain to Hongbo, typical lisper :) 80% of his requirments is satisfied :)
<wmeyer>
but that's a good sign that Fan needs some more love to get at least 10% more