<hdaume>
where 'l' is defined as: let l = List.map (fun (o,p) -> (o, mkLog p)) [(1, 0.0731707317073); (1, 0.0731707317073); (2, 0.121951219512); (2, 0.731707317073)];;
mattam has quit ["Lost terminal"]
MegaWatS has quit ["Oceania has ALWAYS been at war with Eastasia!"]
<mrvn>
hdaume: Did you overlook some ... in the output?
<hdaume>
mrvn: i don't think so
<mrvn>
Your input list has 4 members, your output only two. Can't be right.
<hdaume>
no, the accum function...basically takes a list of pairs of ids and numbers and replaces, for instance (1,x) (1,y) (1,z) with (1,x+y+z)
<hdaume>
ah, nevermind...it's just floating point rounding
* hdaume
sighs
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
mrvn_ has joined #ocaml
mrvn has quit [Read error: 60 (Operation timed out)]
graydon_ has quit ["xchat exiting.."]
chunyu has joined #ocaml
<chunyu>
hi
<chunyu>
anyone here?
<chunyu>
hello everyone:)
chunyu has left #ocaml []
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
skylan has quit [benford.freenode.net irc.freenode.net]
gl has quit [benford.freenode.net irc.freenode.net]
mrvn_ has quit [benford.freenode.net irc.freenode.net]
smkl has quit [benford.freenode.net irc.freenode.net]
emu has quit [benford.freenode.net irc.freenode.net]
xtrm has quit [benford.freenode.net irc.freenode.net]
Segora has quit [benford.freenode.net irc.freenode.net]
whee has quit [benford.freenode.net irc.freenode.net]
gl has joined #ocaml
mrvn_ has joined #ocaml
smkl has joined #ocaml
skylan has joined #ocaml
emu has joined #ocaml
xtrm has joined #ocaml
Segora has joined #ocaml
whee has joined #ocaml
mattam has joined #ocaml
Yurik has joined #ocaml
<Yurik>
re
MegaWatS has joined #ocaml
Yurik has quit [Read error: 54 (Connection reset by peer)]
karryall has joined #ocaml
xtrm has left #ocaml []
MegaWatS has quit ["Oceania has ALWAYS been at war with Eastasia!"]
MegaWatS has joined #ocaml
TachYon25 has joined #ocaml
malc has joined #ocaml
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
malc has quit [Read error: 110 (Connection timed out)]
ayrnieu has joined #ocaml
MegaWatS is now known as WegWatS
WegWatS has quit [benford.freenode.net irc.freenode.net]
WegWatS has joined #ocaml
graydon has joined #ocaml
Yurik has joined #ocaml
<Yurik>
re
Yurik has quit [Read error: 54 (Connection reset by peer)]
Yurik has joined #ocaml
<Yurik>
re
Yurik has quit [Read error: 54 (Connection reset by peer)]
nkoza has joined #ocaml
clog has quit [^C]
clog has joined #ocaml
Dalroth has joined #ocaml
ayrnieu` has joined #ocaml
mattam has quit [Remote closed the connection]
mattam has joined #ocaml
ayrnieu has quit [Connection timed out]
smkl has quit [Read error: 54 (Connection reset by peer)]
smkl has joined #ocaml
ayrnieu has joined #ocaml
ayrnieu` has quit [Read error: 60 (Operation timed out)]
WegWatS is now known as MegaWatS
TachYon25 has joined #ocaml
clog has quit [^C]
clog has joined #ocaml
TachYon25 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
karryall has quit []
Yurik has joined #ocaml
<Yurik>
re
Yurik_ has joined #ocaml
Yurik__ has joined #ocaml
Yurik has quit [Read error: 60 (Operation timed out)]
ayrnieu` has joined #ocaml
<Yurik__>
ayrnieu`: hi
Yurik_ has quit [Read error: 110 (Connection timed out)]
<ayrnieu`>
hello Yurik.
ayrnieu` has quit ["trying for a better connection"]
ayrnieu has quit [Read error: 60 (Operation timed out)]
Yurik__ has quit [Read error: 104 (Connection reset by peer)]
ayrnieu has joined #ocaml
gl has quit [Read error: 60 (Operation timed out)]
docelic has joined #ocaml
ayrnieu has quit ["ERC v2.93 $Revision: 1.308 $ (IRC client for Emacs)"]
mattam has quit ["leaving"]
mellum_ has joined #ocaml
mattam has joined #ocaml
docelic has quit ["later"]
steele has joined #ocaml
<steele>
hi
<hdaume>
is there a map-like function for Hashtbls?
<hdaume>
something like Hashtbl.map : ('a -> 'b -> 'b) -> ('a, 'b) Hashtbl.t -> unit
<whee>
I don't believe so
<hdaume>
durn
<whee>
there's iter :|
<whee>
you could write a map with iter and replace
<whee>
err not replace
<hdaume>
yeah, that's why I'm doing, but that seems inefficient
<whee>
well I guess copy/iter/replace
<hdaume>
s/why/what
* hdaume
is very confused as to why such a function doesn't exist
<hdaume>
is there a way to, given a record, create a new record with only one field different?
<hdaume>
something like 'type pt = { x : int; y : int };; let v = { x = 5; y = 10 };; let w = v{x = 6};;'
<hdaume>
or do they have to be defined 'mutable'?
docelic has joined #ocaml
<mrvn_>
hdaume: If you map a hash value its key should change. So you would have to remove and insert it anyway.
<hdaume>
mrvn_: not if you only change the element, not the key
<mrvn_>
let foo = { ... } let bar = { foo with x = 7 }
<hdaume>
mrvn_: cool, tnx
<mrvn_>
hdaume: The key is supposed to be uniq for a value or nearly so.
<hdaume>
right...so?
<mrvn_>
Otherwise you have a map and not a hash.
<hdaume>
it's a hash table
<hdaume>
so it is a map
<mrvn_>
Is it actually? Haven't read its source.
<hdaume>
it's gotta be...it's functions are things like 'add : ('a,'b) t -> 'a -> 'b -> unit'
<mrvn_>
A hash could be implemented with an array and a map with a balanced tree.
<mrvn_>
Thats how C++ does it in the STL.
<hdaume>
i don't see how it matters how it's implemented. if i want to systematically change the elements (not the keys) stored in the table, this should be fine. the things which are hashed are the keys. the elements are never hashed.
<mrvn_>
Normly you would make a hash table of ("hash of type 'a", 'a)
<mrvn_>
So if the later hanges the first would be supposed to change too.
<mrvn_>
s/hanges/changes/
<mrvn_>
Thats what I would expect in a hash table normaly.
<hdaume>
that's not how i'm using the table ;), and i don't think that's necessarily the common way to use it (for instance: memoization)
<mrvn_>
Otherwise I would call is a map.
<mrvn_>
And a map actually has a map function
<mrvn_>
And maps are binary trees.
<mrvn_>
In ocaml the main difference between map and hastbl is probably that maps are functional and hashtbl imperative.
<mrvn_>
maps have a map functions and hashtbl a replace.
<mrvn_>
Is there no Hashtbl.size?
<hdaume>
i don't think so ;)
* hdaume
may write his own hashtable module
<mrvn_>
"inherit" hashtbl and add your own personal map function
mrvn_ is now known as mrvn
<hdaume>
i don't know enough to be able to do that ;)
<mrvn>
You can just call all the normal hashtbl functions as far as you keep them.
<hdaume>
but is there a way to get access at the underlying data structure?
<mrvn>
let create = Hashtbl.create
<mrvn>
No. But for a map you woudln't need to
gl has joined #ocaml
nkoza has quit [Read error: 104 (Connection reset by peer)]
<hdaume>
what does this mean:
<hdaume>
This expression has type systemOptions but is here used with type
<hdaume>
systemOptions
<hdaume>
The type constructor systemOptions would escape its scope
Nova555 has joined #ocaml
<mrvn>
You return an class object without cast.
<mrvn>
try (foo :> foo_type)
<hdaume>
i'm not using classes....systemOptions is a record type (or is that basically the same thing)?
<mrvn>
do you have something like type foo = { systemOptions:int; bla:int;} let gnarf = systemOptions 1 ?
Nova555 has quit [Remote closed the connection]
<hdaume>
no...i have something like type systemOptions = { iterations : int; ... } let config = ref { iterations = 5; ... } then the error pops up in let run_iterations i = if i = !config.iterations+1 then ()
<mrvn>
(!config). ?
<hdaume>
i tried that too and you get the same thing
<hdaume>
hrm...using ocamlc instead of the interactive seems to work...i must have a shadowing issue or something
<mrvn>
Isn't there a comand to clear the bindings?
graydon has quit ["xchat exiting.."]
docelic has quit ["tomorrow"]
malc has joined #ocaml
MegaWatS has quit ["Oceania has ALWAYS been at war with Eastasia!"]