<jado>
hi, i'm trying to compile for time profiling (ocamlopt -p) with ocamlbuild, but 'ocamlbuild -use-ocamlfind -cflag -p main.native' tries to compile with ocamlc -p :/
<jado>
it works with-lflag
BiDOrD has joined #ocaml
Associat0r has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
myu2 has quit [Ping timeout: 240 seconds]
<adrien>
jado: don't use cflag(s)
<adrien>
add "profile" in your _tags, juste like you'd add "debug" or package tags "<*>: profile, debug, whatever"
<thelema>
elehack: I wonder if there's anything to do to cut down the number of places a new module has to be added to integrate it with the rest of batteries
<elehack>
thelema: good question
<elehack>
for the mllib files, we could generate them.
<elehack>
might be able to generate batteries.ml and batteries_uni.ml as well
<thelema>
elehack: generating mllib is complicated by dependency order, iirc
<elehack>
hmm.
<thelema>
and batteries_uni.ml seems like a good place to strt the generation from, if possible.
<elehack>
How about a 'manifest' file that lists all the modules, in proper order, with flags.
<thelema>
I don't think generating batteries_uni.ml is worth it.
<elehack>
So 'BatUTF8' will mean to include BatUTF8
<thelema>
That might work...
<elehack>
'BatMutex +thread' means only include BatMutex for threaded build
<elehack>
We can maintain batteries.ml as a improvement on batteries_uni.ml (with include or open), so the only thing to generate is.mllib files.
<elehack>
and the manifest file can do that.
<thelema>
well, for the moment I'm okay doing things by hand, although I'll have to put in some doc somewhere all the files that should be changed to add a new module.
<elehack>
yeah
<elehack>
What needs to happen to get my commit on the release-1.3 branch? Just merge or rebase it over?
<thelema>
probably the github wiki
<elehack>
sounds like a good idea
<thelema>
I'd just cherry pick it. do you want me to do that?
<elehack>
sure
<thelema>
btw, it'd probably be better to have committed the fix there in the first place - that branch will be merged back with master when it ships
<elehack>
ok.
<thelema>
I like gitk for ease of cherry picking
<elehack>
I haven't tried cherry picking with git; didn't know gitk could help.
* elehack
will have to remember that
<elehack>
You probably also noticed my push of the lazy list syntax feature branch - the syntax I implemented is quite debatable; it isn't consistent with BatLazyList operators, but I find % more aesthetically pleasing than ^
<elehack>
I don't remember if there were technical reasons to prefer % to ^
alexyk has joined #ocaml
<thelema>
elehack: right-click on target branch and check it out, then right-click on commit and choose cherry-pick
<elehack>
nice
<thelema>
I'm find with [% and %:: for lazy lists
<thelema>
*fine
<elehack>
ok. I think I'll add %:: and %@ (or %@%) operators to BatlazyList in that branch as well then.
<elehack>
Should the be added to Pervasives also?
<elehack>
*they
<thelema>
i.e. let %:: = LazyList.cons?
<thelema>
so it's usable outside pattern matches? sounds like a breat idea to me, although what type is the left hand side? a lazy value, a unit function, etc?
<thelema>
*great
<elehack>
left hand side is just a value
<elehack>
at least that's the way it works in my code (I have that definition locally in the code I'm using the syntax extension in)
<thelema>
seems reasonable.
<thelema>
if anyone wants to improve, they can argue for the improvements
<thelema>
I've gotta go, cheers
<elehack>
ttylater
joewilliams_away is now known as joewilliams
hnrgrgr has joined #ocaml
hnrgrgr has quit [Client Quit]
hnrgrgr has joined #ocaml
elehack has quit [Quit: Farewell, programs.]
fraggle_ has joined #ocaml
alexyk has quit [Ping timeout: 240 seconds]
trigen has joined #ocaml
menace has quit [Remote host closed the connection]
alexyk has joined #ocaml
ftrvxmtrx has quit [Remote host closed the connection]
Associat0r has quit [Quit: Associat0r]
<alexyk>
forgot how to factor out types into .mli: is .mli automatically available to .ml? or do you include it?
<hcarty>
alexyk: Types need to be duplicated between the .ml and .mli, with the exception that anything you want to be hidden from outside use shouldn't be exposed in the .mli
<alexyk>
hcarty: arrgh... is there a way to somehow include .mli without duplication??
<hcarty>
alexyk: Someone posted a camlp5 syntax extension on the mailing list recently
<alexyk>
horrors! so ocaml doesn't support specification vs. implementation separation out of the box?
<hcarty>
alexyk: That's something of what a .ml and .mli separation provides
gl has joined #ocaml
<alexyk>
ah yes, I saw it
<gl>
'lo
ttamttam has quit [Remote host closed the connection]
<alexyk>
hmm -- what precludes one to separate types into ziggle_types.ml, and then, from both ziggle.ml and ziggle.mli, include Ziggle_types?
<hcarty>
alexyk: 3.12 may offer the ability to do something like that ... create a module from a module type if the module type does not contain any values.
infoe has joined #ocaml
jonafan_ is now known as jonafan
<thelema>
hcarty: that's been possible since before 3.12
<thelema>
alexyk: if you want to do that, there's no problem.
infoe has quit [Quit: WeeChat 0.3.2]
<alexyk>
kk
Yoric has quit [Quit: Yoric]
ikaros has joined #ocaml
<mrvn>
I would love to have "type foo = protected ..." to say the type is public in the modules struct but private in the signature.
Associat0r has joined #ocaml
<hcarty>
thelema: Ah, cool. I thought that had been added in 3.12.
<hcarty>
mrvn: Agreed. That would be really handy.
<mrvn>
let protected foo x y = ... too.
<thelema>
hcarty: nope, I have used this trick, and I'm not up to 3.12 yet
<mrvn>
I basically don't like mli files.
<thelema>
mrvn: I just don't like the duplication from mli to ml
<mrvn>
or module M : sig ... end = struct ... end where both blocks basically say the same.
<thelema>
It violates the DRY principle
<mrvn>
yep
orbitz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
drunK has joined #ocaml
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
jado has quit [Remote host closed the connection]
Edward__ has joined #ocaml
_andre has quit [Quit: leaving]
yezariaely has joined #ocaml
yezariaely has left #ocaml []
<flux>
eliom 2.0 seems interesting
<hcarty>
flux: Lots of large changes. It sounds impressive.
lpereira has joined #ocaml
<gildor>
flux: indeed, just read the announce
<gildor>
the removal of ~sp is a big thing
<flux>
and they didn't do it with a new monad ;)
<thelema>
I'm not so impressed by 9 lines of code to do a simple html page saying hello!, when most web frameworks have that down to 2
<flux>
it is true that getting back to writing ocsigen/eliom services always makes me read up documentation
<flux>
the way eliom makes links type-check is nice, though
<gildor>
thelema: ocsigen is not as mature as other RoR
<gildor>
thelema: but it is improving
<flux>
but even that basically restricts you into using tuples
<gildor>
I like the typed HTML form
<gildor>
the action and a lot of other nice small stuff
ygrek has joined #ocaml
Snark has quit [Quit: Ex-Chat]
explodus has quit [Ping timeout: 276 seconds]
explodus has joined #ocaml
orbitz has joined #ocaml
gmarik has joined #ocaml
gmarik has quit [Quit: Leaving.]
gmarik has joined #ocaml
<gmarik>
Hey all! Is there a channel for newbies? Reading book now and would like to be able to ask questions
<alpounet>
just ask your question
<alpounet>
whether it's a tough or easy one
myu2 has quit [Read error: Connection reset by peer]
<gmarik>
So basicly i have problem undestanding/parsing this phrase let app = function f -> function x -> f x;;
<alpounet>
okay
<alpounet>
do you understand this:
<alpounet>
let app f x = f x;;
<alpounet>
?
<gmarik>
yup, that's what that phrase is equal to
<thelema>
app (fun y -> y+1) 3
<alpounet>
yes gmarik
<alpounet>
now
<alpounet>
well, given some f
<alpounet>
what would you say `app f' is ?
<thelema>
alpounet: probably too early to assume currying
<alpounet>
hm, right
<alpounet>
gmarik, generally speaking
tnguyen has quit [Read error: Connection reset by peer]
<alpounet>
let foo = function a -> something
<gmarik>
alpounet: as far as understand it's a partially applied function
<alpounet>
*is equivalent to* let foo a = something
<alpounet>
alright?
<gmarik>
yup
<alpounet>
ok so here
<thelema>
probably more interesting is app with some side effect: let app f x = let t0 = Sys.time () in let ret = f x in printf "took %4.2f seconds" (Sys.time () -. t0) in ret
<alpounet>
let app = function -> f -> function x -> f x
<alpounet>
is equivalent to
<alpounet>
let app f = function x -> f x
<alpounet>
[...] function f -> [...] sorry
<alpounet>
itself equivalent to: let app f x = f x
<alpounet>
now, the phrase you gave at the beginning can be read as : "app is a function of some f which returns a function of some x that returns `f x'
<gmarik>
so my confusion is that in first notation x looks like a function when in the last totation it's not, and what val app : ('a -> 'b) -> 'a -> 'b = <fun> tells
<alpounet>
so, you'd think app is just a function of 2 arguments, but actually, as you've seen above, it takes one arguments (f) and when applied to that argument, it returns a function of one argument (x), which when applied to some x returns a value
<alpounet>
gmarik, function foo -> bar just means "function taking an argument named 'foo' and returning the expression 'bar'"
<thelema>
gm: f:('a->'b) -> x:'a -> 'b
<alpounet>
that's all there is to know about this, really
<alpounet>
with us so far? :P
<gmarik>
i think i get it now! )
<alpounet>
now i just want you to notice something about the types
<thelema>
gmarik: this shows the value of beating your head on a wall - you can understand ocaml types in this way. :)
<gmarik>
Too me it looked like function named x…while is just a function that has a parameter x
<alpounet>
you have to be aware that what i said about "seems to take 2 arguments" can be seen on the types directly
<alpounet>
`(a -> b) -> a -> b' is equivalent to `(a -> b) -> (a -> b)`
<alpounet>
that is, it takes a function "from a to b" and returns a function "from a to be"
<alpounet>
b*
<gmarik>
alpounet: wow…that's kinda confusing...
<alpounet>
that's exactly what i said earlier
<alpounet>
and can be made clearer with this version of app : let app f = function x -> f x
<alpounet>
it takes a function 'f' and returns... a function :)
<alpounet>
for a given 'f', 'app f' *is* a function :)
<alpounet>
(that's partial application as you said earlier)
<thelema>
alpounet: this isn't uncommon, as (+) x is a function
<thelema>
for any x
<alpounet>
indeed
<alpounet>
a good example of such a situation is "the function that always adds 3", that we can write `(+) 3' in OCaml
<gmarik>
it's confusing and in same time mind blowing how same function can be expressed in *different* ways. Need to play more with that. Thanks for explanations!
<thelema>
gmarik: it's just some syntax sugar
<thelema>
it's fundamentally the same
<thelema>
(unless you're referring to something other than fun/function/let foo x y =
<alpounet>
yeah, practice a lot, that will definitely help you getting your head around this
<alpounet>
i would have shown you if i still had mlbot around
<alpounet>
but well, just fire the ocaml toplevel and play with simple examples
Edward__ has quit []
mnabil has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
mnabil has quit [Remote host closed the connection]
Associat0r has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 240 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
gmarik has quit [Ping timeout: 250 seconds]
smerz has quit [Quit: Ex-Chat]
jm has quit [Remote host closed the connection]
<alexyk>
thelema: where do I get functions for List.print, those (BatInnerIO.output 'a -> 'b -> unit) -> BatInnerIO.output 'a? Say, for float list and in general?
gmarik has joined #ocaml
gmarik has quit [Client Quit]
gmarik has joined #ocaml
<alexyk>
got that -- but how do we control significant digits with Float.print?
groovy2shoes has joined #ocaml
gmarik has quit [Quit: Leaving.]
ccasin has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
vk0 has quit [Ping timeout: 260 seconds]
vk0 has joined #ocaml
BiDOrD has quit [Ping timeout: 276 seconds]
lpereira has quit [Quit: Leaving.]
<thelema>
alexyk: hmm, I remember adding a way in the print syntax extension...
<thelema>
you're right, we need similar in Float.print
<alexyk>
thelema: so for now I have to fall back on printf "%5.3f" or such?