jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
eradman has quit ["leaving"]
eradman has joined #ocaml
eradman has quit ["leaving"]
eradman has joined #ocaml
b00t has joined #ocaml
kilimanjaro has joined #ocaml
<youknow365>
pango_: ?
<youknow365>
you there?
<youknow365>
if the value is going to change constanbtly should i use variable or reference
<youknow365>
how can i include my gloabl.ml in my main.ml so i can use functions and variables from it
<youknow365>
like some kind of include function or something
b00t has quit [Remote closed the connection]
m3ga has quit ["disappearing into the sunset"]
Carillon_ has quit [Connection timed out]
_velco has joined #ocaml
<buggs>
youknow365, link it in with the compiler
<youknow365>
ahhhhhh
<youknow365>
also i still dont know......for stuff that will change all the time ......is a referee or variable ideal ?
<youknow365>
which ones should be sed
<buggs>
youknow365, if the code does allow for it not to be a ref you don't use a ref
<youknow365>
buggs: im saying if i have variable such as message = "fsdfsdsdf"
<youknow365>
that will chnage for ever ymessage
<youknow365>
should that be a variable or a reference
<buggs>
that depends on the code
<buggs>
you should try to understand the example pango gave you
<buggs>
see how k stays 3
<buggs>
using a ref it would increment
<youknow365>
well this is a message
<youknow365>
a im message
<youknow365>
buggs: ^^
<buggs>
?
b00t has joined #ocaml
<youknow365>
i need to store a jabber message that will be sent
<youknow365>
should i use a variable to store it or a reference
<youknow365>
buggs: ^^
EsotericMoniker has joined #ocaml
<pango_>
jeremy_c: I guess you mean a closure, not a function... Then that's easy, just make sure the hash table (or anything else) exists in the lexical scope of the function definition, and you're done...
<buggs>
youknow365, try both
<youknow365>
buggs: lol
<pango_>
# let store, load =
<pango_>
let h = Hashtbl.create 10 in
<pango_>
(fun k v -> Hashtbl.add h k v),
<pango_>
(fun k -> Hashtbl.find h k) ;;
<pango_>
# store "name" "jeremy_c" ;;
<pango_>
# load "name" ;;
<eradman>
Would anyone like to address a programming style question?
<buggs>
eradman, meta questions often go unanswered
<eradman>
got it. :-)
<eradman>
The Camel programming guidelines say that let ... in constructs should be aligne
<eradman>
d left; make sense: "Justification: It is suggested that a series of ``let ... in'' constructs is analogous to a set of assumptions in a mathematical text"
<eradman>
Would it then be odd to write out a series of let ... in statements aligned on t he = sign?
<eradman>
For example, in a formula to calculate the square root of a number:
<eradman>
let sqrt x =
<eradman>
let sq x = x *. x in
<eradman>
let abs x = if x < 0. then x *. (-1.) else x in
<eradman>
let average x y = (x +. y) /. 2. in
<eradman>
let improve guess x = average guess (x /. guess) in
<eradman>
let goodenough guess x = abs ((sq guess) -. x) < 0.001 in
<eradman>
let rec try_guess guess x =
<eradman>
if goodenough guess x then guess
<eradman>
else try_guess (improve guess x) x in
<eradman>
try_guess 1. x
<eradman>
;;
<buggs>
i often do so
<buggs>
some ppl like it some not, but for me it is much easier to decompose in the brain
<eradman>
I should probably review my use of 'x' when it's an argument to a function that's not generic (e.g. goodenough)
<pango_>
the last 'in' feels a bit weird however... it's so far apart from the rest of code that there's a little fuzzyness over what lines it's on
<pango_>
s/lines/line/
<eradman>
The alignment of '=' and 'in' are probably two different issues
<eradman>
In ocaml the 'in' is really being used a a sort of operator, isn't it? It's not a simple delimiter, like
<eradman>
';'
<pango_>
as said in ocaml-tutorial.org, ';' can be seen as an infix operator too
<pango_>
of type unit -> 'b -> 'b
<pango_>
and let and let/in constructs are so different (the former being only legitimate at the top level), that I never consider 'in' on its own
<pango_>
that said people are free to disagree; I'm not sure I could bring deeper differences between let and let/in
<youknow365>
hmmmmmmm
<youknow365>
i think a variable string is what i should store my message in to be sent
pango_ has quit ["brb"]
shawn has joined #ocaml
pango has joined #ocaml
Snark has joined #ocaml
Wild_Cat has joined #ocaml
smimou has joined #ocaml
youknow365 is now known as Fly_101
Fly_101 has quit [Remote closed the connection]
ziggurat has joined #ocaml
yacstud has joined #ocaml
piggybox has joined #ocaml
Wild_Cat has quit []
b00t has quit [Remote closed the connection]
mikeX has joined #ocaml
<jeremy_c>
Anyone have mysql installed in a non-standard location and have godi_console install ocaml-mysql OK? I set the config vars for the incude and lib dirs but it does not seem to be paying attention to it.
<luca83>
jeremy_c: I don't :(
<jeremy_c>
luca83: it looks like it doesn't even pay attention to my config settings (by looking at the build log) :-/
<luca83>
I've Debian and I don't use godi
_fab has joined #ocaml
chessguy has joined #ocaml
<jeremy_c>
luca83: do you use the mysql lib?
<jeremy_c>
Error while linking /usr/local/ocaml/lib/ocaml/pkg-lib/mysql/mysql.cma(Mysql):
<jeremy_c>
The external function `db_connect' is not available
<jeremy_c>
It's as though ocaml is not linking in the libmysql_stubs.a file or something.
<luca83>
jeremy_c: no, I don't, I'm a beginner...
Wild_Cat has joined #ocaml
Leonidas has joined #ocaml
slipstream has quit [Read error: 54 (Connection reset by peer)]
<jeremy_c>
File "test.ml", line 9, characters 24-30:
<jeremy_c>
This expression has type Mysql.field array option but is here used with type
<jeremy_c>
Mysql.field option array
<jeremy_c>
Any thoughts?
<jeremy_c>
Oh! duh, nm.... ask the question and then I solve it myself.
<jeremy_c>
sorry
slipstream has joined #ocaml
Wild_Cat has quit []
Wild_Cat has joined #ocaml
jeremy_c has quit [Client Quit]
Wild_Cat has quit []
<buggs>
pango, can you give a short performance analyzes of the datastrucures
<buggs>
on the link you gave me
<pango>
not right of the bat, haven't looked into priority queues implementations recently... But I think that the benefit of the heap structure is that looking at the max element is O(1)
<pango>
whereas all operations are O(log n) with just a standard ordered binary tree like Set
<pango>
heap.ps documents the complexity of the main operations
<buggs>
well since i look for sth with < 100 elements i think big is not helping me
<buggs>
i have sth with Set.Make now as you suggested
<buggs>
it's not bad but keeps me thinking
<buggs>
basically i'm doing a levenshtein distance using dijkstra
<pango>
between two ~ 10 elements chains, I guess, if that's where this 100 number comes from ?
<buggs>
yo application similar to spellchecking
<pango>
I wrote the ocaml implementation of levenshtein distance in the Wikipedia... but the implementation is standard, seems you're going for something more clever ;)
<buggs>
petchema@concept-micro.com ?
<pango>
yes
<buggs>
it is still reading:
<buggs>
In parts based on code written by Pierre Etchemaite <petchema@concept-micro.com>