flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.03.0 announced http://ocaml.org/releases/4.03.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
rand__ has quit [Quit: leaving]
silver has quit [Quit: rakede]
copy` has quit [Quit: Connection closed for inactivity]
darkf has joined #ocaml
walter|r has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
walter|r has quit [Ping timeout: 244 seconds]
michbad has joined #ocaml
tennix has joined #ocaml
pierpa has quit [Ping timeout: 250 seconds]
agarwal1975 has joined #ocaml
tennix has quit [Quit: WeeChat 1.5]
pyon has quit [Quit: ... flowering silent scarlet piece of night.]
nicholasf has quit [Remote host closed the connection]
Algebr` has joined #ocaml
troydm has quit [Ping timeout: 244 seconds]
<def`> sh0t: I can help
<def`> what's the problem?
troydm has joined #ocaml
yunxing_ has joined #ocaml
nicholasf has joined #ocaml
troydm has quit [Ping timeout: 244 seconds]
yunxing_ has quit [Quit: Leaving...]
nicholasf has quit [Ping timeout: 272 seconds]
rgrinberg has joined #ocaml
sh0t has quit [Remote host closed the connection]
johnelse has quit [Ping timeout: 272 seconds]
johnelse has joined #ocaml
regnat has quit [Ping timeout: 276 seconds]
tg has quit [Quit: Leaving]
tg has joined #ocaml
johnelse has quit [Ping timeout: 276 seconds]
johnelse has joined #ocaml
yunxing_ has joined #ocaml
yunxing_ has quit [Client Quit]
johnelse has quit [Ping timeout: 264 seconds]
regnat has joined #ocaml
johnelse has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
pyon has joined #ocaml
FreeBirdLjj has joined #ocaml
Algebr` has quit [Ping timeout: 250 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
A1977494 has joined #ocaml
slash^ has joined #ocaml
f[x] has joined #ocaml
MercurialAlchemi has joined #ocaml
shim has quit [Ping timeout: 264 seconds]
michbad has quit [Ping timeout: 246 seconds]
michbad has joined #ocaml
f[x] has quit [Ping timeout: 260 seconds]
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 276 seconds]
michbad has quit [Remote host closed the connection]
technomancy has joined #ocaml
<technomancy> I'm looking for a static (hopefully ML-like) language that is easy to embed in a larger program the way Lua is. any suggestions?
<def`> OCaml :p?
<technomancy> I get the impression that OCaml is really difficult to embed in a C program, but maybe that's not correct?
<technomancy> I should add that I will need to compile code at runtime, since the application in question is a programming-centric game.
<technomancy> and sadly most of my users are on Windows
<def`> All requirements look fine to me
<def`> OCaml is easy to embed, I don't know what gave you this impression.
<def`> Compiling code at runtime is fine too, with different tradeoff.
<technomancy> well, when I've written my own ocaml programs, the toolchain has always felt very complicated, with loads of moving parts compared to lua
<def`> So I should say it this way: the runtime is easy to embed
<def`> the compiler is a bit harder to work with :-)
AlexDenisov has joined #ocaml
<def`> So it require some discipline to work with. But it is possible to get a straightforward workflow.
<technomancy> right... I was looking at https://jesserayadkins.github.io/lily/ which looks a lot easier to embed and compile (basically only one dependency) but its inference isn't very good
<technomancy> I don't care at all about performance or libraries in this case
<technomancy> so a "toy" type language is fine
<def`> I see. I don't really know what to suggest... What about embedding a JS engine and using a language that compile to JS?
<def`> typed*
<technomancy> hm; hadn't thought about that
tg has quit [Quit: Leaving]
<technomancy> I feel like the typescript toolchain is pretty baroque too though
TheLemonMan has joined #ocaml
tg has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
malc_ has joined #ocaml
<def`> technomancy: what about flow?
A19774941 has joined #ocaml
A1977494 has quit [Ping timeout: 258 seconds]
<adrien> cmxs files can do the trick
<adrien> lexifi does this
fluter has quit [Ping timeout: 272 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
fluter has joined #ocaml
A19774941 has quit [Quit: Leaving.]
octachron has joined #ocaml
freehck has quit [Ping timeout: 260 seconds]
<technomancy> def`: huh, is flow basically dialyzer for JS?
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #ocaml
tg has quit [Quit: Leaving]
FreeBirdLjj has quit [Ping timeout: 276 seconds]
tg has joined #ocaml
mrallen1 has joined #ocaml
sdothum has joined #ocaml
stephe_ has joined #ocaml
sepp2k has joined #ocaml
mankyKitty has joined #ocaml
jeroud has joined #ocaml
tane has joined #ocaml
Simn has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Remote host closed the connection]
tane has quit [Quit: Verlassend]
tane has joined #ocaml
troydm has joined #ocaml
nicholasf has joined #ocaml
rand__ has joined #ocaml
<def`> technomancy: it's a type system for JS yes
nicholasf has quit [Ping timeout: 264 seconds]
<mrvn> can ocmal be run in-place or does it need make install?
<fds> I'm pretty sure I used to run it in-place before I used opam.
<mrvn> bin/ocaml
<mrvn> Fatal error: unknown C primitive `caml_add_debug_info'
<mrvn> hmm, thats an ocamlrun "script".
<mrvn> % LD_LIBRARY_PATH=$PATH/lib bin/ocamlrun bin/ocaml
<mrvn> OCaml version 4.04.0+dev0-2016-02-18
<mrvn> Fatal error: exception Cmi_format.Error(_)
<mrvn> That gets a bit further.
zaquest has quit [Quit: Leaving]
<fds> Hm, I could be wrong. It was a couple of years ago.
zaquest has joined #ocaml
<Drup> fds: I highly doubt you did that
nicholasf has joined #ocaml
<Drup> mrvn: "-nostdlib -I path/to/local/stdlib" should help, but installing is the easiest way
<mrvn> Success: # let b = Bigarray.Array1.create Bigarray.Int_least31 Bigarray.C_layout 1024;;
<mrvn> val b : (int, Bigarray.int_least31_elt, Bigarray.c_layout) Bigarray.Array1.t = <abstr>
<octachron> mrvn, note that if you want to do some quick test on some compiler's patch, hijacking the testsuite might be the quickest way
<Drup> octachron: I just do "ocaml -no-stdlib -I stdlib" ;)
sepp2k has quit [Ping timeout: 258 seconds]
nojb_ has joined #ocaml
<octachron> Drup, rather ./byterun/ocamlrun ./ocaml -nostdlib -I stdlib, no?
<Drup> ah, yes
<Drup> and rlwrap before that, for good measure
<mrvn> Add support for int_least31 to bigarray
<mrvn> Would be nice if someone could test that.
<mrvn> Is there something like https://godbolt.org/ for ocaml?
<Drup> mrvn: -S ?
<octachron> mrvn, it might be nice to extend the tests in testsuite/tests/lib-bigarray/bigarrays.ml in order to exercice the int_least31 bigarray format
dhil has joined #ocaml
<gasche> mrvn, Drup: "make runtop"
<gasche> (cc fds)
FreeBirdLjj has joined #ocaml
A1977494 has joined #ocaml
<gasche> (this command was not available "years ago", but running the toplevel without installing always worked with the right invocation)
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
<Drup> gasche: hum, how recent is that one ?
fraggle_ has quit [Read error: Connection reset by peer]
fraggle_ has joined #ocaml
<gasche> December 10, 2015
<adrien> mrvn: in-place, with -nostdlib, and -I
<gasche> "make runtop"
<mrvn> gasche: thx
loocash has joined #ocaml
dhil has quit [Ping timeout: 252 seconds]
shim has joined #ocaml
<loocash> Hi guys, I was recently playing with ocaml and I solved this problem (https://projecteuler.net/problem=21) in both OCaml (http://pastebin.com/PgBK0HMM) and JS (http://pastebin.com/zj0JygjG). In my computer interpreted JS runs faster than compiled (corebuild solution.native) ocaml code. Is that what it supposed to be or it's just something wrong with my ocaml code?
<mrvn> ocaml doesn't optimize and you create a lot of lists in the ocaml code
<mrvn> loocash: why is 1 a divisior of n but n is not?
<loocash> "proper" divisor
<loocash> it is in problem definition
<mrvn> odd definition
<loocash> so how can i make this code run faster?
<loocash> how to create fewer lists?
<TheLemonMan> replace the pipelines with imperative for loops maybe ?
<mrvn> Don't use List.range, use a recursion
<mrvn> Also I would first compute the sum of proper divisors for all numbers into an array. Then go through the array and add up the amicable numbers.
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
<mrvn> and don't do the test cases when timing.
nicholasf has quit [Remote host closed the connection]
<mrvn> it could also help to make some lists of potential divisors or branch in the code. For example if n is odd then you can skip all even numbers.
<mrvn> or find the prime factors and then compute the proper divisors from that.
<loocash> Yes I could implement more efficient algorithm but I wanted to compare it with its equivalent int JS.
<loocash> ok thanks for advices I will try some of them and tell if something interesting happens
<mrvn> That's why I started with the list thing. I think the js code doesn't create the lists
nicholasf has joined #ocaml
<mrvn> or rather just a list of divisors and not a list of all numbers < n/2+1
<mrvn> have you tried running the ocaml code through js_of_ocaml?
<loocash> no should I?
<gasche> loocash: how do you run your JS code?
<loocash> gasche: from node
<loocash> with
<gasche> it's not "interpeted", then
<gasche> (even with the missing "r")
technomancy has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
<loocash> gasche: I didn't know that. It makes a difference. THanks
<gasche> you could try using Core.Sequence instead of Core.List, it doesn't build lists in memory
<gasche> (I suppose Javascript's .filter operation also returns a generator instead of a full list)
<gasche> just replacing all "List" in your code by "Sequence" may work
<gasche> (of course you can also use a direct recursion, or a loop, but this allows to keep the pipelined style)
<gasche> hm
<gasche> in fact it looks like underscore's "range" method really returns a result array, so I'd guess that's just a case of v8's JS compiler beating the OCaml compiler (also arrays, used in the JS version, may have better locality than lists)
<gasche> (one should also try with Array to compare, I guess)
nicholasf has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
pdewacht has joined #ocaml
<mrvn> how short is that test anyway? <1s?
<loocash> In my cpu (core2duo 2.1 GHz) with List replaced by Sequence it takes 1.5s now
<loocash> Js takes 1.9s
<loocash> before it was 3.7s with List
<loocash> So Sequence did the trick
<mrvn> should test up to 100000
<gasche> what about Array?
octachron has quit [Ping timeout: 276 seconds]
<gasche> (which would be closer to the underscore implementation, if I understand correctly)
<mrvn> gasche: how do you filter an array down to its divisors?
<gasche> well I suppose Core.Array implements a filter method
<gasche> mrvn: I'm thinking of an (int array) as a container of integers
<gasche> hm
<gasche> I guess DynArray would be an even better counterpart to Javascript's lists
<gasche> (it is for Python in any case)
sz0 has quit [Quit: Connection closed for inactivity]
octachron has joined #ocaml
<mrvn> % time ./amicable
<mrvn> 31626
<mrvn> ./amicable 0.08s user 0.00s system 98% cpu 0.089 total
<mrvn> Is that the right result?
<loocash> yes
<mrvn> 100000: 852810 1.385 total, 1000000: 25275024 22.629 total
<gasche> I think the point was to compare similar high-level implementations, not write the fastest implementation at the expense of readability
<gasche> in JS you can write a loop nest just as well, and it will perform similarly better
AlexDenisov has joined #ocaml
<gasche> (in fact it's likely to slightly outperform the OCaml code if the JIT optimizes to use untagged integer)
<mrvn> Most of the speedup comes from: let sums = Array.init (total + 1) (fun i -> List.fold_left (+) 0 (divs i))
<mrvn> Still, it again shows that improving the algorithm gains you far more than changing language or optimizing compiler.
rgrinberg has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 250 seconds]
silver has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Ping timeout: 258 seconds]
rgrinberg has joined #ocaml
copy` has joined #ocaml
loocash has quit [Quit: Leaving]
FreeBirdLjj has quit [Remote host closed the connection]
<mrvn> gasche: any idea what causes this? ... testing 'bigarrays.ml': ocamlcmake[4]: *** [run-file] Error 1
<mrvn> => failed
stephe_ has quit []
stephe_ has joined #ocaml
stephe_ has quit [Client Quit]
stephe_ has joined #ocaml
stephe_ has quit [Client Quit]
Stephe has joined #ocaml
darkf has quit [Quit: Leaving]
Sorella has joined #ocaml
shim has quit [Quit: WeeChat 1.5]
TheLemonMan has joined #ocaml
<mrvn> how do I get verbose output for tests when building ocaml?
<octachron> mrvn, since you know which test is failing, you can simply run make in the directory of the failing test
<mrvn> octachron: that doesn't print any more than the full tests
<octachron> it should output a bigarrays.result test that you can compare to the bigarrays.reference file
<mrvn> it says: ../../makefiles/Makefile.several:100: recipe for target 'run-file' failed
jonasen has joined #ocaml
<octachron> not even an bigarrays.result file in the lib-bigarray folder?
<mrvn> it then does the other tests in the same dir
<mrvn> bigarrays.result is empty
<mrvn> wait, that could be from me trying to run just that test
<gasche> cd testsuite/tests/lib-bigarray; make; meld bigarrays.{result,reference}
<mrvn> zsh: command not found: meld
<gasche> meld is a nice diff graphical tool
<mrvn> ok, after clean I get the output file and indeed it has diffs. No surprise there.
<mrvn> Why doesn't the testsuit say that the output is different?
<gasche> who knows
<octachron> a mundane lack of documentation?
<gasche> I believe that Sébastien Hinderer is working on a unified tool to replace the heap of makefiles in the testsuite
<gasche> I wouldn't invest any effort into the current system right now
<gasche> (well, except in the test themselves, of course)
<mrvn> too late. already made a pull request to add a error message
sz0 has joined #ocaml
<mrvn> gasche: The tests found an error in the deserialise code. I've fixed that since you approved the PR.
<octachron> mrvn, the problem is that there is several versions of this Makefile in the testsuite
<gasche> (I assumed the tests passed when you sent them; but thanks in any case)
f[x] has joined #ocaml
<mrvn> ... testing 'bigarrays.ml': ocamlc ocamlopt => passed
<mrvn> they do now
dhil has joined #ocaml
larhat has joined #ocaml
<gasche> (I don't know how some people can do software development without tests)
<gasche> I think we should even go further and have a mode of development that implies writing documentation
<gasche> (I found it efficient to root out design mistakes)
AlexDenisov has quit [Max SendQ exceeded]
AlexDenisov has joined #ocaml
<malc_> gasche: reinventing literate programming are we? ;)
<octachron> gasche, I fear that that documentation depends more on developpers than on models of developpement; except if you have a strong IA that can check that the documentation is meaningful.
<mrvn> Idealy I would like code, interfaces, tests and docs in a single file.
rgrinberg has quit [Ping timeout: 258 seconds]
<companion_cube> things like doctest are nice, though
<companion_cube> docs containing code that was to compile and yield the expected result
<octachron> companion_cube, any example for ocaml?
<companion_cube> not really
<companion_cube> I know those from python, mostly
<companion_cube> (well, with qtest you can write tests in the .mli as comments, but well)
AlexRussia has joined #ocaml
dakk has joined #ocaml
SpiceGuid has joined #ocaml
SpiceGuid has quit [Client Quit]
SpiceGuid has joined #ocaml
AlexDenisov has quit [Ping timeout: 240 seconds]
AlexDeni_ has joined #ocaml
fleaswallow has joined #ocaml
pyon has quit [Quit: Know your place, 3D woman!]
nicholasf has joined #ocaml
rgrinberg has joined #ocaml
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rand__ has quit [Quit: leaving]
slash^ has quit [Read error: Connection reset by peer]
nicholasf has quit [Remote host closed the connection]
octachron has quit [Quit: Leaving]
A19774941 has joined #ocaml
A1977494 has quit [Ping timeout: 240 seconds]
melanargia1 has joined #ocaml
melanargia1 has quit [Quit: WeeChat 1.5]
melanargia1 has joined #ocaml
melanargia1 has quit [Client Quit]
melanargia1 has joined #ocaml
melanargia1 has quit [Client Quit]
melanargia1 has joined #ocaml
AlexDenisov has joined #ocaml
AlexDeni_ has quit [Ping timeout: 240 seconds]
AlexDenisov has quit [Ping timeout: 252 seconds]
AlexDenisov has joined #ocaml
melanargia1 has quit [Quit: WeeChat 1.5]
Kakadu has joined #ocaml
melanargia1 has joined #ocaml
melanargia1 has quit [Client Quit]
melanargia1 has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
melanargia1 has quit [Quit: WeeChat 1.5]
Sorella has quit [Quit: Connection closed for inactivity]
sepp2k has joined #ocaml
pierpa has joined #ocaml
dakk has quit [Ping timeout: 258 seconds]
malc_ has quit [Ping timeout: 252 seconds]
sz0 has quit [Quit: Connection closed for inactivity]
walter|r has joined #ocaml
dakk has joined #ocaml
walter|r has quit [Read error: Connection reset by peer]
walter|r has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
nicholasf has joined #ocaml
sepp2k has quit [Ping timeout: 240 seconds]
Kakadu has quit [Remote host closed the connection]
nicholasf has quit [Remote host closed the connection]
shinnya has joined #ocaml
nicholasf has joined #ocaml
fleaswallow has quit [Quit: Leaving]
f[x] has quit [Ping timeout: 276 seconds]
dhil has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Leaving]
walter|r has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
SpiceGuid has quit [Ping timeout: 272 seconds]
abeaumont has quit [Ping timeout: 246 seconds]
rgrinberg has quit [Ping timeout: 276 seconds]
A19774941 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
bruce_r has joined #ocaml
<bruce_r> Seliopou you here? I saw you tried to talk to me
<bruce_r> I tried to contact you through your website or github account but I couldn't find anything to contact you.
walter|r has joined #ocaml