<thelema>
rpg: = doesn't do assignment in ocaml, it tests for structural equality
<thelema>
Yoric[DT]: good morning.
<Yoric[DT]>
morning
<Yoric[DT]>
How do you do?
<rpg>
?
<rpg>
explain ?
<rpg>
oh
<thelema>
rpg: you also probably want some calculations with floating point numbers, no?
<rpg>
how do i assign
<rpg>
nope
<rpg>
its all int
<rpg>
the answer should be int
<Yoric[DT]>
rpg: in OCaml, if you can avoid it at all, you don't re-assign.
<Yoric[DT]>
(i.e. everything is a [local] constant unless specially noted otherwise)
<rpg>
so i would use a vaiable then ?
<thelema>
rpg: one method is to use reference values. The other involves recursion and function parameters.
<rpg>
where could i find an example / explanation of both
<Yoric[DT]>
Well, you can find both in the manual, I guess, or in any tutorial.
<thelema>
rpg: I imagine you're doing this for a class project, no?
<rpg>
something like that
<thelema>
Yoric[DT]: I'm okay. I wish I had more time to put into batteries. Did you ever moderate through my email to the batteries list?
<Yoric[DT]>
Essentially, what you (and the rest of the imperative world) calls a "variable" is called a "reference" in OCaml (and the rest of the functional world) (or a "cell" in concurrent world, but that's another issue).
<Yoric[DT]>
thelema: yep.
<Yoric[DT]>
thelema: it came through.
<Yoric[DT]>
(you mean the one with diagrams, don't you?)
<thelema>
okay. I never got any replies, and it didn't get sent to me.
<thelema>
yes, that one.
<Yoric[DT]>
Sorry, I didn't have time to reply.
<thelema>
n/p
<rpg>
yes imperative yes
<Yoric[DT]>
thelema: With your results, I'm actually wondering which implementations we should favor.
<thelema>
I'd want to see others' numbers first. I really need to put the code into SVN so others can run it.
<Yoric[DT]>
rpg: what OCaml (and the rest of the functional world) calls "variable" is the same thing mathematics call "variable", i.e. what the rest of the imperative world calls constants.
<Yoric[DT]>
thelema: yeah, I've informally asked for their code, but it seems that was years ago.
<rpg>
now youve lost me
<Yoric[DT]>
thelema: the one who performed measures was Alain Frisch, you could try and ask him.
<Yoric[DT]>
rpg: well, in OCaml, "variables" don't change, just as in mathematics, "variables" don't change.
<thelema>
Yoric[DT]: maybe enough for others in our group to run my tests, to find crossover points under different circumstances
* palomer
puts what he hopes to be some close to final touches
<flux>
type i = private int makes i incompatible with int, unless you explicitly annotate (i : int) or perhaps (i :> int)
<palomer>
how is this useful?
<flux>
well, I sometimes have integers or strings which I don't want to mix with other integers or strings
<flux>
and using a constructor is a bit cumbersome at times
<flux>
I hope using that is more succinct
<flux>
I'm not actually quite sure how the private row types work, as I haven't used them yet, though :)
<flux>
hm, s/row types/type abbreviations/
<flux>
the previous version already supported type i = private I of int
<flux>
I think it atleast gives a way to easily get the concrete value out of an instance of the type, while preventing an arbitrary instance being casted into that type
<flux>
I wish I wish I wish the date fields worked at caml.inria.fr mailing list archives
<flux>
fortunately the url gives some clue on when the post was made
LeCamarade has quit [Connection timed out]
det has quit [Remote closed the connection]
det has joined #ocaml
<johnnowak>
i'm trying to install findlib. does anyone know where it might be looking for the standard library directory? it can't seem to find it.
gdmfsob has quit [Read error: 104 (Connection reset by peer)]
<flux>
I think it might use ocamlc -where to find it
<johnnowak>
ocaml -where yields the correct location
mishok13 has joined #ocaml
<flux>
no other ideas then
<flux>
happy debugging ;)
<johnnowak>
silly
<johnnowak>
heh, thanks
<johnnowak>
ugh
<johnnowak>
it's using this: ocamlc -where 2>/dev/null | sed -e "s/\r//"
<johnnowak>
$ ocamlc -where 2>/dev/null | sed -e "s/\r//"
<johnnowak>
way to go
<johnnowak>
oh... /us/local/lib/ocaml
Yoric has joined #ocaml
<johnnowak>
\n .. much better
LeCamarade has joined #ocaml
<flux>
hmm
<flux>
how is it using that?
<flux>
it looks like a workaround for windows platform
<flux>
if it's using it inside ``, the last \n is removed anyway
<flux>
ah, a quoting problem instead
<johnnowak>
get_stdlib () {
<johnnowak>
ocamlc -where 2>/dev/null | sed -e "s/\n//" || {
<flux>
I think it should actually be: sed -e 's/\r//'
<flux>
which shell do you have?
<johnnowak>
it 's\r//' doesn't work
<johnnowak>
bash
LeCamarade has quit [Read error: 104 (Connection reset by peer)]
johnnowak has quit []
LeCamarade has joined #ocaml
LeCamarade has quit [Connection reset by peer]
LeCamarade has joined #ocaml
LeCamarade has quit [Connection timed out]
johnnowak has joined #ocaml
rwmjones_ has joined #ocaml
mlh has quit [Read error: 110 (Connection timed out)]
johnnowak has quit []
vbmithr has joined #ocaml
_zack has joined #ocaml
_zack has quit [Client Quit]
_zack has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
Yoric has quit [Remote closed the connection]
ggole has joined #ocaml
<ggole>
Hi. I'm trying to read a list of integers with scanf, and it doesn't like format strings without specifiers (which I use to read the opening list delimeter).
<ggole>
What's the cleanest way to get around that? Read a char and check if it's the right one?
<flux>
ggole, hm, are you trying to use a format string you read from some source?
<ggole>
Nope
<ggole>
Say I want to read a "(" and ignore the result : I would expect to have to do something like sscanf "(" "(" (fun -> ())
<ggole>
But ocaml doesn't have functions of no arguments
<ggole>
And (fun () -> () ) doesn't seem to be suitable here
<flux>
plain () works there
<flux>
(or any other value)
<ggole>
Oh, I didn't try that
<flux>
hm, infact (fun () -> ()) would work then also :)
<flux>
but you get the function back
<flux>
try this: Scanf.sscanf "(" "("
<ggole>
Ah, I see
<ggole>
Hmm, the docs didn't really make that behaviour clear
<ggole>
Or perhaps I don't understand the type signatures of the scanf family
<ggole>
OK, thanks
<flux>
ggole, btw, do you know the functional unparsing white paper?
<ggole>
I've heard it's an interesting read, but not read it myself
<flux>
it's quite short and not that difficult paper, worth a read
<ggole>
I'll look it up after I get this working
OChameau has joined #ocaml
ggole has left #ocaml []
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
ulfdoz has joined #ocaml
Snark_ has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
det has joined #ocaml
mbishop has quit [Read error: 60 (Operation timed out)]
mbishop has joined #ocaml
Snark_ has quit [Remote closed the connection]
Snark has joined #ocaml
Camarade_Tux has joined #ocaml
mlh has joined #ocaml
mellum has left #ocaml []
authentic has quit [Remote closed the connection]
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
electronx has quit []
authentic has joined #ocaml
davidm123 has quit ["ChatZilla 0.9.83 [Firefox 3.0.3/2008092417]"]
GustNG has joined #ocaml
filp has joined #ocaml
Associat0r has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
azi_ has quit [Read error: 60 (Operation timed out)]
GustNG1 has joined #ocaml
longh has joined #ocaml
_zack has quit ["Leaving."]
Associat0r has quit [Connection timed out]
Jedai has quit [Success]
Jedai has joined #ocaml
ulfdoz has quit ["deprecated"]
GustNG has quit [Read error: 110 (Connection timed out)]
mfp has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
<rpg>
whats wrong with this line: !answer := (addprime !prime);
<flux>
you most likely want to get rid of that first !
<rpg>
its a reference
<rpg>
let answer = ref 1;;
<flux>
and := assigns a value to a _reference_
<flux>
! however dereferences the value
<flux>
getting the value out of a reference
<flux>
so that's like saying 1 := 2
<rpg>
yes
<rpg>
i want to set 1 to 2
<flux>
answer is reference, !answer is not
<flux>
well, that's something ocaml cannot do either :)
<flux>
look into fortran to do that..
<rpg>
wtf
<rpg>
fuck fortran
<rpg>
how do i go about fixing this then
<flux>
as I sed
<flux>
said, even
Snark has quit ["Ex-Chat"]
<flux>
drop the first !
<flux>
answer := 42
<rpg>
This expression has type unit but is here used with type in
<rpg>
t
<rpg>
so then
<flux>
I'm guessing your function returns a unit, while it should return an integer
<rpg>
let addprime x = !answer * (x-1) /x;;
<rpg>
drop the ! again ?
<flux>
nope
<flux>
this time you want !answer there
<rpg>
oh
<rpg>
so how does it return unit
<flux>
do you use emacs?
<rpg>
vim
<rpg>
but i can use emacs
<rpg>
why
<flux>
if you compile the file with ocamlc -dtypes, it can give you back the types in the program
<rpg>
his expression has type unit but is here used with type int
<flux>
the thing is that you've indented in a misleading manner
<flux>
you need to write the else like: else (answer := ..; (nr / !prime))
<flux>
(or you can use begin/end too if you want)
<rpg>
that matters ?
<flux>
emacs would help with indentation ;-). the scope of the if ends after the first ; after answer :=
<flux>
both branches of if must return a value of the same type
<flux>
the first returns an int, but an assignment returns a unit
<flux>
so it fails
schme has joined #ocaml
<schme>
Hello #ocaml
<flux>
you have the same problem with function2 too, I think
<flux>
hello schme
<rpg>
i added some begin, end and now it says unbound value main
<rpg>
i cant make 2 functions that call out each other can i
<flux>
if you want mutually recursive functions, you need to use let rec foo a b c = .. and bar d e f = .. and ..
<flux>
an alternative would be to pass the function as a parameter
<schme>
What should I google around for to find information on concurrency + ocaml?
<flux>
let main nr = .. function2 main nr..
<flux>
and then in function2 add parameter main, and call that
<flux>
schme, looking at the ocaml manual on threads and conditions might be a good start. you can learn more about the Event-module from search the web for related documentation on Concurrent ML
<schme>
flux: Thanks a bunch there :)
<flux>
schme, and then there is cothreads.sf.net, which is an alternative threading library
<flux>
its sourceforge page appears to be quite blank at the moment, though..
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
<schme>
ouch.
<rpg>
flux
<schme>
manual says the threads library does not utilize multiple CPUs :S
<rpg>
i came up with a new way
<rpg>
it compiles
<rpg>
but doesnt work
<flux>
schme, I think cothreads can work around that. but sharing values between threads is always explicit, then. they are really processes.
<flux>
I understand it too can make use of multiple CPUs
<rpg>
first i called out main 14 and it gave me int 1
<flux>
it's different from threading, but people say it's really great :)
<rpg>
then i called out main 28 ..... nothing
<schme>
I have had good experiences with "different from threading", so that is ok :)
<flux>
rpg, your program appears to be very complicated compares to the problem at hand, but I guess it's because you have global variables which you modify
<flux>
if you're learning functional programming, then perhaps it would be good to have an effort to make it not use mutation..
<rpg>
i know
<rpg>
im new to this function programing
<flux>
well, good luck in learning
<rpg>
lol
<flux>
I'm off the irc for a while
Morphous has quit [Read error: 110 (Connection timed out)]
Morphous has joined #ocaml
<rpg>
now im getting stack overflow
<rpg>
wtf
Submarine_ has joined #ocaml
christo_1 has joined #ocaml
mishok13 has quit [Connection timed out]
christo_1 has quit ["leaving"]
_zack has joined #ocaml
christo_m has joined #ocaml
christo_m has quit [Client Quit]
pango has quit [Remote closed the connection]
pango has joined #ocaml
pierre- has joined #ocaml
filp has quit ["Bye"]
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
jlouis has joined #ocaml
ulfdoz has joined #ocaml
Snark has joined #ocaml
ulfdoz has quit [Read error: 113 (No route to host)]
<flux>
if you use topleve, #trace functionname;; can be useful
<flux>
but, I'll be off, again
* Camarade_Tux
hopes his livecd is ready by this weekend
Quadrescence has joined #ocaml
Linktim has joined #ocaml
ulfdoz_ has quit [Read error: 113 (No route to host)]
ulfdoz has joined #ocaml
postalchris has joined #ocaml
postalchris has quit [Remote closed the connection]
postalchris has joined #ocaml
Submarine_ has quit ["Leaving"]
Linktim_ has joined #ocaml
<Camarade_Tux>
wooties, godi successfully finished, which means I only have a few things left to check :)
Jedai has quit [Success]
<Camarade_Tux>
and remember kids, if you want to compile bindings to fftw, you need fftw installed !
Jedai has joined #ocaml
Linktim has quit [Read error: 113 (No route to host)]
_zack has quit ["Leaving."]
rwmjones_ has quit [Read error: 104 (Connection reset by peer)]
kushal has joined #ocaml
<kushal>
Hi all
<kushal>
I am a total newbie
<kushal>
Can anyone point me to a HTTP post request example ?
munga has quit ["Leaving"]
sbok has quit [Read error: 113 (No route to host)]
<flux>
kushal, have you tried the curl bindings?
<kushal>
flux, no , I don't have much clue on OCAML yet,
<kushal>
mostly a python guy, took a problem trying to solve it using OCAML
<kushal>
flux, anylink to read from ?
<flux>
kushal, do you run linux?
<kushal>
flux, yes, Fedora
<kushal>
9
<flux>
does it have many ocaml packages?
<flux>
it might have ocaml-curl
<kushal>
yes, let me install it
<flux>
I'm installing it too, so I know what I'm talking about :)
<kushal>
flux, installed , now ?
<flux>
it'll take a while, installing from sources
<kushal>
ok
<flux>
but, you can rush ahead
<kushal>
flux, gentoo ?
<kushal>
let me google
<flux>
ubunut, but I'm runnning an ocaml distribution called Godi
<flux>
kushal, you can find the .mli-files from within the package
<flux>
actually, there's only one: curl.mli
<kushal>
flux, ok
<flux>
ah, now I remember
<flux>
there is practically no documentation there, it relies on curl documentation :)
<kushal>
eeks
<flux>
but no worries, you can see how it's used from the types, iirc it's very simple
<flux>
apparently first you call Curl.init ()
<flux>
to get a handle
<flux>
so put store it to some variable, let c = Curl.init ()
<flux>
then Curl.set_url c "some://url"
<kushal>
ok
<flux>
set_post c true
<flux>
did you take a look at the file, how does it look to you?
<kushal>
flux, trying to find that file
Jedai has quit [Read error: 104 (Connection reset by peer)]
<flux>
rpm -ql ocaml-curl | grep curl.mli
Jedai has joined #ocaml
<kushal>
flux, it is a binary file ?
<flux>
no
<flux>
it's a text file
<flux>
I would expect it to come with the bindings
<flux>
although it's not actually used during compilation, it's just for reference
<flux>
there should be a file curl.cmi, which is used during compilation
<kushal>
no such file
<flux>
no even curl.cmi?
<kushal>
yes, .cmi and .cma
<flux>
well, you can find curl.mli from the web easily
OChameau has quit ["Leaving"]
<flux>
atleast from http://209.85.135.104/search?q=cache:8929R9FyuQIJ:ocurl.cvs.sourceforge.net/viewvc/ocurl/ocurl/curl.mli%3Frevision%3D1.20%26view%3Dmarkup+curl.mli&hl=en&ct=clnk&cd=2&client=firefox-a
<kushal>
flux, ok
<kushal>
flux, actually this is basically the first ever program I am trying to write :P
<flux>
kushal, how familiar are you with ocaml in general?
<kushal>
should have started with hello world! I guess
<flux>
it's good to have high goals ;)
<kushal>
flux, a bit reading from that English translated book
sbok has joined #ocaml
<kushal>
was in chapter 2 only
vixey has joined #ocaml
<kushal>
flux, do I have to import the lib somehow ?
<flux>
do you have ocamlfind? (just run ocamlfind in shell to find out)
<kushal>
ok, I have to install it
<flux>
second, do you have rlwrap or ledit installed?
<kushal>
no
<flux>
they are very useful when using ocaml interactively
<flux>
used like: rlwrap ocaml
<kushal>
installing
<kushal>
flux, does it autocomplete ?
<flux>
unfortunately no. I think there is a project that does that, though, but I haven't used it and I don't remember its name
<kushal>
ok
<kushal>
don't need now
<flux>
I'm wondering if libcurl was the best way to go after all, it is all very low-level :)
<hcarty>
kushal and flux: rlwrap does have some limited autocomplete support
<hcarty>
But it is not OCaml specific
<kushal>
ok
<hcarty>
Just words that it has already seen
<flux>
hcarty, how do you activate it?
<hcarty>
alias oc='rlwrap -r -c -D 2 ocaml'
<hcarty>
-c = Complete filenames
<flux>
and tab thereafter?
<hcarty>
-D = History with duplicate lines eliminated
<hcarty>
flux: Yes
<kushal>
Is there any high level lib , like urllib in python ?
<hcarty>
-r = Put all words seen on in- and output on the completion list
<flux>
kushal, well, there ocamlnet
<flux>
+is
<flux>
iirc it has a simple api for this
<flux>
I don't remember why I most recently used libcurl, though
<flux>
once you have ocamlfind, you can compile ocaml programs like this: ocamlfind ocamlc -package netclient -linkpkg -o proggy proggy.ml
<flux>
and in the toplevel you can enter #use "topfind";;
<flux>
after which you can enter #require "netclient";; to load the package
<flux>
you can put atleast the #use to ~/.ocamlinit so it'll load automatically
Jedai has quit [Success]
Jedai has joined #ocaml
<kushal>
flux, can you just pastenbin first 2-3 lines as you just said
mbishop has quit [Remote closed the connection]
<flux>
did you get disconnected or something? I /ignore that stuff..
<flux>
modeemi.fi/~flux/foo.txt
mbishop has joined #ocaml
<kushal>
flux, I guess I better some more amount then try
<kushal>
* better read
marmotine has joined #ocaml
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
vixey has quit ["Leaving"]
Submarine has joined #ocaml
vixey has joined #ocaml
jlouis has quit [Read error: 104 (Connection reset by peer)]
<postalchris>
Anybody know what I can do to induce an update in an out-of-date GODI package?
<hcarty>
postalchris: Flag it for updating in godi_console?
<hcarty>
postalchris: Or do you mean that there is a newer version available elsewhere than what is shown in GODI?
<postalchris>
hcarty: that's right, the upstream version is more recent than the GODI version
<Camarade_Tux>
postalchris, afaik you'll need to write an updated godi package and then get it upstream
Jedai has quit [Connection reset by peer]
Jedai has joined #ocaml
<postalchris>
Related: if something's going wrong inside a GODI package ./configure script, how can I get hold of the config.log to investigate? The work directories are deleted...
<Camarade_Tux>
hmm, no idea, I slept for less than 4 hours last night and was already tired, so now is BED !
Camarade_Tux has quit ["Leaving"]
<postalchris>
Here's a way: hit C-c instead of letting GODI exit cleanly
<hcarty>
postalchris: I think the GODI docs have instructions on how to run each stage of the build process manually from the command line. That may help.
<hcarty>
postalchris: And Camarde_Tux is right, you would have to update the outdated package yourself and submit it to a GODI maintainer, or request an update on the GODI mailing list
pierre- has quit [Read error: 60 (Operation timed out)]
<postalchris>
I'm going to do a manual build and ping the package maintainer
Jedai has quit [Read error: 104 (Connection reset by peer)]
Jedai has joined #ocaml
Submarine has quit [Remote closed the connection]
Snark has quit ["Ex-Chat"]
<hcarty>
postalchris: What's the package, out of curiosity?
GustNG1 has quit ["Leaving."]
<postalchris>
app-frama-c
<postalchris>
What's the GODI equivalent of "apt-get upgrade"? "godi_console perform -rebuild" seems to unconditionally rebuild everything.
<hcarty>
postalchris: There is a "mark all upgradable" or similar option from within godi_console. I don't know the command line equivalent.
<postalchris>
I avoid the curses interface, when possible...
<hcarty>
postalchris: It's explained in the man page
<hcarty>
You can add the "-newer" option to only rebuild packages with newer versions available
<postalchris>
Ah.
<postalchris>
Very good
jlouis has joined #ocaml
Palace_Chan has joined #ocaml
Linktim_ has quit ["Quitte"]
mbishop has quit [Remote closed the connection]
mbishop has joined #ocaml
Submarine has joined #ocaml
mbishop_ has joined #ocaml
rwmjones_ has joined #ocaml
psnively has joined #ocaml
psnively has quit [Client Quit]
jeddhaberstro has joined #ocaml
psnively has joined #ocaml
psnively has quit [Client Quit]
psnively has joined #ocaml
<psnively>
Yo.
mbishop has quit [Read error: 110 (Connection timed out)]
<jlouis>
psnively, your Yo in #coq was way cooler
<psnively>
LOL
marmotine has quit ["mv marmotine Laurie"]
seafood has joined #ocaml
netx has joined #ocaml
DroneZilla has joined #ocaml
DroneZilla has left #ocaml []
ulfdoz has quit ["deprecated"]
Yoric[DT] has joined #ocaml
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
Raevel has joined #ocaml
postalchris has quit ["Leaving."]
jeddhaberstro_ has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
<Submarine>
Yo
jlouis has quit ["Leaving"]
jeddhaberstro has quit [Read error: 110 (Connection timed out)]
<psnively>
Yo.
vixey has quit ["Leaving"]
netx has left #ocaml []
Submarine has quit [Remote closed the connection]
seafood_ has quit [Read error: 110 (Connection timed out)]
rwmjones_ has quit [Read error: 104 (Connection reset by peer)]
xevz has quit [Read error: 110 (Connection timed out)]