trepta has quit [Remote host closed the connection]
zirman has quit [Ping timeout: 258 seconds]
jao has joined #ocaml
jonasen has joined #ocaml
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
jao has quit [Ping timeout: 252 seconds]
zirman has joined #ocaml
freusque has quit [Ping timeout: 246 seconds]
zirman has quit [Ping timeout: 248 seconds]
bquent has joined #ocaml
raphinou has joined #ocaml
raphinou has quit [Client Quit]
raphinou has joined #ocaml
fluter has quit [Ping timeout: 246 seconds]
ziyourenxiang has joined #ocaml
infinity0 has quit [Remote host closed the connection]
yaewa has joined #ocaml
moei has quit [Ping timeout: 250 seconds]
infinity0 has joined #ocaml
fraggle-boate has quit [Ping timeout: 250 seconds]
Algebr` has joined #ocaml
fluter has joined #ocaml
xaimus_ has joined #ocaml
zirman has joined #ocaml
xaimus has quit [*.net *.split]
pippijn has quit [*.net *.split]
zirman has quit [Ping timeout: 248 seconds]
Algebr` has quit [Ping timeout: 268 seconds]
AltGr has joined #ocaml
pippijn has joined #ocaml
lambda_foo_ has joined #ocaml
larhat has joined #ocaml
<bquent>
Greetings, is there any additional step required after building the llvm bindings and installing llvm from opam to build a project using them with ocamlbuild? I set the lib and lib/caml folders in my LD and OCAML_LD paths, I can load llvm from top level (so it finds my dllllvm.so) but not build
pippijn has quit [*.net *.split]
Flerex has joined #ocaml
Hetu has joined #ocaml
Flerex has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
pippijn has joined #ocaml
tmtwd has quit [Ping timeout: 260 seconds]
zaquest has quit [Ping timeout: 258 seconds]
mfp has joined #ocaml
fraggle-boate has joined #ocaml
jnavila has joined #ocaml
maattdd has joined #ocaml
zaquest has joined #ocaml
silver has joined #ocaml
linou has joined #ocaml
<linou>
hey
FreeBirdLjj has joined #ocaml
<linou>
i don't know if i'm in the good place but i have some problems with a project that i have to do for the beginning of january
<linou>
i am supposed to do it with someone in my university group but he suddenly disappeared i have no more news from him
<linou>
so i'm alone now on this project and i'm really lost i need some help please
jnavila has quit [Ping timeout: 260 seconds]
raphinou has quit [Quit: WeeChat 1.4]
FreeBirdLjj has quit [Ping timeout: 240 seconds]
<lyxia>
linou: Feel free to ask specific questions about OCaml.
_andre has joined #ocaml
<linou>
well i have to make a game about coloring maps or puzzle
<linou>
by using the 4 color theorem
<linou>
and i dont understand how to put and show the map
<linou>
i have a map example but i dont understand it
<linou>
and i dont know how to write a function that read the map and show it on a graphic window
<linou>
and i also have a problem on how to know when i arrive at the end of the "country" to stop the coloring
infinity0 has quit [Ping timeout: 260 seconds]
infinity0 has joined #ocaml
<Leonidas>
map as in?
ziyourenxiang has quit [Quit: Leaving]
zirman has joined #ocaml
Merv has quit [Quit: Connection closed for inactivity]
<linou>
sorry?
fre has quit [Ping timeout: 268 seconds]
michbad has joined #ocaml
Hetu has quit [Ping timeout: 264 seconds]
Hetu has joined #ocaml
zirman has quit [Ping timeout: 240 seconds]
jonasen has quit [Ping timeout: 250 seconds]
<chelfi>
What exactly is your input ? How do you represent a map ?
fre has joined #ocaml
wu_ng has quit [Read error: Connection reset by peer]
lambda_foo_ has quit [Quit: Connection closed for inactivity]
dhil has joined #ocaml
jonasen has joined #ocaml
maattdd has quit [Ping timeout: 258 seconds]
orbifx-m has joined #ocaml
<bquent>
Hi, I solved the problem I had this morning by manually building with ocamlc, I'd still like to know how to use ocamlbuild with the llvm bindings however, i installed everything with opam and tried giving the link to the folder with LLVM's shared libraries to myocamlbuild.ml with no success
<Onemorenickname>
balod : it does not, it is for pattern matching
Algebr` has joined #ocaml
michbad_ has quit [Ping timeout: 246 seconds]
<balod>
Oh sorry, as Drup said it's not possible
michbad has joined #ocaml
freusque has quit [Ping timeout: 250 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
michbad_ has joined #ocaml
ziyourenxiang has joined #ocaml
ziyourenxiang has quit [Changing host]
ziyourenxiang has joined #ocaml
ziyourenxiang has quit [Client Quit]
ziyourenxiang has joined #ocaml
jonasen has joined #ocaml
michbad has quit [Ping timeout: 260 seconds]
dmi3y has quit [Quit: dmi3y]
michbad_ has quit [Read error: Connection reset by peer]
Hetu has joined #ocaml
malade_mental has joined #ocaml
<malade_mental>
Hi, I want to write a function that prints "hello world" n times, n given by user input. Should I use a for loop or recursion?
shinnya has joined #ocaml
michbad has joined #ocaml
<thizanne>
both will do the job, chose the one you prefer
<thizanne>
(actually, you should probably do both as an exercise)
<malade_mental>
thizanne: exactly, that's what I thought
<malade_mental>
thizanne: http://paste.debian.net/903746 what I don't understand is where can I execute f(x-1) and print the string....
FreeBirdLjj has joined #ocaml
<thizanne>
malade_mental: how would you write some program that print "hello world" and then prints "goodbye cruel world" ?
<thizanne>
(print_string "hello world\n goodbye cruel world" is considered cheating)
<malade_mental>
thizanne: this is what I don't understand in functional programming, but I'd say write two functions
<thizanne>
that's because it's not really functional programming here
<thizanne>
ocaml is not exclusively functional, when it comes to side effects like printing something it can be used as an imperative language
<malade_mental>
okay!!!
<thizanne>
so you can write print_endline "hello world"; print_endline "goodbye cruel world"
<thizanne>
it will execute both "statements" one after the other
<malade_mental>
ok I understand now!!!
<thizanne>
(I guess you're following a particular course, then I suppose you don't need to understand exactly the imperative part until you reach the corresponding chapter)
<thizanne>
(in which case just knowing that `;` can separate two priting statements should be sufficient)
yomimono has joined #ocaml
michbad has quit [Remote host closed the connection]
<malade_mental>
ow, because I didn't put n > 0 in parentheses
<malade_mental>
?
<malade_mental>
hum, doesn't change anything...
<flux>
malade_mental, you're getting a warning from ocaml, aren't you?
<flux>
malade_mental, n = (n-1) doesn't so what you think it does.
<flux>
so => do
<thizanne>
malade_mental: as flux said, so-called "variables" in ocaml do not work like variables in other programming languages
<thizanne>
in particular you can't change their values by doing `n = n - 1`
<thizanne>
you need to use references, which are like variables that you explicitely indicate as being mutable (and thus on which on you use the assignment operator -- which is := by the way, not =)
isd has quit [Ping timeout: 248 seconds]
<thizanne>
my suggestion is to wait until your course deals with these subjects, as it's probably more interesting or you to discover the functional aspects of the language rather than to learn how to use it to make it look like the languages you already know
<malade_mental>
flux: no i don't have the warning
<malade_mental>
thizanne: yes I'm following a mooc and I just wanted to test some exercices on hackerrank...
MercurialAlchemi has quit [Remote host closed the connection]
<Onemorenickname>
Is there a "Non-Empty List" module in ocaml ? I'm basically definig "type 'a nelist = 'a * ('a list)" and I'd like not to have to define all the helpers functions
<flux>
malade_mental, strange, I wold have expected you to get "Warning 10: this expression should have type unit."
larhat has quit [Quit: Leaving.]
<flux>
malade_mental, the idiomatic way to write that function is with recursion. the direct solution to your problem is to define the variable as let n = ref 0, use !n to get its value and n := 42 to assign it.
slash^ has joined #ocaml
<malade_mental>
ok thanks flux, I didn't know about ref
zirman has quit [Remote host closed the connection]
jnavila has joined #ocaml
vicfred has joined #ocaml
Onemorenickname has quit [Quit: Leaving]
FreeBirdLjj has quit [Remote host closed the connection]
ryanartecona has joined #ocaml
ziyourenxiang has quit [Quit: Leaving]
Algebr` has quit [Ping timeout: 252 seconds]
luzie has quit [Quit: WeeChat 1.7-dev]
luzie has joined #ocaml
Algebr` has joined #ocaml
trepta has joined #ocaml
<Drup>
AltGr: you're flooding me :O
f[x] has joined #ocaml
malade_mental has left #ocaml [#ocaml]
jnavila has quit [Ping timeout: 256 seconds]
luzie has quit [Quit: WeeChat 1.7-dev]
luzie has joined #ocaml
dhil has quit [Ping timeout: 260 seconds]
maattdd has quit [Ping timeout: 250 seconds]
infinity0 has quit [Ping timeout: 256 seconds]
<AltGr>
Drup, huh ?
infinity0 has joined #ocaml
trepta has quit [Quit: trepta]
trepta has joined #ocaml
<Drup>
AltGr: just a joke about all the bug report being closed :p
infinity0 has quit [Remote host closed the connection]
zirman has quit [Remote host closed the connection]
Muzer has joined #ocaml
lambda_foo has joined #ocaml
zirman has joined #ocaml
zirman has quit [Remote host closed the connection]
zirman has joined #ocaml
average has quit [Quit: leaving]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 248 seconds]
kakadu has joined #ocaml
jnavila has joined #ocaml
noddy has joined #ocaml
DidierMedichon has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 252 seconds]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
orbifx-m2 has joined #ocaml
orbifx-m2 has quit [Remote host closed the connection]
trepta has quit [Ping timeout: 258 seconds]
orbifx-m has quit [Ping timeout: 265 seconds]
dhil has joined #ocaml
_andre has quit [Quit: leaving]
tvynr has joined #ocaml
<tvynr>
Does anyone know of a location where I can find a summary of the sort of situations the OCaml compiler is good at optimizing?
vramana1 has joined #ocaml
vramana has quit [Ping timeout: 258 seconds]
vramana1 is now known as vramana
noddy has quit [Ping timeout: 260 seconds]
MercurialAlchemi has joined #ocaml
octachron has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
d0nn1e has quit [Ping timeout: 258 seconds]
d0nn1e has joined #ocaml
<tvynr>
Does anyone know whether the compiler will inline functions provided via a functor argument? For instance, I want to write a functor that takes an argument module of a module type EventHandler (with a single function handleEvent). I'd like it if using a NopEventHandler ("let handleEvent _ = ()") didn't incur overhead. Is this possible?
MercurialAlchemi has quit [Remote host closed the connection]
Denommus has quit [Quit: going home]
rand__ has joined #ocaml
<mfp>
tvynr: I believe flambda can inline that
<tvynr>
Hm; good to know. I've been reading about flambda but I don't know much about it. Is it planned to be The Future™ in that I can write my code around this assumption?
<mfp>
it's merged into trunk (but not enabled by default yet), it shouldn't be long before it's enabled by default
<mfp>
there was some github issue/wiki page that documented flambda's optimizations IIRC, trying to find it
<tvynr>
Oh, goodie! Thanks for the info. I'm running some microbenchmarks, so I'll try a 4.04.0+flambda switch.
<tvynr>
Wow.
<tvynr>
Using 4.04.0+flambda, none of my tests took any time at all. They've all been reduced to nops. :-P
<tvynr>
Is that comparatively new material? I couldn't find any of that in the manual for my 4.02.3 compiler.
<mfp>
"Functors There is nothing particular about functors that inhibits inlining compared to normal functions. To the inliner, these both look the same, except that functors are marked as such."
<tvynr>
:)
<tvynr>
Thanks for finding that; it gives me some peace of mind.
<mfp>
flambda landed with 4.03
<tvynr>
I was hoping that ocamlc would be this clever so that I could happily write my event-handling code without hurting performance. Seems I can.
<tvynr>
Sorry for not being able to find that myself. :-P
<tvynr>
My Google skills seem to have failed me.
dmi3y has quit [Quit: dmi3y]
<mfp>
ocaml*opt*
<tvynr>
Oh, right.
<mfp>
(just to be sure :)
<tvynr>
This was indeed what I was using. But thank you! :)
<tvynr>
(Actually, I was using ocamlbuild to target a .native, but y'know.)
<octachron>
tvynr, note also that you can control more finely inlining using attributes
<octachron>
in particular, if you need to be sure that a call is inlined you can use "(f[@inlined]) x" to make the compiler yell at you if it cannot inline the function call
average has joined #ocaml
dhil has quit [Ping timeout: 245 seconds]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
xaimus_ is now known as xaimus
jnavila has quit [Remote host closed the connection]
<tvynr>
octachron: Thanks for the info about inlining. :)
zv has quit [Quit: WeeChat 1.6]
zv has joined #ocaml
rand__ has quit [Quit: leaving]
siyu has joined #ocaml
<siyu>
hi may i ask how to create an initialized array in ocaml
<siyu>
uninitialized*
<Drup>
siyu: what will you put in the array ?
<siyu>
i am trying to implement a polymorphic dynamic array
<Drup>
ok, then, you can't.
<siyu>
lol
<Drup>
(because it's extremely unsafe)
<Drup>
siyu: in general, uninitialized arrays are the best way to get segfaults and badly specified accesses. So it's just not possible in OCaml, you always initialize your memory. It shouldn't be a problem for your use case
<siyu>
ya i guess when i expand i just use a random element of the array
<siyu>
the only thing i cannot do is reserve space with an empty array
<Drup>
siyu: or always ask the user for an initial value, and use that when you expand
noddy has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
siyu has quit [Ping timeout: 260 seconds]
sepp2k has quit [Quit: Leaving.]
infinity0 has quit [Remote host closed the connection]
infinity0 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
infinity0 has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
infinity0 has joined #ocaml
zirmann has joined #ocaml
zirman has quit [Ping timeout: 264 seconds]
zirmann has quit [Ping timeout: 250 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
larhat has quit [Quit: Leaving.]
AltGr has left #ocaml [#ocaml]
<Algebr`>
hmm, why didn't the stdlib come with a vector =/
freusque has joined #ocaml
kakadu has quit [Remote host closed the connection]
<octachron>
Algebr`, the linear algebra vectors or the extensible array ones?