crabstick has quit [Read error: 110 (Connection timed out)]
crabstick has joined #ocaml
crabstick_ has quit [Read error: 110 (Connection timed out)]
netx has quit ["Leaving"]
seafoodX has joined #ocaml
Smerdyakov has quit ["Leaving"]
grirgz has joined #ocaml
<grirgz>
hi
<grirgz>
i have defined a double hashtbl with : type t = ('a, 'b) Hashtbl.t * ('b, 'a) Hashtbl.t;;
<xavierbot>
Characters 1-2:
<xavierbot>
i have defined a double hashtbl with : type t = ('a, 'b) Hashtbl.t * ('b, 'a) Hashtbl.t;;
<xavierbot>
^
<xavierbot>
Unbound value i
<xavierbot>
Characters 33-37:
<xavierbot>
Parse error: illegal begin of top_phrase
<grirgz>
euh
<grirgz>
and i hava an error : Unbound type parameter 'a
<grirgz>
but i saw in the hashtbl.ml source file the same type of declaration
<pango>
type ('a, 'b) t = ...
<grirgz>
arf
<grirgz>
i am tired =)
<grirgz>
thank you
<pango>
np
tty56_ has joined #ocaml
tty56 has quit [Read error: 60 (Operation timed out)]
netx has joined #ocaml
<seafoodX>
Anyone know of a dictionary implementation in OCaml?
<seafoodX>
I should be more precise. By dictionary I mean essentially an associative array where the indices can be things other than integers.
<authentic>
also known as hashtables?
<tsuyoshi>
yeah you can do that with either the hash tables or maps in the standard library
ednarofi has joined #ocaml
<seafoodX>
tsuyoshi: Maps are exactly what I was looking for.
<seafoodX>
THanks
<grirgz>
the compiler says the type _[> `adjectif | `article ] lexique contains type variables that cannot be generalized. I dont understand what should i do to help it to generalize
buluca has quit [Read error: 113 (No route to host)]
Smerdyakov has joined #ocaml
Hadaka has quit [Read error: 60 (Operation timed out)]
seafoodX has quit []
|Jedai| has joined #ocaml
jedai has quit [Read error: 110 (Connection timed out)]
ednarofi has quit [Read error: 110 (Connection timed out)]
schme` has joined #ocaml
ednarofi has joined #ocaml
Smerdyakov has quit ["Maybe he is doomed."]
schme has quit [Read error: 110 (Connection timed out)]
ednarofi has quit [Read error: 104 (Connection reset by peer)]
ednarofi has joined #ocaml
ednarofi has quit [Connection timed out]
crabstick_ has joined #ocaml
slipstream-- has joined #ocaml
crabstick has quit [Read error: 110 (Connection timed out)]
seafoodX has joined #ocaml
crabstick_ has quit [Read error: 110 (Connection timed out)]
seafoodX has quit [Client Quit]
slipstream has quit [Read error: 110 (Connection timed out)]
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
seafoodX has joined #ocaml
rwmjones has joined #ocaml
bluestorm has joined #ocaml
Tetsuo has joined #ocaml
ygrek has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
slipstream has quit [Read error: 110 (Connection timed out)]
slipstream has joined #ocaml
slipstream-- has quit [Read error: 110 (Connection timed out)]
slipstre1m-- has quit [Read error: 110 (Connection timed out)]
piggybox_ has joined #ocaml
slipstream-- has joined #ocaml
piggybox has quit [Connection timed out]
slipstream has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
Demitar has quit [Read error: 113 (No route to host)]
seafoodX has joined #ocaml
piggybox_ is now known as piggybox
Cygal has joined #ocaml
seafoodX has quit []
joshcryer has quit [Read error: 113 (No route to host)]
schme`` has joined #ocaml
schme` has quit [Read error: 110 (Connection timed out)]
xavierbot has quit [Remote closed the connection]
xavierbot has joined #ocaml
Cygal is now known as Cygaal
Cygaal has quit [Remote closed the connection]
ednarofi has joined #ocaml
ygrek has quit [Remote closed the connection]
Naked has joined #ocaml
Naked is now known as Hadaka
|Jedai| is now known as jedai
<flux>
is it required in Ocaml to Thread.join a thread that has been Thread.created? the documentation doesn't suggest anything like that, so I guess not..
<flux>
slight testing suggests that this aspect is automatic
pango has quit [Excess Flood]
<tsuyoshi>
yeah, probably the garbage collector takes care of that
<flux>
i think it is handled even before gc
pango has joined #ocaml
<tsuyoshi>
really?
<flux>
because the thread disappears immediately
<flux>
say the thread does Unix.sleep 10 it disappears after 10 seconds
<tsuyoshi>
what do you mean by "disappears"
<flux>
from the process list, ps -eLf
<tsuyoshi>
oh, that's not the same as being joined though
<flux>
I was thinking that from the aspect of unix processes, which become zombies unless they are wait()ed on (or other trickery performed)
<tsuyoshi>
like.. joining a thread frees the return value
<flux>
yes, I think that should be handled by gc (although ocaml threads don't have a return value)
<tsuyoshi>
I'm thinking in terms of pthread_join()
<flux>
and I think normal pthreads need to be joined too, unless they are detached threads?
<flux>
or no?
<tsuyoshi>
in c you need to join every thread
<tsuyoshi>
I don't know how it would work in ocaml exactly.. never used threads in ocaml
rwmjones has left #ocaml []
seafoodX has joined #ocaml
ednarofi has quit [Remote closed the connection]
ednarofi has joined #ocaml
piggybox_ has joined #ocaml
buluca has joined #ocaml
|Jedai| has joined #ocaml
joshcryer has joined #ocaml
piggybox has quit [Connection timed out]
piggybox_ is now known as piggybox
piggybox_ has joined #ocaml
piggybox has quit [Nick collision from services.]
piggybox_ is now known as piggybox
jedai has quit [Read error: 110 (Connection timed out)]
olegfink has joined #ocaml
<olegfink>
hi
<olegfink>
is there anything like 'static' variables from C?
<olegfink>
I want to make an interface for writing bits (not bytes) to files, so I need to implement some sort of buffering
<olegfink>
or am I going the wring way maybe?
<flux>
olegfink, well, you can do this:
<flux>
let function_with_static_state = let state = ref 0 in let actual_function () = incr state; !state in actual_function;;
<xavierbot>
val function_with_static_state : unit -> int = <fun>
<flux>
function_with_static_state ();;
<xavierbot>
- : int = 1
<flux>
function_with_static_state ();;
<xavierbot>
- : int = 2
<olegfink>
aha
<olegfink>
but is it the right way of doing buffered I/O?
<flux>
but if you're having an interface, how about something like having type t = { buffer : string; buffer_at : int; } etc?
<flux>
type t contents would then be hidden by the interface mechanism
<olegfink>
hm
<olegfink>
I'm doing very simple thing
<flux>
if a single function is enough of an interface, I suppose it's ok to do that trick: have a function that creates a new state and returns a function that manipulates that state
<olegfink>
I think I just need functions output_bits nofbits value and input_bits nofbits, that's all
<flux>
something like this then perhaps: let input_bits_func stream = let state = ... in let get_bits n = .. use state and stream .. in get_bits
<bluestorm>
flux:
<bluestorm>
you can even do
<bluestorm>
let fun1, fun2, fun3 = let state = ... in let fun1 = .. in ... (fun1, fun2, fun3)
<bluestorm>
no "single function" restriction
<olegfink>
okay, thank, will try to implement this
<flux>
true, it requires more effort to use that kind of construct however
<olegfink>
*thanks
<flux>
especially if you want to change the set of functions later
<flux>
but, you can use.. tada! the object system too :)
<bluestorm>
hm
<flux>
(or return a record with functions)
<flux>
actually I suppose the object system is something that is designed exactly for this case..
<olegfink>
theres no built-in bitwise shift in ocaml, right?
<danderson>
there is, in Pervasives
<danderson>
lsl;;
<xavierbot>
lsl;;
<xavierbot>
^^^
<xavierbot>
Characters 1-4:
<xavierbot>
Parse error: illegal begin of top_phrase
<danderson>
uh
<bluestorm>
fun a b -> a lsl b;;
<xavierbot>
- : int -> int -> int = <fun>
<bluestorm>
:-'
<danderson>
oh
<danderson>
(lsl);;
<xavierbot>
(lsl);;
<xavierbot>
^
<xavierbot>
Characters 1-2:
<xavierbot>
Parse error: illegal begin of top_phrase
<danderson>
oh well
<flux>
hey, that's a new one
<olegfink>
aha, were looking for the names (<<) and (>>)
<olegfink>
it is my first ever binary-dealing program
<flux>
I actually would trust more my version, as I don't know if it would be possible for the division to result in a number that would be rounded down too much..
<flux>
(assuming it even works, heh)
pango has quit [Remote closed the connection]
<flux>
but perhaps the division is guaranteed to never result in such a number.. I don't know the intricacies of floating point arithmetics, other than be very careful when wanting an exact result ;)
<danderson>
the division is so that the expression is equivalent to the binary logarithm
<danderson>
and the binary logarithm, informally, tells you how many bits you need to store the input number
<danderson>
but it gives it to you in fractional bits, so you round it up to the nearest int
<danderson>
I believe the ceil(binary_log(x)) thing is solid, and empirically this is true
<olegfink>
yeah, that was my original thought
<danderson>
but computing logs is unlikely to be the fastest thing in the world.
<olegfink>
let rec count_bits n = if n > 0 then 1 + count_bits (n / 2) else 0;;
<xavierbot>
val count_bits : int -> int = <fun>
<olegfink>
count_bits 42;;
<xavierbot>
- : int = 6
<olegfink>
hm
<danderson>
that definition is also sound
<danderson>
integer division truncates, doesn't round, so it's always approximated in the right direction, no matter if the input is even or odd
<flux>
it could be replaced with lsr 1 to better convey the meaning I suppose
<flux>
count_bits (-42);;
<xavierbot>
- : int = 0
<flux>
nbits (-42);;
<xavierbot>
- : int = 0
<danderson>
heh
<danderson>
bork bork
<flux>
both fail with negative numbers ;)
<danderson>
negative numbers is easy
<danderson>
if n < 0 then sizeof(integer_on_your_platform)
<danderson>
because of the sign bit
<danderson>
well, unless you find an architecture that doesn't use two's complement for negative ints...
<olegfink>
I will only need positive numbers fortunately
<danderson>
add an assertion anyway
<danderson>
if n < 0 then failwith "No negative integers!"
<bluestorm>
heh, seems wiewvc in not very good at highlighting ocaml syntax :p
buluca has joined #ocaml
piggybox_ has joined #ocaml
tty56_ has quit [Read error: 104 (Connection reset by peer)]
tty56 has joined #ocaml
mwc has joined #ocaml
piggybox has quit [Connection timed out]
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
olegfink has quit [Read error: 113 (No route to host)]
olegfink has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
ygrek has quit [Remote closed the connection]
buluca has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
mwc has quit ["Lost terminal"]
G_ has joined #ocaml
jlouis has joined #ocaml
piggybox_ is now known as piggybox
G has quit [Connection timed out]
jlouis has quit ["leaving"]
olegfink has quit [Read error: 101 (Network is unreachable)]
jlouis has joined #ocaml
piggybox_ has joined #ocaml
piggybox has quit [Nick collision from services.]
piggybox_ is now known as piggybox
|Jedai| is now known as jedai
piggybox_ has joined #ocaml
jonathanv has joined #ocaml
<jonathanv>
cool
piggybox has quit [Read error: 110 (Connection timed out)]
<lde>
smimou: You should also have generic channel/user modes, since some servers support additional ones.
<smimou>
lde: patches are welcome ;)
<lde>
e.g. freenode
<lde>
it told me: CHANMODES=bdeIq,k,lfJD,cgijLmnPQrRstz
<lde>
well, a freenode server told me, not freenode, to be exact :-)
asmanur has quit [Remote closed the connection]
<lde>
Cool, anyway.
<smimou>
thanks, I'll try to think of modes when I have some time
<lde>
I was starting to write an irc library myself.
<jonathanv>
so how awesome is ocaml
olegfink has joined #ocaml
rwmjones_ has joined #ocaml
<rwmjones_>
xavierbot, hello
<rwmjones_>
xavierbot, help
<xavierbot>
hello rwmjones_, I am xavierbot 0.7, an OCaml toplevel
<xavierbot>
expr ;; evaluate expr in toplevel and print result
<xavierbot>
help help message
<xavierbot>
restart restart the toplevel
<xavierbot>
sleep go to sleep
<xavierbot>
wake wake me up from sleep
<rwmjones_>
let x1 = fun x -> (x,x) in
<rwmjones_>
let x2 = fun y -> x1 ( x1 y ) in
<rwmjones_>
let x3 = fun y -> x2 ( x2 y ) in
<rwmjones_>
let x4 = fun y -> x3 ( x3 y ) in
<rwmjones_>
let x5 = fun y -> x4 ( x4 y ) in
<rwmjones_>
let x6 = fun y -> x5 ( x5 y ) in
<rwmjones_>
let x7 = fun y -> x6 ( x6 y ) in
<rwmjones_>
x7 ( fun z -> z ) ;;
<xavierbot>
Characters 1-3:
<xavierbot>
x7 ( fun z -> z ) ;;
<xavierbot>
^^
<xavierbot>
Unbound value x7
<bluestorm>
o_O
<pango>
lines not terminated by ;; aren't interpreted by xavierbot...
<rwmjones_>
let x1 = fun x -> (x,x) in let x2 = fun y -> x1 ( x1 y ) in let x3 = fun y -> x2 ( x2 y ) in let x4 = fun y -> x3 ( x3 y ) in let x5 = fun y -> x4 ( x4 y ) in let x6 = fun y -> x5 ( x5 y ) in let x7 = fun y -> x6 ( x6 y ) in x7 ( fun z -> z ) ;;
<xavierbot>
Objective Caml version 3.10.0
<xavierbot>
Camlp4 Parsing version 3.10.0
<rwmjones_>
xavierbot can't really cope with multi-line input
<mbishop>
xavierbot: shut the hell up
<xavierbot>
xavierbot goes to sleep (do 'xavierbot wake' to wake)
<rwmjones_>
hang on ...
<mbishop>
I like that :P
<rwmjones_>
xavierbot wake up (I'll put him back to sleep in a moment)
<xavierbot>
xavierbot wakes up
<rwmjones_>
let pair = fun x -> (fun y -> (fun z -> ((z x) y))) in let x1 = fun y -> (pair y) y in let x2 = fun y -> x1 (x1 y) in let x3 = fun y -> x2 (x2 y) in let x4 = fun y -> x3 (x3 y) in let x5 = fun y -> x4 (x4 y) in x5 (fun y -> y) ;;
<xavierbot>
Fatal error: out of memory.
<xavierbot>
Objective Caml version 3.10.0
<xavierbot>
Camlp4 Parsing version 3.10.0
<rwmjones_>
interesting
<Tetsuo>
trying to stress the type inference ? ^^
<rwmjones_>
yes, see caml-list recent postings
<rwmjones_>
ok, back to serious stuff ... anyone using ocaml on solaris?
<rwmjones_>
I'm wondering what you use to install ocaml (eg. blastwave.org, or something else)
schme`` is now known as schme
<jonathanv>
sooooo
piggybox has joined #ocaml
mbishop has quit [Read error: 113 (No route to host)]
rwmjones has joined #ocaml
mwc has joined #ocaml
<mwc>
Anybody have logs of this channel?
<mwc>
Trying to solve something I figured out a few weeks ago
<mwc>
and alas, I deleted that code
leo037 has joined #ocaml
crathman has quit [Read error: 110 (Connection timed out)]
piggybox__ has joined #ocaml
piggybox_ has quit [Success]
Tetsuo has quit ["Leaving"]
ita has joined #ocaml
<ita>
awesome, virtual methods
piggybox_ has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
piggybox has quit [Connection timed out]
mbishop has joined #ocaml
piggybox__ has quit [Connection timed out]
martin_ has joined #ocaml
martin_ is now known as mbishop_
rwmjones_ has quit ["Leaving"]
mbishop has quit [Nick collision from services.]
mbishop_ is now known as mbishop
zmdkrbou has quit [Read error: 110 (Connection timed out)]