karswell has quit [Remote host closed the connection]
adotbrown has joined #ocaml
tensai_cirno has quit [Ping timeout: 256 seconds]
<adrien>
are there tips on how to reduce the size of your ocaml programs?
<adrien>
I know a few but a fairly comprehensive documentation would be really nice
<mfp>
adrien: would also like to know... AFAIK there's not much to do is there? -inline -10000, stripping the executables, not using packs/huge container modules like Batteries/Core, avoiding include XXX, using dynamic loading and cmxs if code can be shared amongst executables
<mfp>
-compact (don't know how effective it is, never measured it), and no -g
<mfp>
anything else?
<adrien>
I don't know more; there were also a few items on the bug tracker
<adrien>
I would have liked seeing the effectiveness of various options being documented
<adrien>
-compact is quite limited iirc because you'd have to recompile the standard library with it
<mfp>
if you have a lot of shared code dynamic loading would trump everything else :)
<adrien>
well, I have two .exe and they probably have 99.9% of the code in common
<mfp>
then avoiding Batteries/Core-like modules and -g, I guess?
<mfp>
hmm exe... well, if you can get the cmxs stuff to work, there's a 50% gain for you there
<adrien>
after strpping, -g on my own code adds rougly 3KB (out of roughly 940KB)
<mfp>
any idea whether GNU BFD supports whatever object format ocaml uses on windows?
<adrien>
I've been pondering .cmxs but it "looks" better with fewer files (it's incredible how people are going to complain about a few hundred KBs nowadays...)
<adrien>
I remember ld.ocaml; I've used it in the past with pretty good success
asmanur_ has quit [Ping timeout: 258 seconds]
<adrien>
it'll be a good test for my cross-compiler :P
<adrien>
mfp: what do you want to do with bfd?
<mfp>
ld.ocaml used it to extract the (marshalled) headers from the objects
<adrien>
but it might well be a limitation of my current patches to the compiler
Anarchos has joined #ocaml
sgnb has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
q66 has joined #ocaml
adotbrown has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
tane has joined #ocaml
karswell has joined #ocaml
<wmeyer>
hi
<adrien>
MORNING!
<wmeyer>
:)
<wmeyer>
Morning Adrien :-)
<adrien>
btw, I'm not able to build a cross-compiler for windows 64 (although that might be because of my C toolchain rather than because of the patches)
anderse has quit [Quit: anderse]
anderse has joined #ocaml
anderse has quit [Client Quit]
Yoric has joined #ocaml
<wmeyer>
adrien: you've done a great job already
<wmeyer>
I still have your pending patches
<wmeyer>
to include
<adrien>
thanks :-)
<adrien>
been working on yypkg and the packages for windows recently, I'll be done today for "beta 1" so I'll have some time to rebase my patches on trunk soon :-)
<wmeyer>
yes, it needs rebasing a bit. There were some changes
<adrien>
I will _never_ forgive Damien Doligez for breaking absolutely all my patches :P
zpe has joined #ocaml
eikke has joined #ocaml
nimred has quit [Quit: leaving]
zpe has quit [Ping timeout: 258 seconds]
eikke has quit [Ping timeout: 245 seconds]
Neros_ has joined #ocaml
eikke has joined #ocaml
Anarchos has quit [Remote host closed the connection]
weie_ has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
weie has quit [Ping timeout: 255 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
answer_42 has quit [Quit: WeeChat 0.4.0]
eikke has quit [Ping timeout: 258 seconds]
zorun has quit [Quit: ♥]
groovy2shoes has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
tane has quit [Quit: Verlassend]
zpe has joined #ocaml
fraggle_ has joined #ocaml
Jenza has quit [Quit: '']
Jenza has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
mye has joined #ocaml
anderse has joined #ocaml
ollehar has joined #ocaml
ggole_ has joined #ocaml
ggole has quit [Ping timeout: 276 seconds]
zpe has joined #ocaml
Yoric has joined #ocaml
zpe has quit [Ping timeout: 264 seconds]
clintnewsom has joined #ocaml
ggole_ has quit []
groovy2shoes has quit [Quit: Computer has gone to sleep]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 245 seconds]
tane has joined #ocaml
groovy2shoes has joined #ocaml
groovy2shoes has quit [Client Quit]
darkf has quit [Quit: Leaving]
notk0 has joined #ocaml
<notk0>
hello
<notk0>
does anyone know if ocaml determines partial application at compiler time or runtime ?
<notk0>
eg is there a different in the syntax tree between a normal application and partial application?
Yoric has quit [Ping timeout: 246 seconds]
zpe has joined #ocaml
<Kakadu>
Afaik in runtime all functions take only 1 parameter (uncurring)
<notk0>
what does that parameter represent?
zpe has quit [Ping timeout: 255 seconds]
eikke has joined #ocaml
clintnewsom has quit [Quit: clintnewsom]
<notk0>
how can I cast a a function that takes 'a 'b arguments to int?
eikke has quit [Ping timeout: 246 seconds]
karswell has quit [Remote host closed the connection]
zpe has joined #ocaml
thomasga has joined #ocaml
ttamttam has quit [Read error: Connection reset by peer]
zpe has quit [Ping timeout: 246 seconds]
q66 has quit [Remote host closed the connection]
karswell has joined #ocaml
ollehar has quit [Ping timeout: 245 seconds]
Plainview has joined #ocaml
q66 has joined #ocaml
eikke has joined #ocaml
Plainview has left #ocaml []
<notk0>
I have defined a reference outside of a function definition, yet I can't access it from inside the function
<notk0>
is it not global?
<flux>
notk0, scoping rules are still respected..
<flux>
if the value is in scope, it can be accessed
<notk0>
so I am forced to make it an argument flux ?
<flux>
no
<flux>
well
<flux>
depends on your case
<flux>
this works: let global = ref 42 let do_magic () = incr global
<flux>
no argument passing involved
<flux>
and global is, well, global
<flux>
of course, if the value cannot be in scope, it must be an argument..
<flux>
or passed through some other global data structure
<notk0>
oh I used the wrong syntax, I said
<notk0>
let ref name = value
<notk0>
what does it mean let ref name ?
<flux>
heh, you definde function ref that returns a constant given whatever as an argument
<notk0>
oh, I didn't know I can redefine keywords in OCaml
<flux>
you cannot, ref is not a keyword
<flux>
but rather something from the standard library
<notk0>
wow I just did let int name and it works
<notk0>
int is not a keywords as well?
<flux>
indeed
<flux>
let let = 42 won't work
<flux>
or let struct = 42
<notk0>
that seems rather strange :P
<notk0>
thank you for your help flux
<flux>
well, it's actually pretty nice sometimes
<flux>
for example if you have a library for serializing stuffy
<notk0>
why is it useful to redefine that?
<flux>
you can write code like: Serializer.(serialize (int * string) (4, "hello"))
<flux>
int and string are functions local to the Serializer module
<notk0>
I see
<flux>
and * as well
<notk0>
so it's more of helping make syntax sugar?
<flux>
well, builtin types are bound by the same rules as user-defined types
<flux>
it's consistent that way, no?
<notk0>
I guess
<notk0>
if I have inside the body of a fucntion some code
<notk0>
and I want to do try get value from MAp with Not_found -> do code
<notk0>
but depending on the value of the Map result I want to do the same thing
<notk0>
what is a good solution? shall I create a function inside that does the code I need?
Yoric has joined #ocaml
<flux>
I would probably do that, yes
Yoric1 has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
zpe has joined #ocaml
clintnewsom has joined #ocaml
ollehar has joined #ocaml
zpe has quit [Ping timeout: 255 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
notk0 has quit [Quit: Leaving]
notk0 has joined #ocaml
<notk0>
hello, I have a if then else inside a try
<notk0>
if something then foo else bar
<notk0>
but when I try to compile it tells me it expected a type unit
<notk0>
foo and bar are return types
<adrien>
use parens or begin...end
<adrien>
"if ... then if ... then ... else ..." is ambiguous
<notk0>
I solved it it was my mistake
<notk0>
if I have
<adrien>
the "else" could belong to the first or second
<notk0>
let p = foo where foo is a function, and I want to redefine p to be the result of foo applied to another function, what do I do?
<notk0>
I did
<notk0>
let v = foo a in bar v
<notk0>
but can I combine them in a more elegant way?
zpe has joined #ocaml
zpe has quit [Ping timeout: 258 seconds]
pkrnj has joined #ocaml
<flux>
well, how about let p = bar (foo a) :)
<flux>
(I think I don't get the point here..)
<adrien>
yeah, same
yacks has quit [Quit: Leaving]
clintnewsom has quit [Quit: clintnewsom]
zpe has joined #ocaml
troydm has joined #ocaml
troydm has quit [Client Quit]
mye_ has joined #ocaml
mye has quit [Ping timeout: 258 seconds]
mye_ is now known as mye
ttamttam has joined #ocaml
ttamttam has left #ocaml []
zpe has quit [Ping timeout: 260 seconds]
troydm has joined #ocaml
<ollehar>
any sensible way to loop two lists at the same time? or best to use a for loop?
<ollehar>
I want to combine elements from the lists into tuples
<Qrntz>
I really like the part about no dependencies
<Qrntz>
(Batteries is rather large as a whole but sometimes I just need one container)
<companion_cube>
there are some modules in there that depend on other modules
<companion_cube>
however, Gen is dependency-free :)
<companion_cube>
(also, Future)
<Qrntz>
thanks, will keep that one in mind
<companion_cube>
cool! :D
groovy2shoes has joined #ocaml
<adrien>
iirc, despite batteries being fairly large, it doesn't have to make your executable size explode since you'll only link in what you actually use
<companion_cube>
isnt'it the same for the std lib?
<adrien>
it is
<adrien>
granularity is per-cmx if I'm not mistaken
<companion_cube>
sounds reasonable, indeed
<adrien>
need to check
<adrien>
things don't add up
pkrnj has quit [Quit: Computer has gone to sleep.]
<adrien>
build both .ml with -c, then create baz.cmxa with these two .cmx files
<adrien>
then call 'ocamlopt baz.cmxa', it creates 'a.out'
<adrien>
run a.out, it doesn't print anything
<adrien>
now, if you create a.ml with: echo 'module F = Foo' > a.ml
<adrien>
and run 'ocamlopt baz.cmxa a.ml', the corresponding a.out executable will print 42
pkrnj has joined #ocaml
zpe has joined #ocaml
Cyanure has joined #ocaml
awm22 has joined #ocaml
<notk0>
can I have multiple stuff that throws exceptions inside a try ?
<notk0>
try ( Map.find .1.. Map.find 2 .. ?
zpe has quit [Ping timeout: 246 seconds]
groovy2shoes has quit [Quit: Computer has gone to sleep]
ollehar1 has joined #ocaml
<thizanne>
notk0: yes
<notk0>
thizanne: ty, I figured I don't need that since I can't tell which one throwed an exception, and I need it in my case
<thizanne>
but you won't be able to know which Map.find raised the exception, in your case
<thizanne>
notk0: if you need it, you can do something like exception Absent of key;; let find t x = try Map.find t w with Not_found -> raise Absent x
<thizanne>
+parentheses
<notk0>
that's why I did two try with
<notk0>
is anyone familiar on how partial application is implemented in Ocaml? it seems that the compiler doesn't differentiate between a normal application and a partial one
Yoric1 has quit [Ping timeout: 246 seconds]
marblen has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
ollehar1 has quit [Ping timeout: 256 seconds]
<notk0>
is there a method to remove the last element of a list?
<notk0>
I can to List.hd (List.rev l) ?
<companion_cube>
I'm not sure it's a good way to use a list
<companion_cube>
(but it's easy to write if needed)
<notk0>
well I already have a list
<notk0>
well there is List.nth but I will need to call List.length
<companion_cube>
I mean, you can write a recursive function that does it
<notk0>
so I'd assume it's complexity is 2 *O(n)
<notk0>
companion_cube: yes I know
Yoric has joined #ocaml
myx has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]