<flux>
"what an interesting patch.. too bad it'll never go in.."
<flux>
but there it is :)
ng__ has joined #ocaml
<flux>
(although I would've liked it to be two patches: one for adding the environment, another for doing the spellcheck)
<ng__>
Hello everyone, I'm trying to translate a code in c to ocaml, but gives errors!!!can someone help?
Neros has joined #ocaml
<hcarty>
ng__: Go ahead and ask your question(s), you don't have to ask to ask. Can you pastebin the problematic code somewhere? That will probably be necessary to get a good answer.
Zerker has quit [Remote host closed the connection]
Zerker has joined #ocaml
GnomeStoleMyBike has joined #ocaml
ousado has quit [Remote host closed the connection]
<Kakadu>
ng__: compilation error or what?
ousado has joined #ocaml
Kakadu has quit []
ousado has quit [Changing host]
ousado has joined #ocaml
Kakadu has joined #ocaml
<ng__>
Kakadu, error of my conversion :D ... nothing compilation!!!
fraggle_ has quit [Quit: -ENOBRAIN]
trotro has quit [Quit: Leaving]
fraggle_ has joined #ocaml
<Kakadu>
use indentation plz
mcclurmc1 has quit [Ping timeout: 246 seconds]
<Kakadu>
without it it's unreadable
CoverSlide has quit [Ping timeout: 256 seconds]
<malc_>
ng__: your translation is incorrect, precisely because you are fooled by indentation in C code, line 10 is not part of C for loop but is inside the begin end block of for loop in ocaml version
uselpa has joined #ocaml
<ng__>
malc Kakadu ok, but continues to give something completely different...
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 246 seconds]
<Kakadu>
ng__: indentation shouldn't correct results. It should make program readable for us
<_andre>
found it by accident, wondering if it's good as a suggestion to someone who wants to learn ocaml
<malc_>
ng__: open Printf;; let n, c = print_string "n:"; let n = read_int () in print_string "c:"; let c = read_int () in n, c ;; let rec estrelinhas n c = if n = 1 then begin for i = 0 to c do Printf.printf " "; done; Printf.printf "*"; end else ( estrelinhas (n / 2) (c); Printf.printf "\n"; for k = 0 to c do Printf.printf " "; done; for p=0 to n do Printf.printf "* "; done; Printf.printf "\n"; estrelinhas (n / 2) (c+n) ) ;; let()= Printf.printf "* "; P
<hcarty>
I found that really helpful when I started out
<ng__>
malc_, let me see
Neros has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
Neros has joined #ocaml
Yoric has joined #ocaml
chambart has quit [Read error: Operation timed out]
<ng__>
malc_, It was my mistake, thanks
<ng__>
:D
<ousado>
"<malc_> there are plenty of factorial implementations though" heh
Neros has quit [Read error: Connection reset by peer]
Neros has joined #ocaml
Snark has joined #ocaml
<malc_>
ng__: de nada
<ng__>
malc_, Oo :D
ocp has quit [Ping timeout: 246 seconds]
trotro has joined #ocaml
ontologiae has quit [Ping timeout: 255 seconds]
tac has quit [Ping timeout: 245 seconds]
err404 has joined #ocaml
ng__ has quit [Remote host closed the connection]
mcclurmc1 has joined #ocaml
thomasga has quit [Quit: Leaving.]
tac has joined #ocaml
tufisi has quit [Ping timeout: 245 seconds]
ng__ has joined #ocaml
tufisi has joined #ocaml
trotro has quit [Ping timeout: 252 seconds]
trotro has joined #ocaml
tac is now known as tac-tics
metadave has joined #ocaml
ImAlsoGreg has joined #ocaml
uselpa has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
<yezariaely>
what module do you use if you have to represent date?
<yezariaely>
s/module/library/
<thelema>
there's a great calendar library
<thelema>
and there's date/time support in core
<thelema>
calendar.forge.ocamlcore.org
<yezariaely>
thelema: after a dist upgrade I finally have ocaml 3.12.1 installed and can successfully compile batteries ;)
<thelema>
yay!
<yezariaely>
but there is no date in there!?
<yezariaely>
though I found some hints in the previews?
<thelema>
? in calendar?
<yezariaely>
no in the batteries
<thelema>
yes, there's no date functions in batteries.
<thelema>
should there be?
<yezariaely>
I don't know. depends on the focus of the library/framework
<yezariaely>
Maybe not.
<thelema>
batteries has focused on containers and IO more.
<thelema>
I thought about putting a calendar library in (well, more specifically, depending on the calendar library) and extending it to play nicely with batteries IO
chturne has joined #ocaml
<yezariaely>
sounds like a good idea
<thelema>
the reason I didn't was that I was (and have succeeded) at keeping batteries from having too many dependencies, as they were a big problem for people to use batteries
<yezariaely>
I totally agree. Is it possible to include calendar in batteries instead of only putting dependencies there?
<thelema>
including external libraries into the batteries distribution also seems a poor quality solution
avsm has quit [Quit: Leaving.]
tac-tics has quit [Ping timeout: 245 seconds]
<foo303>
Does anyone know how to let ocaml be aware of packages installed by opam while running an ocaml program?
<thelema>
what do you mean by "while running an ocaml program"?
<thelema>
you're executing opam in your ocaml program
<thelema>
and you want to use packages installed by opam in your program?
<foo303>
yeah, that's what I want to be able to do.
<foo303>
I thought opam is a package manager not a library I use to access packages. (Is there any way to write the code assuming the packages are somehow provided and actually be able to run it, or do I have to add some opam-specific code to get my packages to be visible?)
<thelema>
how can ocaml compile your program (including type checking) if it doesn't have access to the libraries
<thelema>
the library you should use to access packages is findlib.
<thelema>
there's two ways to do what you want: 1) through ocaml's "eval" - using the toploop to execute code that's embedded as strings.
<thelema>
or 2) using the dynlink facility, although this will not work for arbitrary opam packages
<foo303>
I prefer the first one too, less prone to the kind of problem I'm having right now. :p
cdidd has quit [Remote host closed the connection]
malc_ has quit [Quit: leaving]
<thelema>
there's of course restrictions on 1) as well, but they're basically that the code you run will be sandboxed, and it'll be tricky to get values out because you'll have to know their type ahead of time.
<thelema>
it'll be possible; it just won't be typesafe.
<thelema>
if you get the type wrong, your program will probbaly segfault.
ontologiae has joined #ocaml
<foo303>
so 1) seems pretty crappy, if there isn't a proper way to have those types beforehand
<thelema>
what do you plan on doing with values of unknown type?
Snark has quit [Quit: Quitte]
<foo303>
I was hoping to have things as I do in, say, java
<foo303>
just have libraries be precompiled and stored somewhere
<foo303>
classpath is set, compile.
<thelema>
need much better reflection than ocaml currently provides to do this.
<foo303>
i.e. things I do outside the program's code
<foo303>
so what's the normal workflow when someone is to decide to use a certain library?
<thelema>
install that library, compile against it
<thelema>
findlib helps with both
<foo303>
install the library using, say, opam, and what use is findlib?
<thelema>
findlib does the actual installation, putting it in the right directory with the right metadata so it can be compiled against
<foo303>
I'll look at the findlib documentation. I just hoped maybe opam should document this since it's so deceptively simple on their frontpage :p
<thelema>
opam does the downloading and building and uses findlib to install
ankit9 has quit [Ping timeout: 246 seconds]
<foo303>
ah okay, so opam finishes up the installation. good
<thelema>
well, most packages use findlib to install; opam just calls on the package to build and install
<foo303>
then I use findlib in my code to get the library loaded?
<thelema>
you can use findlib at compile-time to compile against a library
<thelema>
or you can use it in the toplevel to use a library interactively
<foo303>
right. :) I'll check out both. thanks thelema.
<thelema>
you're welcome
<rwmjones>
still no gildor? has he gone into hiding?
Yoric has quit [Ping timeout: 252 seconds]
ankit9 has joined #ocaml
_andre has quit [Quit: leaving]
<thelema>
rwmjones: I think he's decided not to spend time here.
djcoin has joined #ocaml
ontologiae has quit [Read error: Operation timed out]
Cyanure has quit [Remote host closed the connection]
avsm has joined #ocaml
tac-tics has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.7]
sepp2k1 has quit [Remote host closed the connection]
mcclurmc1 has quit [Read error: Connection reset by peer]
ankit9 has quit [Quit: Leaving]
ontologiae has joined #ocaml
ng__ has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
Jeaye has quit [Remote host closed the connection]
Jeaye has joined #ocaml
trotro has quit [Quit: Leaving]
trotro has joined #ocaml
cdidd has joined #ocaml
ng__ has joined #ocaml
chturne has quit [Quit: Leaving]
Kakadu has quit [Quit: Konversation terminated!]
avsm has joined #ocaml
ng__ has quit [Read error: Operation timed out]
ng__ has joined #ocaml
err404 has quit [Remote host closed the connection]
Zerker has quit [Ping timeout: 255 seconds]
ng__ has quit [Ping timeout: 252 seconds]
Yoric has joined #ocaml
ontologiae has quit [Ping timeout: 252 seconds]
Neros has quit [Read error: Operation timed out]
chambart has joined #ocaml
Neros has joined #ocaml
chturne has joined #ocaml
chturne has quit [Read error: Operation timed out]
Neros has quit [Ping timeout: 265 seconds]
Neros has joined #ocaml
chambart has quit [Ping timeout: 245 seconds]
Neros_ has joined #ocaml
avsm has quit [Quit: Leaving.]
Neros has quit [Ping timeout: 245 seconds]
GnomeStoleMyBike has quit [Ping timeout: 260 seconds]