h3 has quit [Read error: 104 (Connection reset by peer)]
h3r3tic has joined #ocaml
h3r3tic has quit [Read error: 54 (Connection reset by peer)]
h3r3tic has joined #ocaml
h3r3tic has quit ["Segmentation Fault"]
tmaeda is now known as tmaedaZ
h3r3tic has joined #ocaml
<hcarty>
BigJ: You need to multiple each component of "a" separately
<hcarty>
( *. ) is specifically for float values
<BigJ>
hcarty, right so I need to break up each value
<BigJ>
I am unsure of how I put them back together...
<BigJ>
let vec_neg (a:vector) =
<BigJ>
let x = fst(a) *. (-1.) in
<BigJ>
let y = snd(a) *. (-1.) in
<BigJ>
if a = vec_zero then (a:vector)
<BigJ>
else (a:vector) ;;
<hcarty>
BigJ: (x, y) would give you the negated vector
<BigJ>
hcarty, at the else statement?
<BigJ>
else (x,y) ;;
<hcarty>
BigJ: To properly constrain the types you would need to add a module signature and/or use a record type instead of a tuple
<hcarty>
BigJ: Yes
<BigJ>
k that was my main problem with the statement was how do I get them back together after performing the operations
<BigJ>
hcarty, now I am wondering how I can take a derivative
tmaedaZ is now known as tmaeda
tmaeda is now known as tmaedaZ
tmaedaZ is now known as tmaeda
<hcarty>
BigJ: Symbolic or numeric? If you do a search for "derivative ocaml" several mailing list and blog posts should come up
<BigJ>
hcarty, I have this function
<BigJ>
let d f x = (f (x +. 0.001) -. f x) /. 0.001;;
<BigJ>
i am not sure what the x value corresponds to
tmaeda is now known as tmaedaZ
<Alpounet>
I've posted something about the newton method, using derivative obviously
<Alpounet>
x is the "x0" where you want the derivative to be computed.
<BigJ>
then what is f? because I have the vector (a,b) and I want to be able to do (a+a', b+b')
<BigJ>
f should be the tuple I am passing to the function...
<hcarty>
BigJ: In this case, it looks like f is the function you want to take the derivative of.
<BigJ>
ya that function won't work for what I need
jknick has joined #ocaml
jknick has quit ["Lost terminal"]
onigiri has quit []
jknick has joined #ocaml
Amorphous has quit [Read error: 145 (Connection timed out)]
thrasibule has joined #ocaml
Amorphous has joined #ocaml
peddie has quit [Read error: 113 (No route to host)]
peddie has joined #ocaml
seanmcl has joined #ocaml
Serica has joined #ocaml
tmaedaZ is now known as tmaeda
thrasibule has quit ["No Ping reply in 180 seconds."]
thrasibule has joined #ocaml
slash_ has quit [Client Quit]
Serica has quit ["WeeChat 0.3.0"]
seanmcl has quit []
Submarine has quit [Client Quit]
ulfdoz has joined #ocaml
ski_ has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
willb1 has joined #ocaml
Mr_Awesome has joined #ocaml
willb1 has quit [Remote closed the connection]
peddie has quit [Read error: 113 (No route to host)]
ulfdoz has quit [Read error: 110 (Connection timed out)]
willb1 has joined #ocaml
ttamttam has joined #ocaml
<BigJ>
I am wondering how on this line I can create a list of type vector
<BigJ>
let romulus_iter ([]:vector) (a:vector) (b:vector) =
ttamttam has quit ["Leaving."]
<flux>
hm?
<BigJ>
I have a type declaration of vector
<BigJ>
I want to create vector list
<BigJ>
a list of vectors
<flux>
= [a; b]
<flux>
tada, list of vectors..
<flux>
why is the first parameter []?
<BigJ>
not sure was trying to workout how to do it correctly
<BigJ>
it's supposed to be a function in the form vector list -> vector -> vector
<flux>
let romulus_iter (els:vector list) (a:vector) (b:vector) = failwith "not implemented";; then perhaps
<flux>
hm, actually that doesn't match the signature
<flux>
(b:vector) should be replaced with plain : vector
<flux>
another way of writing it: let romulus_iter : vector list -> vector -> vector = fun els a -> failwith "not implemented";;
<BigJ>
if I chance b:vector to just vector b is the value being passed, vector is the type
<BigJ>
type vector = float * float ;;
<flux>
vector list -> vector -> vector means a function that takes in a vector list, a vector and gives out a vector
<flux>
so only two parameters
Alpounet has quit ["Leaving"]
<BigJ>
ya I see that when I type in to interpreter I was getting 4 floats
<BigJ>
I am still unclear how I pass it the vector list
<BigJ>
let romulus_iter ([]:vector)(a:vector) =
<flux>
what that code does is that it accepts an empty list as its first parameter. that empty list must also be a vector. and that is impossible.
<flux>
let romulus_iter (els:vector list)(a:vector) = , as I showed earlier
<BigJ>
i get unbound value list
<BigJ>
sorry that's an error on my part
kaustuv_ has joined #ocaml
Sime has joined #ocaml
<Sime>
I've got very simple n00b questions: How do I pass 2 functions as arguments to another function, without ocmal trying to apply them to the other args?
<Sime>
i.e. "higherfunc funcA funcB", funcA and funcB should not be executed.
kaustuv_` has quit [Read error: 110 (Connection timed out)]
verte-work has quit ["~~~ Crash in JIT!"]
ttamttam has joined #ocaml
<ski_>
if `funcA' and `funcB' are identifiers bound to functions there, those functions won't be called before `higherfunc' is called
<ski_>
Sime : but maybe your `funcA' and `funcB' are expressions ?
<BigJ>
anyone help with iterating over a list?
<ski_>
iterating, how ?
<BigJ>
for loop
<flux>
List.iter?
<ski_>
"for loop" doesn't say much
<flux>
or List.fold_left, or explicit recursion
<flux>
bigj, it seems to me that it might be a good idea to go through some ocaml tutorials
<BigJ>
flux, I know these would be better
<BigJ>
but I have to use a for loop
ikaros has joined #ocaml
<flux>
becaues I'm pretty sure they'd cover these kind of things
<flux>
you have to use a for loop for iterating a list?
<BigJ>
I am reading a number of tutorials
<flux>
it's possible, but it's definitely not the way to go :-o
<BigJ>
for this specific purpose I do
<flux>
so, it's course work then?
<BigJ>
ya
<flux>
you must create a reference to the list, then
<BigJ>
I am unsure how I know which element I am at in the list, this is easy with arrays
<flux>
well, actually, not
<flux>
if you use a for-loop the most straight-forward way is to iterate from 0 to List.length l - 1 and use List.nth to access the element..
gdmfsob has joined #ocaml
<flux>
it's slow, but using for-loop for this is wrong already :)
<ski_>
if you need to keep track of the index, add another reference for it
<BigJ>
ya I found the List.iter function
<BigJ>
but unfortunately have to use a for loop
<flux>
well, how would you do it for an array then?
mishok13 has quit [Nick collision from services.]
gdmfsob is now known as mishok13
<BigJ>
for int i = 0 i < 10, i ++ { double c = [i] }
tonyIII_ has joined #ocaml
<flux>
you can do the same with lists
<flux>
except you use List.length to get the length and List.nth to access the element
<BigJ>
let romulus_iter (c:vector list)(a:vector) =
<BigJ>
for i = 1 to List.length c do List.nth
tonyIII__ has quit [Read error: 104 (Connection reset by peer)]
verte has joined #ocaml
ertai has quit [Remote closed the connection]
ertai has joined #ocaml
<BigJ>
flux, so u said recursion would be the best way to implement that function ?
munga has joined #ocaml
<Sime>
ski_: I pretty sure they are functions. I'm having trouble understanding the order of evaluation in neral...
<Sime>
general
tonyIII_ has quit [Read error: 60 (Operation timed out)]
tonyIII_ has joined #ocaml
_zack has joined #ocaml
<Sime>
playing in the interpreter, I think I get it now....
<_zack>
rwmjones: is there a website like packages.debian.org for fedora, where I can have a look at your dependencies/provides for OCaml packages?
<gildor>
flux: ocamlfind issue a warning about duplicate and choose one with "sort of" high priority
<rwmjones>
you don't ever have to write those deps, they just happen when you build the RPM
<gildor>
flux: high precedence is the environment variable, I think
<_zack>
rwmjones: ack, I was aware of that too, I just don't know whether generally the equal you are using for checksums means "at version XXX", is it the case?
<_zack>
(with "generally" I mean in contexts other than caml)_
<rwmjones>
the = means you have to have that exact version ... all the packages installed on the whole system have to be completely consistent. However RPM itself also supports other types of dependency comparison, eg. foo >= 1.2
<_zack>
rwmjones: ack, thanks
<_zack>
rwmjones: and ocaml(Foo) is kind of sub-package Foo of ocaml, which is elsewhere used, e.g., for C library symbols, is that it?
<rwmjones>
_zack, RPM treats it just as a string of characters
<_zack>
ok, so the meaning is added externally as a naming convention, I guess
munga has quit [Read error: 60 (Operation timed out)]
albacker has joined #ocaml
ttamttam has joined #ocaml
spicey has joined #ocaml
<spicey>
i'd like to use LablGL library, have it installed (64-bit archlinux, from AUR) in /usr/lib/ocaml/lablgl, but open LablGL;; fails with error: unbound module LablGL. To me it looks like it doesn't know that it needs to look in that folder, but I'm not sure. Any ideas how to find out what's wrong and how to get it working?
<gildor>
spicey: #directory "+lablgl";;
<gildor>
spicey: and then open LablGL;;
<spicey>
Thanks! Turned out that I was on the right way, but (oh, the facepalm) the thing to open was NOT called LablGL, it has just nice Gl, Glut, etc modules
_andre has joined #ocaml
<Camarade_Tux>
he, seems the caml-list sent all the messages at once :P
thrasibule has joined #ocaml
<flux>
rwmjones, regarding the postgresql-ocaml vulnerability: it is my belief the problem will rise only if you have multiple connections with different escaping conventions
<flux>
rwmjones, (I chatted much earlier about the escaping function on #postgresql)
<flux>
rwmjones, IIRC the default escaping function uses the conventions of the first established connection
<rwmjones>
ok
* rwmjones
uses pg'ocaml anyway
bzzbzz has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
seanmcl has joined #ocaml
ttamttam has quit ["Leaving."]
shr3kst3r has quit [Read error: 131 (Connection reset by peer)]
<sgnb>
rwmjones: by the way, does pgocaml cope with escaping correctly?
<sgnb>
(checking is on my TODO-list, but no time to check for now)
<rwmjones>
_zack, I think that's a bug in rpmfind.net ... those dependency definitely DO have checksums
<_zack>
rwmjones: ack, any other places where I can see them?
<rwmjones>
_zack, not easily - unless you install a Fedora virtual machine and use 'rpm -q --provides' / 'rpm -q --requires'
<rwmjones>
sgnb, pg'ocaml talks the PostgreSQL protocol directly, and it always uses statement placeholders
<sgnb>
_zack: mock/febootstrap should work too (I guess)
<_zack>
rwmjones: uhm, let's see, let assume Debian's rpm work, would that cmdlines work on a .rpm file on disk which is unknown in the package database?
<rwmjones>
_zack, yes, use the -p option to rpm to make it examine a local file
<_zack>
rwmjones: tnx
* _zack
takes RPM 101
<rwmjones>
like rpm -qRp foo.rpm
<rwmjones>
man page is very good
<_zack>
error: cannot open Name index using db3 - No such file or directory (2)
<_zack>
RPM version in Debian is 4.7.1
<rwmjones>
$ rpm --version
<rwmjones>
RPM version 4.7.1
<rwmjones>
maybe it does need the index, even if you're using the -p option, or something weird like that
<rwmjones>
let me just find a repo which has the deps in it
<rwmjones>
_zack, that XML basically contains the entire provides/requires for the whole of Fedora
<rwmjones>
in a fairly obvious xmlish format
<_zack>
rwmjones: BTW, my bad, I was looking at the .src.rpm instead of the .rpm
<rwmjones>
just search down for 'ocaml'
<_zack>
rwmjones: thanks for the pointer
<rwmjones>
what the heck is Dynlinkaux?
<rwmjones>
it appears to be a module in dynlink.cma, but I can't work out how to link to it
<rwmjones>
_or_ I can grab dynlink.cmo from the ocaml build directory, which works, but that file isn't distributed by make install
<sgnb>
rwmjones: Dynlinkaux is a private module used by Dynlink that packs several internal modules of OCaml
<sgnb>
it should be in dynlink.cma, but you shouldn't use it directly
<sgnb>
(it is a dependency of Dynlink)
<rwmjones>
ok ... I'm just trying to build debian's ocaml{byte,plugin}info commands
<rwmjones>
well, I got them built
<sgnb>
oh... of course, in that context, some hack might be needed ;-)
spicey has quit ["Leaving"]
verte has quit ["~~~ Crash in JIT!"]
Alpounet has joined #ocaml
lutter has joined #ocaml
Ched has joined #ocaml
tmaedaZ is now known as tmaeda
_zack has quit ["Leaving."]
_zack has joined #ocaml
julm_ has joined #ocaml
ski_ has quit ["Lost terminal"]
ski_ has joined #ocaml
thelema has quit ["brb"]
julm has quit [Read error: 110 (Connection timed out)]
_zack has quit ["Leaving."]
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
julm_ has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
Narrenschiff has joined #ocaml
thelema has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
julm has joined #ocaml
_unK has joined #ocaml
Snark has joined #ocaml
hcarty has quit [Remote closed the connection]
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
Narrenschiff has quit []
ttamttam has quit ["Leaving."]
mishok13 has quit [Read error: 110 (Connection timed out)]
mishok13 has joined #ocaml
<Camarade_Tux>
btw, I recently saw something about http://www.sagemath.org/ (regarding the discussion around scilab)
<Camarade_Tux>
it's meant to be used instead of maple and while it doesn't use ocaml, it's probably the first program I see in years that used python in an intelligent way : it's used for user inputs (you write python) and it only serves as a link between several math application
<Camarade_Tux>
(and maybe matlab too, not only maple)
<subito>
hi, if i have a and n of type Int64 and i want to obtain a² mod n which is also an Int64, is there a way to obtain it by a smarter way than Int64.rem (Int64.mul a a) n, since "Int64.mul a a" might be over Int64.max_int. Also, using big_int is not an option since it is really slower
kaustuv_` has joined #ocaml
<thelema>
is n < Int32.max_int?
subito has quit [Remote closed the connection]
subito has joined #ocaml
<subito>
sorry if someone answered i got disconnected
<thelema>
is n < Int32.max_int?
<subito>
thelema: no this is the problem :/
<thelema>
subito: then you're stuck using big_int if you want a correct answer
<thelema>
at least I see no way to do it using 64-bit math (other than using multiple Int64.t's to simulate a 128-bit value, which is what you need.
<subito>
thelema: i think there is way to do it faster than big_int
<thelema>
you can do (a mod n) * (a mod n), but since n > Int32.max_int, this can still overflow
<subito>
a stupid algorithm to multiply a * b would be to add a 'b times' to 0L
peddie has joined #ocaml
<thelema>
you will not be able to do this for >32-bit numbers in a reasonable amount of time.
<subito>
sure but i have another idea
* thelema
is waiting
<subito>
something like: a*b mod n = if b < max_int/a then simple multiplication else 2*(a*(b/2))
<subito>
with the modulos and taking care of the parity of b
<subito>
and with this algorithm (and also for the stupid algorithm of the sum), n should be less than Int64.max_int / 2
kaustuv_ has quit [Read error: 110 (Connection timed out)]
eni_ has joined #ocaml
<thelema>
what about going through float? You won't get the exact answer...
<subito>
yeah :(
albacker has quit [Read error: 60 (Operation timed out)]
<subito>
this multiplication seems to be a lot faster than big_int but it's still too slow for my problem :(
<thelema>
float multiplication is too slow for you? What are you doing?