<ramses>
does anyone know how to specify the argument and return type of a function using let?
<julm>
# let f : int -> string = fun _ -> "";;
<julm>
val f : int -> string = <fun>
<ramses>
ok wow thanks!
Amorphous has quit [Ping timeout: 245 seconds]
mfp has quit [Ping timeout: 245 seconds]
Amorphous has joined #ocaml
mfp has joined #ocaml
<mbac>
it's really rare that you need to specify the types though
<orbitz>
mbac: for top level definitons i find it veyr helpful
<orbitz>
althouhg I don't od it in ocaml because i find that trick to be ugly, i really want to be able to write 'val' lines by hand
<mbac>
why is it very helpful?
drunK has quit [Remote host closed the connection]
<thelema_>
mbac: I've considered extending tuareg to put the type of toplevel expressions after the =
<orbitz>
mbac: it's non idiomatic
<orbitz>
mbac: oh, why are top level type defintions helfpul? I think it helps readability
<orbitz>
and eror rreporting
<flux>
mbac, it's nice when you come back to complicated code.
<flux>
sometimes I just write the signature (.mli) first and then copy-paste the definitions to the .ml-file, and then convert val a : y to let a : y = fun _ -> assert false
<flux>
(or failwith "TODO")
<thelema_>
yup, skeleton code
thelema_ is now known as thelema
ulfdoz has joined #ocaml
<orbitz>
is the let f : 'a -> 'b = fun ... idiom common in code or no?
Modius has quit [Ping timeout: 240 seconds]
<thelema>
orbitz: not after I'm done writing the code.
<thelema>
but while I'm still fleshing things out...
<thelema>
it's nice to be able to compile. A good enough IDE would eliminate this, being able to typecheck a partial program
<flux>
wish ocamlc didn't stop on the first error it finds as well :)
joewilliams is now known as joewilliams_away
cthuluh has quit [Read error: Operation timed out]
<thelema>
what would it be able to do past that? I guess it could skip that whole top-level phrase as if it didn't exist...
<thelema>
maybe that'd be a good patch to write.
ulfdoz has quit [Ping timeout: 255 seconds]
ftrvxmtrx has quit [Ping timeout: 260 seconds]
<flux>
for type errors, it could assume the expression unifies to everything (ie. assert false)
<flux>
for parse errors there'd need to be some special strategy in the parser..
ftrvxmtrx has joined #ocaml
ski_ has joined #ocaml
ski has quit [Ping timeout: 255 seconds]
ski_ is now known as ski
ygrek_ has joined #ocaml
orbitz has quit [Ping timeout: 245 seconds]
tmaeda has quit [Ping timeout: 276 seconds]
tmaeda has joined #ocaml
ikaros has joined #ocaml
orbitz has joined #ocaml
zubeen has quit [Ping timeout: 276 seconds]
Snark_ has joined #ocaml
Snark_ is now known as Snark
init1 has joined #ocaml
zubeen has joined #ocaml
<zubeen>
is there a library that I can use to solve a system of equations?
<zubeen>
is there something for gaussian elimination
jsk has left #ocaml []
<flux>
I'm guessing some math libraries would means to do that
<flux>
(some bindings to a c library that is)
<flux>
matrix invertion would do?
<zubeen>
flux: no, i need to solve it using gaussian elimination
<zubeen>
in a semiring the elements may not have a multiplicative inverse
ttamttam has joined #ocaml
lpereira has joined #ocaml
ttamttam has left #ocaml []
ttamttam_ has joined #ocaml
ttamttam_ has left #ocaml []
ttamttam_ has joined #ocaml
ttamttam_ has left #ocaml []
ftrvxmtrx has quit [Quit: Leaving]
<f[x]>
mfp, iiuc ocamlmq with sqlite backed currently flushes periodically in lwt-thread?
ttamttam has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ttamttam has joined #ocaml
tangerine has joined #ocaml
tangerine has left #ocaml []
larhat has joined #ocaml
valross has quit [Quit: Ex-Chat]
<mfp>
f[x]: yes, every N messages or after 1 second
<f[x]>
and when flushing it blocks whole ocamlmq
<mfp>
yes
<f[x]>
I am running one test_send and test_receive and ocamlmq runs at 100% cpu at very low rate
<f[x]>
apparently test_receive doesn't send acks fast enough and ocamlmq iterates through all pending acks
<mfp>
if you set the limit to something low enough, the pause will be fairly short, around a few .10s of
<f[x]>
I increases flush period so that it keeps everything in mem
mikemc has joined #ocaml
<mfp>
f[x]: are you using a prefetch limit in the receiver?
<f[x]>
no
<f[x]>
no it runs more smoothly, test_send is fast, test_receive is slow
<mfp>
looking at mq_sqlite_persistence.ml, didn't really bm or optimize it; fortunately it's only 230 loc
<mfp>
yes, doing MSET.iter in get_msg_for_delivery is stupid
<f[x]>
at least it should be rev_iter probably?
<f[x]>
hm, no
<f[x]>
anyway with prefetch limit it is ok
<mfp>
the pb is that it's doing MSET.iter ( ... if not mem in ack pending then raise (Msg msg))
<mfp>
so finding a msg to be delivered is O(N pending acks)
<f[x]>
without concurrency I get 25 msg/sec from test_receive - is it expected?
<mfp>
that looks very low
<mfp>
the pg'ocaml backend delivered several hundred msgs/s per thread IIRC
<f[x]>
currently I am testing from mem only
<mfp>
I'm modifying get_msg_for_delivery right now, this should help
zubeen has quit [Ping timeout: 276 seconds]
<f[x]>
hm, tcp_nodelay of course :)
ftrvxmtrx has joined #ocaml
<f[x]>
now it is 1k/sec without concurrency
<f[x]>
and 6k with prefetch 100 :)
<f[x]>
ok, looks good
<mfp>
I'm bm'ing the code without MSET.iter now, it should be faster for purely in-mem
ygrek_ has quit [Ping timeout: 245 seconds]
cthuluh has joined #ocaml
_andre has joined #ocaml
f[x] has quit [Remote host closed the connection]
mattam has joined #ocaml
ygrek_ has joined #ocaml
zubeen has joined #ocaml
zubeen has quit [Ping timeout: 272 seconds]
f[x] has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
thelema has quit [Read error: Operation timed out]
thelema has joined #ocaml
thelema has quit [Remote host closed the connection]
thelema has joined #ocaml
avsm has joined #ocaml
ygrek_ has quit [Ping timeout: 245 seconds]
lpereira has quit [Quit: Leaving.]
<f[x]>
mfp, when reading strictly from sqlite backend ocamlmq uses 100% cpu with 90% in libsqlite
<f[x]>
probably that means that storage could be optimized somehow.. and increasing flush period shows interesting spikes in trhoughput - as if the number of not stored acks influences the time of sqlite select queries
Yoric has joined #ocaml
* f[x]
gets ~350/sec from sqlite and it is enough
tonehog has joined #ocaml
<tonehog>
yay a huge ocaml channel!
<mfp>
f[x]: I've pushed some fixes in the sqlite backend
<mfp>
f[x]: I'm now getting around 1500-2000 msgs delivered from the DB store
<tonehog>
can anyone refer me to syntax variations on ocaml and f#?
<f[x]>
mfp, csv?
<mfp>
required by ocaml-sqlexpr
<tonehog>
so no ones' ventured into mono/.net with f#?
<mfp>
f[x]: for the (currently undocumented) profiling system compatible with pgocaml_prof
<f[x]>
ah, I see
<mfp>
set OCAML_SQLEXPR_PROFILE=somefile.log and then pgocaml_prof somefile.log to get per-query statistics
<f[x]>
tonehog, banned in google? there are plenty of comparisons on the wen
<f[x]>
* web
<mfp>
the output is 100% compatible with pgocaml_prof except for the fact that the times are in us (since 1 ms is too coarse for many queries in SQLite :)
<tonehog>
f[x]: f# is still a bit of a baby, and acceptance is mainly by finance community, so i haven't found comparison/contrast between them specifically
<tonehog>
the main attraction for me with f# is that it's ocaml-derived with the boon of using the mono/.net CLR, so database access is much easier and unified
<tonehog>
cheers f[x]
<f[x]>
argh, need to upgrade oasis
tonehog has left #ocaml []
<f[x]>
apparently omake variables are not "on demand" ?
<f[x]>
mfp, cool, ~1.5k from DB now
<mfp>
f[x]: there are lazy variables too, but the main pb is how to force an existing function to use the values set in a section; I'm usually doing it with something like $(addsuffixes .cmi .cmx .cmo .o, mq_sqlite_persistence): in the section
<mfp>
f[x]: what do you use to profile? callgrind? gprof is not very useful here
<f[x]>
oprofile
<f[x]>
and gstack script to poke at current backtrace <-- very simple and useful
<f[x]>
mfp, I do not know omake at all, but when building sqlexpr it wanted to do oasis query version which is only referenced from release target
<mfp>
so it forced you to install oasis... that's no good, will fix it
<f[x]>
yes, thats the point (I have oasis but too old (sic!) to read version from 0.2 _oasis)
<gildor>
mfp:
<gildor>
mfp: you could probably load setup.data or something similar
<f[x]>
I think gildor has highlighting enabled on oasis keyword :)
<gildor>
f[x]: of course
<gildor>
mfp: hum, you probably talk about the variable "VERSION = $(shell oasis query Version | tail -1)"
<gildor>
f[x]: ^^^
<f[x]>
yes
<gildor>
are sections always evaluated ?
<gildor>
in OMakefile
<mfp>
AFAIK they are
<mfp>
I'm trying to fix by using a lazy expression
<gildor>
mfp: maybe you have a way to load setup.data
<gildor>
mfp: e.g. -include setup.data
<mfp>
there's no setup.data at that point, is there?
<gildor>
mfp: it will give you access to pkg_version
<mfp>
omake release is executed before there's even a setup.ml (it's generated in a temp branch)
<gildor>
mfp: indeed you must do this after a successful ocaml setup.ml -configure
<gildor>
wait a second
<mfp>
I do this to avoid polluting the repository with oasis-generated files
<f[x]>
mfp, there is a bug : launch ocamlmq, then test_receive, then test_send - receive gets a handful of messages and then hangs forever (doesn't receive anything anymore)
<gildor>
is there a way to move the VERSION variable to the release target, to evaluate it only when needed ?
<mfp>
f[x]: did I just introduce it in my last push, or was it there before?
<f[x]>
introduced in last push
<mfp>
gildor: IIRC that wasn't possible, but I'll try. At any rate, this is my/omake's fault, not oasis' :)
<f[x]>
(oasis could be a little bit backward-compatible)
<f[x]>
(not sure whether it is adequate now, but in future..)
<mfp>
k, pushed a (I hope) fix for ocaml-sqlexpr
<mfp>
f[x]: are you sure it's from the last push?
<f[x]>
hm, yes
<gildor>
f[x]: well we are talking about v0.1 and v0.2 ;-)
<mfp>
what am I doing wrong then /me scratching head
<gildor>
f[x]: there was nothing v0.1 to query version
<gildor>
but you can parse a OASISFormat: 0.1 with v0.2
<mfp>
seems to me I just reproduced it with b0f55
jsk has joined #ocaml
<f[x]>
hm, no, works ok here
<f[x]>
ocamlmq -maxmsgs 1000 and test_receive --ack --newline --prefetch 100
<f[x]>
works ok in b0f55, hangs in read in current HEAD
<mfp>
blocks after the value given to maxmsgs msgs received if not using prefetch
<gildor>
jsk: indeed, but to be honnest, this is my first time
<jsk>
gildor: definitely a good result for first time. I think these first-class modules could have many uses.
<gildor>
jsk: at ML workshop there was two good papers about it, it is full of promises
<gildor>
jsk: when Xavier told us at last CAML consortium, I already see some immediate use of it -- and I don't even yet encompass how useful they can be
<jsk>
I wonder if they might help with a more natural encoding of type classes.
<jsk>
It reminds me a little of the Scala language, where type classes can be encoded using the "implicits" system.
<flux>
I think that as long as no type-driven decisions can be made by the compiler, no 'nice' type-classes will arrive..
<jsk>
Functions can be labelled as taking implicit parameters. When calling such functions, one need not explicitly pass in a value for an implicit parameter, but the compiler inserts a value automatically if it detects exactly one type-compatible value in scope.
<jsk>
If no such compatible values are in scope, then the compiler reports an error.
<jsk>
If there is more than one type-compatible value, that's also an error.
<jsk>
anyway, just a thought... :)
joewilliams_away is now known as joewilliams
flux has quit [Read error: Connection reset by peer]
flux has joined #ocaml
boscop has quit [Ping timeout: 245 seconds]
flux has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
flux has joined #ocaml
flux has quit [Remote host closed the connection]
flux has joined #ocaml
joewilliams is now known as joewilliams_away
ftrvxmtrx has quit [Quit: Leaving]
joewilliams_away is now known as joewilliams
Smerdyakov has joined #ocaml
avsm has quit [Quit: Leaving.]
ygrek_ has joined #ocaml
ftrvxmtrx has joined #ocaml
adrien is now known as Camarade_Tux
Camarade_Tux is now known as adrien
ulfdoz has joined #ocaml
drunK has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
ulfdoz_ is now known as ulfdoz
_andre has quit [Quit: *puff*]
Edward__ has joined #ocaml
ttamttam has quit [Quit: Ex-Chat]
Smerdyakov has quit [Quit: Leaving]
rfg has joined #ocaml
<mfp>
f[x]: fixed the bug I introduced in Mq_sqlite_persistence, now working fine apparently. Remember to use --prefetch though(!): there's a O(N pending acks) factor.
<mfp>
(when the msgs are read from DB)
<adrien>
anyone tried mlbrot? it doesn't compile here ( "Parse error: 'END' or 'ELSE' expected after [str_item_or_macro] (in [str_macro_def])", in mfloat.ml )
init1 has quit [Quit: Quitte]
<adrien>
camlp5 5.15 btw
ccasin has quit [Quit: Leaving]
ulfdoz has quit [Ping timeout: 260 seconds]
<flux>
plap
<flux>
whops, wrong channel
<adrien>
pouet
Yoric has quit [Quit: Yoric]
Snark has quit [Quit: Ex-Chat]
ikaros has quit [Quit: Leave the magic to Houdini]
rfg has quit [Ping timeout: 245 seconds]
rfg has joined #ocaml
rfg has quit [Ping timeout: 245 seconds]
rfg_ has joined #ocaml
ygrek_ has quit [Ping timeout: 245 seconds]
rfg has joined #ocaml
rfg_ has quit [Ping timeout: 276 seconds]
valross has joined #ocaml
<rfg>
Why does this not work: List.filter (fun x -> x != "") ["";"";"1";"2"]?
bacam_ has joined #ocaml
rks has quit [Quit: dodo]
<gildor>
rfg: List.filter (fun x -> x <> "") ["";"";"1";"2"]