mpc has joined #ocaml
tewk has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has quit ["Leaving"]
devik has joined #ocaml
<
devik>
hello, i'm very new to ocaml and i cant find help about types
<
devik>
type x = { mutable bl : int }
<
devik>
type y = Blah of x
<
devik>
let z = Blah { bl = 1 }
<
devik>
why cant I modify z.bl ?
<
dan2>
devik: z.bl <- 5?
<
dan2>
devik: that doesn't work?
<
devik>
# z.bl <- 5;;
<
devik>
This expression has type y but is here used with type x
<
dan2>
devik: its your stupid typing crap
<
avlondono>
you have to match it. if you do let z = {bl = 1} you can modify it directly.
<
devik>
dan2: sorry, i really new to ocaml (one week)
<
devik>
avlondono: thanks
<
devik>
avlondono: whats the diference between both ?
<
dan2>
devik: type y does you no good
<
dan2>
devik: and for this why not use ref?
<
avlondono>
don't add more stuff to confuse him dan2
<
dan2>
devik: ref 1;;
<
avlondono>
at least first explain that part man
<
devik>
avlondono: i already know refs
<
devik>
dan2: yes, i should be using refs
<
devik>
this is what i'm trying todo:
<
devik>
match e with
<
devik>
| Blah { bl = bl } -> modify bl
<
devik>
but.. type y = Blah of x | Xunk of x
<
devik>
should I change the types ?
<
avlondono>
| Blah x -> x.bl <- 5
<
avlondono>
although as dan2 said, a ref might be enough for your needs
<
devik>
but, i'have to match with blah's bl value
<
devik>
| Blah { 5 } x ->
<
devik>
does this work's ?
Nutssh has joined #ocaml
<
avlondono>
I don't understand that one
<
avlondono>
maybe you want | Blah { bl = 5} as x -> whatever
<
avlondono>
but again, if ref is enough go for that.
<
devik>
I haven't seen that syntax anywhere
<
devik>
thanks very much
devik has quit ["leaving"]
<
Nutssh>
What was the type type u = {bl : int} type t = Blah of u ?
<
avlondono>
yeh, bl was mutable
<
Smerdyakov>
bl! bl!
devik has joined #ocaml
<
devik>
that's me again
tewk has joined #ocaml
<
devik>
maybe you people can tell me if there is a better way to create a new queue with some value of another queue (concatenating
<
devik>
redundant types)
<
devik>
( function value ->
<
devik>
match !last_value, value with
<
devik>
| Some( XValue { count = a } as last ), XValue { count = b } -> last.count <- a + b;
<
devik>
last_value := Some( value );
<
devik>
what am I missing ?
devik has quit ["leaving"]
monochrom has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
mrsolo has joined #ocaml
kinners has joined #ocaml
jjones has joined #ocaml
cjohnson has quit ["The main attraction: distraction"]
jjones has left #ocaml []
mrsolo has quit [Read error: 104 (Connection reset by peer)]
mrsolo has joined #ocaml
mpc has joined #ocaml
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
monochrom has quit ["Don't talk to those who talk to themselves."]
vezenchio has joined #ocaml
srv_ has quit [Read error: 232 (Connection reset by peer)]
srv has joined #ocaml
_fab has joined #ocaml
pango has quit ["Client exiting"]
kinners has quit ["leaving"]
Herrchen has joined #ocaml
sb98052 has joined #ocaml
<
sb98052>
how does one find the square root of a number in ocaml?
<
Nutssh>
Look in the Pervasives module.
eugos has joined #ocaml
<
mlh>
open by default
<
mlh>
i.e. sqrt 4. ;;
mlh has quit [Client Quit]
mrsolo_ has quit [Read error: 113 (No route to host)]
karryall has joined #ocaml
haelix has joined #ocaml
haelix has quit ["Changing server"]
sb98052 has quit [Read error: 238 (Connection timed out)]
mlh has joined #ocaml
cjohnson has joined #ocaml
docelic has quit ["-> home"]
_shawn has joined #ocaml
shawn has quit [Read error: 232 (Connection reset by peer)]
shawn has joined #ocaml
_shawn has quit [Read error: 104 (Connection reset by peer)]
_shawn has joined #ocaml
shawn has quit [Read error: 232 (Connection reset by peer)]
_shawn has quit [Read error: 104 (Connection reset by peer)]
shawn has joined #ocaml
shawn has quit [Read error: 54 (Connection reset by peer)]
_shawn has joined #ocaml
mlh has quit [Client Quit]
eugos has quit ["Leaving"]
ctr has quit ["BitchX: use it, it makes hair grow in funny places!"]
haelix has joined #ocaml
alx__ has joined #ocaml
haelix has quit [Client Quit]
alx__ is now known as haelix
haelix has quit [Client Quit]
pango has joined #ocaml
_fab has quit [Remote closed the connection]
skylan_ has joined #ocaml
skylan has quit [Read error: 113 (No route to host)]
pango has quit ["Leaving"]
pango has joined #ocaml
mark has joined #ocaml
mark has left #ocaml []
CosmicRay has joined #ocaml
CosmicRay has quit [Client Quit]
CosmicRay has joined #ocaml
monochrom has joined #ocaml
vezenchio has quit ["If god didn't believe athiests existed, you would not exist. However you exist, so there must be no god"]
avn has quit [Remote closed the connection]
vegai has quit ["imagine how it would be to be at the top making cash money"]
avn has joined #ocaml
<
jason__>
Hm, is there any way to staticly compile a .so into a ocaml binary?
<
jason__>
Like, can I somehow use gcc to link stuff?
<
Nutssh>
AFAIK, no. A .so is a dynamic library.
<
jason__>
.. You can compile a .so into an exe if you wish staticly.
<
jason__>
gcc myLibrary.so myFile.c -o Prog.
<
jason__>
Just gcc -shared myArchive.a -o myLibrary.so links everything to that point anyways.
<
jason__>
There's really not much of a difference between the two.
<
jason__>
Hm.. I wonder if there is a .a lying about somewhere.
<
Nutssh>
Big difference. 'gcc myLibrary.so myFile.c -o Prog' makes Prog dynamically linked with myLibrary.so
<
jason__>
Ah, really?
<
Nutssh>
Try 'ldd Prog'
<
jason__>
Can, you reverse a .so back to a .a?
<
Nutssh>
And you want to use ocamlopt to link, not gcc so that all of the ocaml runtime gets properly included.
<
Nutssh>
Not that I know of.
<
jason__>
Right, I was just wondering if you could use gcc.
<
jason__>
I'm really just kinda getting a bit worked up with libpcre.
<
jason__>
Because it's completely inconsistent across machines I'm using it on, even though .so exists.
<
jason__>
It keeps bitching that pcre_callout doesn't exist.
<
jason__>
I replaced the regexp stuff with Str.regexp stuff, but now it's slow.
<
Nutssh>
Reread the docs for ocamlopt and linking with native code. Static compilation with prce should solve this.
<
jason__>
Okay, that's exactly what I'm trying to do.
<
Nutssh>
If the machines have different pcre libraris and you dynamically link against it, things aren't going to work well.
<
Nutssh>
What you want is a static link against libpcre.a (or whatever the exact filename is)
<
jason__>
Yeah.. I did that. But I think the pcre.cmxa is dynamicly linked against it.
<
jason__>
So, I need to probably rebuild ocamlpcre.
<
Nutssh>
Yes, that too should work well.
<
jason__>
I tried linking directly with libpcre.a to no avail.
<
Nutssh>
Does the library exist?
<
jason__>
Yeah, I think the cmxa is still looking for the shared object, though.
<
Nutssh>
Recompile the cmxa? Or, use LD_SO_PRELOAD to make it so that everyone finds the same identical libpcre.so
ez4 has joined #ocaml
Herrchen has quit ["good night"]
CosmicRay has quit ["Client exiting"]
ez4 has quit [Remote closed the connection]
ez4 has joined #ocaml
joel__ has joined #ocaml
eugos has joined #ocaml
<
jason__>
What module do I include to use big_int?
<
jason__>
Well, what archive/object file?
<
jason__>
Ah, found it.
<
jason__>
nums.cma, instead of num.cma.. Weird.
jrosdahl has quit [Read error: 110 (Connection timed out)]
jason__ has quit ["Client exiting"]
monochrom has quit ["Don't talk to those who talk to themselves."]