<malte>
hi, i'm just learning ocaml, and i dont understand what i'm doing wrong here: "let a = [|1; 3; 5|];; try a.(3) with Invalid_argument (s) -> s ;;"
<malte>
what am i doing wrong? :)
<kinners>
arrays are 0 based?
<malte>
yes, and then it should raise Invalid_argument, shouldnt it?
mattam has quit [Read error: 110 (Connection timed out)]
<malte>
anyone?
<kinners>
malte: a.(3) would be an int, s is a string
<malte>
ah, the expression needs to return the same type of course (?)
<kinners>
malte: which doesn't fit in with ocaml's static type system very well :)
<kinners>
yes
<malte>
sorry, i still havent got the hang of It :)
<malte>
ocaml seems really nice though, btw. what are you using it for?
<malte>
i mean, are you developing anything specific with ocaml or just using it occasionally?
<kinners>
malte: nothing specific, I'm thinking of writing a program to help improve (test) my music theory skills though
<malte>
cool :)
<malte>
oh. i didnt know it was this late (have been reading a book on ocaml the last hour :)... good night
<kinners>
night malte :)
yangsx has joined #ocaml
Nutssh has joined #ocaml
mattam_ is now known as mattam
blueshoe has quit [Read error: 104 (Connection reset by peer)]
shawn has quit [orwell.freenode.net irc.freenode.net]
smkl has quit [orwell.freenode.net irc.freenode.net]
smkl has joined #ocaml
shawn has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
kinners has quit [Read error: 60 (Operation timed out)]
bk_ has joined #ocaml
phj has joined #ocaml
Nutssh has quit ["Client exiting"]
blueshoe has joined #ocaml
wazze has joined #ocaml
phj has quit [Read error: 104 (Connection reset by peer)]
jesse has quit [Read error: 104 (Connection reset by peer)]
infinitesimo has quit ["F(YF) = YF"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Nutssh has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
Nutssh has quit ["Client exiting"]
Nutssh has joined #ocaml
Nutssh has quit [Client Quit]
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
gim has joined #ocaml
srv has quit [Read error: 104 (Connection reset by peer)]
srv has joined #ocaml
blueshoe has joined #ocaml
blueshoe has quit [Read error: 104 (Connection reset by peer)]
gumleef has joined #ocaml
yeoh has joined #ocaml
blueshoe has joined #ocaml
Nutssh has joined #ocaml
yeoh has quit ["Client exiting"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov>
Does anyone here have experience using the Scheme directive in Coq?
<Nutssh>
No idea.
<Smerdyakov>
I managed to figure it out. :D
maihem has quit ["Client exiting"]
bk_ has joined #ocaml
<Nutssh>
Interesting. I have a problem. My program is spending ~40% of its time computing random numbers.
<Smerdyakov>
So just always use 0.
<Nutssh>
Lol. I can't. I need fairly good random numbers, in particular, the lowest 16 bits MUST be good.
<Smerdyakov>
Too bad no one knows of any provably pseudorandom generators. :P
<Nutssh>
:)
<Hadaka>
unless there's a good reason to use something else, just google for mersenne twister
<Nutssh>
Actually what I need to do is to get a random subset of an array. I did a the one-liner using Array.init. But I'd like to find something faster.
<Smerdyakov>
Nutssh, you just need random bits for that...
<Nutssh>
The ocaml implementation already uses a variant of that. Lagged LFSR.
<Nutssh>
Smerdyakov: ?
<Nutssh>
So, I don't expect to see much of an improvement with something like that.
<Smerdyakov>
Nutssh, make a choice for each array element (include or not include). 1 bit each.
<Nutssh>
I want to create an array of a given target size by choosing elements from the source array uniformily at random.
<Smerdyakov>
Oh
<bk_>
is the compare function for a Set a 'functor' ?
<Smerdyakov>
bk_, eh? The parameter to Set.Make is a structure, and it has a compare member that is a value.
<bk_>
i was learning ocaml ~5 months ago and i had written some code, and then i took a mandatory break, now i'm looking at the code i've written and i'm not exactly sure what i did
<Nutssh>
Any ideas?
<bk_>
ok that is not a functor
<Nutssh>
Set.Make takes in a structure defining a type and a compare function. It produces a new structure roughly matching signature S.
<bk_>
yep
<Nutssh>
Bleah. I need to find a faster random number generator.
<bk_>
usually smerdyakov knows these things, Nutssh, but usually he's reluctant to answer anything below questions about thermonuclear dynamics coz he considers it too trivial
<Nutssh>
Heh.
<bk_>
:p
<Smerdyakov>
I'd just say find a better library. :P
* Smerdyakov
sure would like a procedure for Coq that automatically proves decidability of equality over an inductive type.
<bk_>
i have a Set for a record type, and if i remember correctly someone said that this would break the Set, is that correct ?!
<Smerdyakov>
What does it mean to "break the Set"?
<bk_>
put it in disorder
<Smerdyakov>
What does that mean?
<Smerdyakov>
Set will work correctly for any type where you give it a compare function that obeys the contract.
<bk_>
ok
<bk_>
thats what i wanted to know
<bk_>
thanks
<Smerdyakov>
The built-in compare function is sort of mystical to me, so I don't know if it will work for records.
<bk_>
exactly, but since i supplied my own compare it should work
wazze has quit ["--- reality is that which, when you stop believing in it, doesn't go away ---"]
<Nutssh>
Thats interesting. If you try to initialize an integer array, it makes a function call for each element.
Nutssh has quit ["Client exiting"]
blueshoe has quit [Read error: 104 (Connection reset by peer)]
mlh has joined #ocaml
phj has quit [Connection timed out]
Jondice has joined #ocaml
<Jondice>
where can i find information about how ocaml handles command line arguments (i suspect this may be a specific case of a more general method since the language is functional)?
<bk_>
as in Sys.argv ?
<Jondice>
yeah that sounds like what i'm after
<Jondice>
thanks
mr_jim has joined #ocaml
Lemmih has joined #ocaml
<Smerdyakov>
Hm. I had to build a 9-way mutual induction scheme in Coq to prove something. O_o
mimosa has joined #ocaml
srv has quit ["Lost terminal"]
shawn has quit ["Leaving"]
srv has joined #ocaml
srv has quit [Client Quit]
srv has joined #ocaml
shawn has joined #ocaml
bk_ has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
bk_ has joined #ocaml
blueshoe has joined #ocaml
mr_jim has quit ["Leaving"]
mof has joined #ocaml
<Lemmih>
Is there something Guile-like for OCaml?
The-Fixer has quit ["Goodbye"]
mattam_ has joined #ocaml
Nutssh has joined #ocaml
Nutssh has quit [Read error: 104 (Connection reset by peer)]