<jgrozave>
i'm trying to compile findlib in windows and am hitting a bit of an issue
<jgrozave>
it keeps saying that it can't find the standard library path when I try to run configure in cygwin
<jgrozave>
okay I think I've figured out the problem. Apparently it has to do with windows line endings
mal`` has joined #ocaml
msteele_ has joined #ocaml
<jgrozave>
does anyone have any advice?
Dead_Dreamer has quit []
alexyk has joined #ocaml
<alexyk>
hey mfp!
travisbrady has quit [Quit: travisbrady]
_unK has quit [Remote host closed the connection]
iratsu has quit [Ping timeout: 264 seconds]
elehack has joined #ocaml
srcerer has joined #ocaml
iratsu has joined #ocaml
ski has joined #ocaml
iratsu has quit [Ping timeout: 260 seconds]
iratsu has joined #ocaml
ccasin has quit [Quit: Leaving]
iratsu has quit [Ping timeout: 240 seconds]
travisbrady has joined #ocaml
Associat0r has quit [Quit: Associat0r]
iratsu has joined #ocaml
caligula__ has joined #ocaml
caligula_ has quit [Ping timeout: 258 seconds]
elehack has quit [Quit: Goodbye...]
<alexyk>
how do I declare a function's type in .ml file?
<sgnb>
alexyk: e.g. let f : int -> int -> int = fun x y -> x+y
<alexyk>
ok
<sgnb>
alexyk: you can also do let f (x:int) (y:int) : int = x+y
neorab has joined #ocaml
iratsu has quit [Ping timeout: 260 seconds]
<thelema>
alexyk: in general it's not good form to declare types in your .ml file
<sgnb>
it can help
<thelema>
there are times that you get performance out of it. There are times it'll track down bugs. But I still recommend against it.
<alexyk>
thelema: I have an inner function which doesn't typecheck; I'd much prefer to add the type to help both debug and understand it. I prefer Haskell style and believe it's excessive pedantry to move types into .mli. Moreover, I don't see how can you move the type of a nested function there?
<alexyk>
I mean .mli is good, but better have types in .ml too.
<alexyk>
types help development and must document the functions right next to their bodies
<aavogt>
can you do calculations with types in ocaml?
<thelema>
aavogt: not so much
<aavogt>
that is, get the type inference to do an interesting calculation
<alexyk>
aavogt: I've seen you somewhere! :)
<alexyk>
thelema: how you as an ocaml veteran can live without types next to bodies? or you infer it all in your mind?
<alexyk>
:)
<thelema>
alexyk: I'll admit you can't put that in the .mli file. I'm not recommending putting types in the .mli file, I'm recommending at most putting nice comments
<thelema>
C-c C-t
<alexyk>
thelema: you mean comments in .ml.
<alexyk>
aavogt: did you come for some sweet speedup?
<thelema>
yes. If you nail down all your types, your program becomes harder to change
<alexyk>
thelema: ah ok. Well, you can still do 'a, etc., no?
<aavogt>
alexyk: I'm not concerned about performance much
<alexyk>
aavogt: good for you :)
<thelema>
alexyk: annotation with 'a is useless, as it doesn't actually require the underlying type be polymorphic
<thelema>
(although that might be something changing with 3.12)
<LionMadeOfLions>
ocaml IDE: which one do you use
<thelema>
LionMadeOfLions: emacs + tuareg 2.0.1
iratsu has joined #ocaml
<alexyk>
is there a function of two parameters returning just the first one?
<alexyk>
in stdlib
<alexyk>
or batteries
<alexyk>
const in Haskell
<thelema>
yes, ignore
<alexyk>
ok
<thelema>
in batteries
<thelema>
err... maybe ignore returns the second...
<alexyk>
nope, I need 'a -> b' -> 'a
<thelema>
const
<thelema>
in batteries
<alexyk>
cool
<alexyk>
how do you compose functions in batteries?
<thelema>
<| would be that, except the associativity isn't correct, iirc
<alexyk>
<| unbound!
<alexyk>
in 1.2.1
<thelema>
try (**>)
<thelema>
that operator has been a bit transitional
<alexyk>
ok
<alexyk>
but I want <| back :)
<alexyk>
in 1.2.3 :)
<thelema>
I think **> has the needed precedence & associativity
<alexyk>
yes
<thelema>
a syntax extension has been proposed to fix this, but I consider that a hack
<alexyk>
do we have a xavier bot here somewhere?
<alexyk>
(fun x -> x * 2) **> succ **> 1;;
<alexyk>
that works
<alexyk>
so <| requires a syntax extension, can't work in regular ocaml?
<thelema>
it won't work as $ in haskell because of associativity or precedence or both
<alexyk>
thelema: how do you explain the minimal API of Hashtbl compared with mammoth Data.Map of Haskell? mapWithKey, foldWithKey, intersectionWith, unionsWith, etc?
<alexyk>
aren't the idea of Batteries to provide a rich API?
<thelema>
Hashtbl is imperative.
<alexyk>
so we can still have things in it like merge
<thelema>
Batteries is hampered a bit by having to keep compatibility with standard ocaml, which means we have to cheat a bit to keep type compatibility with std types
<thelema>
I'm thinking of Set/Map here
<alexyk>
ok... maybe modules for extra functions?
<thelema>
yes, similarly for hashtbl - we define identical types and break the abstraction with %identity functions
<thelema>
modules don't help - we could write everything in terms of the given funtions (mainly fold), but the performance would suffer so...
<thelema>
you're very welcome to submit additional functions for batHashtbl
<alexyk>
I have some small one defined in terms of H.fold
<alexyk>
performance question: I have huge graphs I keep as Hashtbl, millions of entries. What do I give when Hashtbl.create N;; for N?
<thelema>
million will do
<alexyk>
ok -- will it allocate at once?
<thelema>
yes
<thelema>
ocaml uses linked list buckets - not the most efficient considering cache page size
<thelema>
but it means that if you plan on inserting n elements, it's good to tell ocaml when you make the hashtbl to make one of size n
<alexyk>
thelema: did you see mfp's comparison of several Hashtbl implementations? I wonder if Batteries can include his better ones?
<alexyk>
on eigenclass.org
<alexyk>
several different Hashtbl variants to choose from
<alexyk>
would be super :)
<thelema>
yes, I'm approving of that...
<thelema>
of course it depends a lot on how you use them, but yes, I do intend for batteries to offer a better hashtable
<travisbrady>
alexyk: you may have a system log file you can check. On os x /var/log/system.log has good info
<thelema>
alexyk: gdb
<travisbrady>
thelema: ahh shoot, I never knew that. If I wrap it in an option type will that work?
<thelema>
yes
infoe has quit [Ping timeout: 260 seconds]
<alexyk>
thelema: is it enough to compile all with -g, or I also have to run with some option? I get symbols undefined in gdb
<thelema>
you're compiling with nativeopt, right?
<thelema>
err, ocamlopt
<thelema>
it should be enough to compile with -g for gdb
<alexyk>
ocamlopt, yes
<thelema>
you get no defined symbols in a backtrace?
emmanuelux has quit [Remote host closed the connection]
infoe has joined #ocaml
Yoric has joined #ocaml
Yoric has quit [Quit: Yoric]
iratsu has quit [Ping timeout: 240 seconds]
valross has quit [Quit: Ex-Chat]
Yoric has joined #ocaml
iratsu has joined #ocaml
Amorphous has quit [Ping timeout: 248 seconds]
ulfdoz has quit [Ping timeout: 240 seconds]
<alexyk>
yes...
<alexyk>
undefined symbols in backtrace
<alexyk>
can value names coincide with type names?
travisbrady has quit [Quit: travisbrady]
Amorphous has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<Yoric>
alexyk: yes
Yoric has quit [Quit: Yoric]
ftrvxmtrx has joined #ocaml
<alexyk>
is there a way to specify, for Hashtbl.of_enum, the initial -- huge -- size?
ikaros has joined #ocaml
thrasibule has quit [Quit: No Ping reply in 180 seconds.]
thrasibule has joined #ocaml
<alexyk>
is there a way to tell ocaml runtime to allocate more aggressively?
<adrien>
you can control the Gc parameters
<adrien>
with the Gc module (or some environment variable: OCAMLRUNPARAM)
<adrien>
but what do you mean with "allocate more aggressively?"
ttamttam has joined #ocaml
alexyk has quit [Quit: alexyk]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
spearalot has joined #ocaml
_unK has joined #ocaml
GENE has joined #ocaml
GENE has left #ocaml []
alexyk has joined #ocaml
Associat0r has joined #ocaml
filp has joined #ocaml
_unK has quit [Remote host closed the connection]
seafood has quit [Quit: seafood]
_andre has joined #ocaml
alexyk has quit [Quit: alexyk]
oriba has joined #ocaml
boscop_ has left #ocaml []
boscop has joined #ocaml
thrasibule has quit [Quit: No Ping reply in 180 seconds.]
thrasibule has joined #ocaml
iratsu has quit [Ping timeout: 264 seconds]
seafood has joined #ocaml
iratsu has joined #ocaml
fraggle_laptop has quit [Quit: Quitte]
fraggle_laptop has joined #ocaml
thrasibule has quit [Ping timeout: 265 seconds]
avsm has joined #ocaml
LionMadeOfLions has quit [Ping timeout: 260 seconds]
LionMadeOfLions has joined #ocaml
EvanR has quit [Ping timeout: 265 seconds]
fraggle_laptop_ has joined #ocaml
EvanR has joined #ocaml
fraggle_laptop has quit [Ping timeout: 260 seconds]
fraggle_laptop_ has quit [Client Quit]
fraggle_laptop has joined #ocaml
fraggle_laptop has quit [Client Quit]
fraggle_laptop has joined #ocaml
fraggle_laptop has quit [Ping timeout: 248 seconds]
fraggle_laptop has joined #ocaml
iratsu has quit [Ping timeout: 264 seconds]
iratsu has joined #ocaml
iratsu has quit [Ping timeout: 240 seconds]
iratsu has joined #ocaml
ccasin has joined #ocaml
iratsu has quit [Ping timeout: 240 seconds]
_unK has joined #ocaml
iratsu has joined #ocaml
oriba has quit [Quit: Verlassend]
myu2 has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
alexyk has joined #ocaml
seafood has quit [Quit: seafood]
<alexyk>
if I use Hashtbl in a List.fold_left like this: let ustats' = List.fold_left (fun res user -> H.add ustats user nus; res) ustats newUsers -- is it much worse than using List.iter? I want to be able to switch to pure map easier if I want to.
<alexyk>
adrien: I use Hashtbl a lot and it grows slowly. Is giving a large parameter to Hashtbl.create the only way to make OCaml allocate them faster?
ikaros has quit [Quit: Leave the magic to Houdini]
<flux>
yes
<alexyk>
flux: what about the syntax above, it slower than List.iter (fun user -> H.add ustats user nus) newUsers?
<alexyk>
or basically compiles to the same?
<flux>
I guess List.iter might be marginally faster
<flux>
time to benchmark, no?-)
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 272 seconds]
spearalot has quit [Quit: Computer has gone to sleep]
ftrvxmtrx has quit [Quit: Leaving]
derdon has joined #ocaml
StdDoubt has joined #ocaml
<StdDoubt>
where can I find information on ocaml file system manipulation?
<thelema>
the Sys module and ocaml-fileutils
<thelema>
and the Unix module too, I guess
<StdDoubt>
thanks
<StdDoubt>
can I ask what are the main advantages of Ocaml over Haskell?(I am currently starting to learn Haskell in order to decide which language should I use in my future projects)
<jonafan>
ocaml might be more intuitive because it allows mutable data
<jgrozave>
i'm getting an Access is Denied error when I run "make -f Makefile.nt world" (i'm following the directions in the Readme.win32 to compile the MingW version of ocaml from source)
<jgrozave>
Could it be a problem with the way i unpacked flexlink?
<StdDoubt>
regarding parallelism what ocaml libraries would you recommend?
<thelema>
stdDoubt: ocaml's performance is very predictable - it does what you tell it to. Haskell code varies wildly in performance, from what I hear.
<thelema>
StdDoubt: if you're wanting multicore performance, ocamlmpi I think is what you want.
<thelema>
ocaml's multithreading won't go across cores/processors - one core per process.
<StdDoubt>
how do you usally list the contents of a directory in Ocaml?
<jgrozave>
does anyone here have any experience installing Batteries on windows?
myu2 has joined #ocaml
<alexyk>
if I have a record with a Hashtbl field, and I update it: { sgraph with someHash = sameHashUpdated }, where sameUpdatedHash got some new stuff say with Hashtbl.add; -- will the record reallocate/copy the hash, or reuse?
mlarsson has joined #ocaml
<StdDoubt>
is there any function in the standard library to see if a String is contained inside other ?(I only found contains_from but only works with chars)
<thelema>
alexyk: reuse - Hashtbl.copy
<alexyk>
thelema: so it will reuse right?
<alexyk>
but Hashtbl.copy is expensive
<thelema>
StdDoubt: not in stdlib, but in batteries: String.exists
<thelema>
yes, it'll reuse. That's what you get with mutable structures
<thelema>
jgrozave: if you can figure it out, we'd love to hear about it. It should just be a matter of having make on your system, although you might be able to invoke ocamlbuild properly without make
<thelema>
jgrozave: ocamlbuild does all the hard work, make just gives a better interface
brendan has quit [Read error: Operation timed out]
<jgrozave>
well i tried installing batteries using its readme, but it required findlib, so i tried to install findlib
<thelema>
yes, you will kinda need findlib and camomile.
<jgrozave>
but that was giving me strange bizzare errors because I had installed ocaml using the windows self-installer, so now I'm trying to install the mingw version of ocaml using cygwin
<thelema>
mingw != cygwin
<jgrozave>
yeah i know that. I'm following the directions to use the mingw option to gcc
<jgrozave>
although i may be doing it incorrectly
<jgrozave>
:P
<thelema>
wish I could help you - for ocaml on windows, I've installed andlinux, which works for me.
<jgrozave>
yeah, it seems to be a problem with flexlink and cygwin not dealing with symlinks properly
<jgrozave>
i don't kno
avsm has quit [Client Quit]
joewilliams_away is now known as joewilliams
<alexyk>
when you pass around a Hashtbl, is it effectively by reference? you add to it in a called function, it's changed in the calling one?
<thelema>
yes
<thelema>
ocaml is pass by value, but the vale of anything bigger than a word is the pointer to it.
<alexyk>
ok
Dead_Dreamer has quit [Ping timeout: 240 seconds]
<alexyk>
thelema: but the List is immutable and so if you change it in the callee, it is not changed in the caller?
<thelema>
you can't change the list in the callee
<thelema>
unless you make your own mutable list type, in which case you can, and it'll be changed everywhere
ttamttam has quit [Quit: Leaving.]
<alexyk>
ah ok
<thelema>
you asked if it was possible to make ocaml use more memory or sometihing like that...
<thelema>
ocaml has one rate of allocation - whatever your program needs. Every time you write (x,y), you're allocating (or matching) a tuple
<thelema>
(possible exception: function parameters)
<thelema>
ocaml does have an optimization for functions that take a tuple as their one parameter
alexyk has quit [Quit: alexyk]
<StdDoubt>
is there any good package to work with differential equations in Ocaml?
<jgrozave>
thelema: hey i was able to figure out a workaround for my symlink problem
<jgrozave>
I just copied all the files that the symlinks pointed to and copied them to the original location as well
<jgrozave>
so i took gcc-3.exe and replaced the gcc.exe faulty symlink
StdDoubt has quit [Remote host closed the connection]
<thelema>
jgrozave: nice. it's working now?
<thelema>
huh. I wonder what stddoubt was trying to do... file operations and diff eq...
<jgrozave>
thelema: well make world seems to have run without any errors :)
<thelema>
yay!
<jgrozave>
i'm not sure if the problem with the symbolic links was with flexdll or with cygwin but at least i was finally able to stumble upon a workaround
<thelema>
you're running this from bash in cygwin?
<jgrozave>
yeah
<thelema>
got me, then.
<thelema>
I wish I had a good idea what environment the win32 ocaml users use
ftrvxmtrx has joined #ocaml
<jgrozave>
haha me too :P
<thelema>
I worry that many people just use f# on windows. one of my collaborators is working to port our tool to f# because he's a windows/.net person
<jgrozave>
F# looks great, but I wish it was more compatable with standard ocaml
<thelema>
there's a large subset of both that works fine everywhere
<jgrozave>
it's nice that it is largely compatable, that's true
<thelema>
but it's the fun stuff that's not compatible across
<thelema>
anyway, gotta go.
<jgrozave>
it's nice that it's one of the officially supported .net languages though
<jgrozave>
well take care
StdDoubt has joined #ocaml
<StdDoubt>
where I can find documentation on how to load batteries included ocaml modules? I have installed and tried to do Open BatString but the compiler complains about BatString being unbound
derdon has quit [Remote host closed the connection]
derdon has joined #ocaml
filp has quit [Quit: Bye]
derdon has quit [Quit: derdon]
joewilliams is now known as joewilliams_away
<mfp>
StdDoubt: in the toplevel, do #require "batteries";;
<mfp>
as for the compiler, you have to do something like ocamlfind ocamlopt -package batteries -c foo.ml -thread
<StdDoubt>
mfp: or in a module file?
<StdDoubt>
thanks
<mfp>
np
avsm has joined #ocaml
alexyk has joined #ocaml
<alexyk>
for accessing several record fields, is {field1=x;field2=y}=myrec slower than: x = myrec.field1 ... ?
<flux>
alexyk, atleast the scoping doesn't work the way your indentation implies you think it works..
<flux>
match () with () -> (); match () with () -> () is the same as match () with () -> ((); match () with () -> ())
<flux>
other than that, well, it's difficult to find out because the line numbers are wrong and it cannot be run
ttamttam has joined #ocaml
<alexyk>
flux: so should I enclose each branch of a match in begin .. end there?
<flux>
alexyk, no, you should enclose the entire match in begin/end or (/)
<flux>
maybe some higher order function would be useful there
<flux>
let call_some v f = match v with None -> () | Some v -> f v
<alexyk>
yes, thanks! I simply rewrite pure Haskell in more imperative ocaml
<alexyk>
:)
<flux>
call_some dr_ (addMap ins);
<alexyk>
nice
<flux>
indeed, the begin/ends inside your match clauses are superfluous
ztfw has quit [Read error: Connection reset by peer]
ztfw has joined #ocaml
ztfw has quit [Ping timeout: 240 seconds]
<alexyk>
flux: thx, that worked and looks prettier
<eldragon>
U.S. is cutting international businesses that work in Iran
emmanuelux has joined #ocaml
<alexyk>
is there an -O2 or such option to ocamlopt?
<flux>
alexyk, basically only -inline affects optimization aggressivenes
ikaros has joined #ocaml
StdDoubt has quit [Quit: Leaving]
emmanuelux has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
mlarsson has quit [Ping timeout: 240 seconds]
alexyk has quit [Quit: alexyk]
<jgrozave>
I've got a tricky question for you guys
<jgrozave>
I just installed ocaml-3.11.2 on my windows machine using mingw
<jgrozave>
now when i try to install findlib, i get a strange error about dllunix.dll not being found
<jgrozave>
I've narrowed it down to a call to camlp4
<jgrozave>
in fact whenever i try to call camlp4 it gives an error complaining about dllunix.dll not being found
<jgrozave>
even camlp4 --help
<jgrozave>
my question is, what is the serach path for loading shared libraries
alexyk has joined #ocaml
npouillard has quit [Ping timeout: 260 seconds]
npouillard has joined #ocaml
<jgrozave>
no worries, I figured out the problem. I didn't have CAML_LD_LIBRARY_PATH set correctly
<gildor>
jgrozave: you also need OCAMLLIB
<jgrozave>
yeah that I had set correctly
<jgrozave>
but I had a cygwin path set in CAML_LD_LIBRARY_PATH
npouillard has quit [Read error: Operation timed out]
npouillard has joined #ocaml
<jgrozave>
but down in the original c code it was concatenating a backslash to that path and then the library so it came out "/path/to/ocaml/lib/site-lib\dllunix.dll"
<jgrozave>
but changing the variable to "C:\Cygwin\path\to\ocaml\lib\site-lib" makes everything work nicely together
<gildor>
jgrozave: as far as I remember there is a problem with detection of platform in findlib configure
<jgrozave>
yeah, that's what i'm finding
<jgrozave>
trying to hack it together
<gildor>
look for the first cygpath occurence and you will find the test that fails
<gildor>
jgrozave: I have a patch against findlib 1.2.4
<gildor>
(ocaml is the toplevel, ocamlc, the compiler)
<jgrozave>
gildor: that's what's in the configure. it looks like it's just testing to see if loading of dlls is possible
alexyk has quit [Read error: Connection reset by peer]
alexyk_ is now known as alexyk
ftrvxmtrx has joined #ocaml
<jgrozave>
gildor: apparently i did the same thing with OCAMLLIB as the other environment var and used cygwin path notation so it didn't know where to look for the library files
ttamttam has quit [Quit: Leaving.]
_andre has quit [Quit: *puff*]
ulfdoz has quit [Ping timeout: 260 seconds]
joewilliams_away is now known as joewilliams
alexyk has quit [Quit: alexyk]
valross has joined #ocaml
avsm has joined #ocaml
joewilliams is now known as joewilliams_away
<travisbrady>
Can anyone point me to the spot in the ocaml source where the list type is defined?
<sgnb>
travisbrady: typing/predef.ml
<travisbrady>
sgnb: thank you.
Dead_Dreamer has joined #ocaml
pad has joined #ocaml
<travisbrady>
sgnb: do you know where I can find the actual implementation?
<sgnb>
travisbrady: same file
<sgnb>
(or I didn't get what you mean by "actual implementation"
<sgnb>
)
avsm has quit [Quit: Leaving.]
<sgnb>
(look for decl_list)
<travisbrady>
Ok. What I'm really hoping to get at is big O's for the stuff in List
<sgnb>
big O's?
<travisbrady>
the time complexity for say, List.nth
<sgnb>
travisbrady: List.nth is defined in... List
<sgnb>
(stdlib/list.ml)
<sgnb>
the complexity should be obviously linear
emmanuelux has joined #ocaml
<travisbrady>
that I know. I was unclear. I'm curious about the implementation of the list type. I thought I'd see a basic linked list type somewhere but didn't. the stuf in typing/predef.ml is confusing to me.
seafood has joined #ocaml
jakedouglas has joined #ocaml
_unK has quit [Remote host closed the connection]
<sgnb>
travisbrady: the definition is in abstract syntax there
<sgnb>
you can have a look at the documentation for a friendlier definition
<sgnb>
type 'a list = [] | :: of 'a * 'a list
<travisbrady>
ahh, that is friendlier yes. I'd never seen predef.ml and I find it confusing
neorab has quit [Quit: WeeChat 0.3.2]
ikaros has quit [Quit: Leave the magic to Houdini]
<jakedouglas>
any significant ocaml businesses other than jane street?