monotonom has quit ["Don't talk to those who talk to themselves."]
cjohnson has joined #ocaml
pac_aw has quit ["Lost terminal"]
GreyLensman has quit ["Leaving"]
smimou has quit ["?"]
jdrake has quit [Read error: 110 (Connection timed out)]
yauz has joined #ocaml
Tipsy has joined #ocaml
<Tipsy>
Does OCAML has a cocoa or carbon binding for mac os x?
cjohnson has quit [Read error: 104 (Connection reset by peer)]
cjohnson has joined #ocaml
yauz_ has quit [Read error: 113 (No route to host)]
mij has quit [Read error: 110 (Connection timed out)]
mij has joined #ocaml
mrsolo has quit [Connection reset by peer]
mrsolo has joined #ocaml
Tipsy has left #ocaml []
jdrake has joined #ocaml
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
pac_away has joined #ocaml
<Smerdyakov>
pac_away, you are away.
<jdrake>
should it be 'pec_here'?
<pac_away>
no I am away
pac_away has quit ["leaving"]
jarod has joined #ocaml
<Smerdyakov>
jdrake is here.
<jdrake>
in nick and in mind
<Smerdyakov>
jdrake is a fake #ocaml member.
<jdrake>
i am if you want me to be
<Smerdyakov>
Well, I believe you have continued to avoid using any declarative programming language, despite being here.
kinners has joined #ocaml
<jdrake>
if it is an consolation I just installed ocaml a few hours ago. I am in the midst of figuring out what I want to do, I am a program that needs a short amount of work to integrate something like lua into it, or do something else along the same lines with ocaml, but I don't know if it can be embedded as such.
<kinners>
there's an implementation of lua 2.5 written in ocaml (on www.cminusminus.org)
<jdrake>
i use lua 5.x
<Smerdyakov>
Using Lua Anything is DUMB DUMB DUMB!
<jdrake>
would it be possible for ocaml to be compiled into a loadable library that could then be loaded by my program and 'attach' to a few C functions?
<Smerdyakov>
Why do you want to use OCaml as a library instead of using OCaml as the main language?
<jdrake>
Smerdyakov, because I have already invested a lot of time into the basis for this thing. Please do not continue along with that question.
kinners has quit [bear.freenode.net irc.freenode.net]
mrsolo has quit [bear.freenode.net irc.freenode.net]
Smerdyakov has quit [bear.freenode.net irc.freenode.net]
kosmikus|away has quit [bear.freenode.net irc.freenode.net]
kinners has joined #ocaml
mrsolo has joined #ocaml
Smerdyakov has joined #ocaml
kosmikus|away has joined #ocaml
<Smerdyakov>
jdrake, I don't necessarily view that as a valid reason, but feh on you.
_fab has quit [bear.freenode.net irc.freenode.net]
_fab has joined #ocaml
<jdrake>
i am not asking you to view it as a valid reason. The way ocaml would properly fit into my needs for this particular program would be if its output could be ran in the same process and a loadable library is the only thing I can think of that could do that.
<Smerdyakov>
I have a feeling any existing approaches to that require you to view OCaml as the primary platform, with provisions for communication with C code.
<jdrake>
the only other way would be either sdl or glut bindings, i know of glut bindings, but the preferable sdl bindings I know nothing of.
<Smerdyakov>
jdrake, "bindings" are generally trivial to create, so, even if these two _didn't_ already exist, you wouldn't have much of an excuse.
<Riastradh>
...yes, hacking...
<jdrake>
one last challenge is one of osx, getting an ocaml app to be able to be an app bundle (this is just so mac users could click on it :-) . Hopefully which would be trivial.
<Smerdyakov>
Screw OSX.
<gzl>
do you really need it as a bundle?
<jdrake>
there is a contest (which I may or may not enter) coming up in a few months and that is one requirement.
<jdrake>
Smerdyakov, you can screw osx all you want, but it is what I use
<jdrake>
and if I wanted anyone there to use anything I might make, that would be quite helpful.
cjohnson has quit [Connection timed out]
monotonom has joined #ocaml
kinners has quit [Read error: 110 (Connection timed out)]
async_ has joined #ocaml
mij_ has joined #ocaml
mij has quit [Read error: 110 (Connection timed out)]
Herrchen has joined #ocaml
async has quit [Read error: 110 (Connection timed out)]
Herrchen_ has quit [Read error: 110 (Connection timed out)]
Nutssh has joined #ocaml
mij has joined #ocaml
mij_ has quit [Read error: 110 (Connection timed out)]
<pattern>
# let rec foo = let bar = 1 in if 0 > bar then 1 else 0 ;;
<pattern>
This kind of expression is not allowed as right-hand side of `let rec'
ionOS has joined #ocaml
<Smerdyakov>
pattern, what's the problem?
<pattern>
i don't know why "let bar = 1 in if 0 > bar then 1 else 0" is not allowed there
<Smerdyakov>
It's not the sort of thing you can make recursive, e.g., a function definition.
<pattern>
well, i see similar recursive definitions throughout lots of working example code
<Smerdyakov>
Your example works fine if you remove the 'rec'.
<pattern>
and i don't understand how mine differs
<pattern>
well, i need it to be recursive
<pattern>
not in my snippet there, but in the real code
<Smerdyakov>
How about an example where it actually matters? (As short as possible to get across the idea)
<pattern>
ok
<pattern>
let rec choose = let choice = read_int() in if 0 > choice then choose else choice
<Smerdyakov>
Are you sure you don't mean for 'choose' to be a function?
<pattern>
yeah, i guess i do
<pattern>
:)
<pattern>
i am sooo rusty
<pattern>
this is my first attempt at trying ocaml after probably six months away from it
<pattern>
this is what i get for trying to hack together bits of old code without taking the trouble to fully understand what i'm doing again
<pattern>
well, thanks for your help, smerdyakov
<pattern>
it works now
* Smerdyakov
nods.
dan2 has joined #ocaml
<dan2>
how do I return values
<Smerdyakov>
What?
<dan2>
how do I return the value 1 for a function
<debona|r>
dan2: If I may make a suggestion?
<dan2>
sure
<debona|r>
read the tutorial in the topic
<debona|r>
it provides the answer you seek
<debona|r>
and some other concepts about the language
<dan2>
whats the default extension for ocaml
<monotonom>
source files .ml
<dan2>
hmm
<monotonom>
interface files .mli
<dan2>
is there an emacs mode for ocaml?
<monotonom>
Yes. It comes with ocaml if you poke around
<dan2>
ok
vezenchio has joined #ocaml
Snark has joined #ocaml
Nutssh has quit ["Client exiting"]
<dan2>
monotonom: whats the mode called
<monotonom>
caml-mode
jdrake has quit [Read error: 110 (Connection timed out)]
<dan2>
monotonom: there is no syntax highlighting?!
<monotonom>
Do you know how to use emacs? font-lock-mode
<monotonom>
Um apparently that doesn't work either. Sorry.
<Smerdyakov>
caml-mode has minimal syntax highlighting. Try entering a string literal.
<Smerdyakov>
Or a comment
<monotonom>
haha
<Smerdyakov>
?
mij_ has joined #ocaml
<dan2>
how do I convert a string to an integer
mij has quit [Read error: 110 (Connection timed out)]
seafood_ has quit [Remote closed the connection]
seafood has joined #ocaml
<smkl>
int_of_string
<dan2>
gracias
debona|r has left #ocaml []
monotonom has quit ["Don't talk to those who talk to themselves."]
debona|r has joined #ocaml
mij_ is now known as mijdrol
_fab has quit []
kosmikus|away is now known as kosmikus
buggs^z is now known as buggs
slashvar[home] is now known as slashvar[lri]
<slashvar[lri]>
Yop
karryall has joined #ocaml
smimou has joined #ocaml
mattam has joined #ocaml
_fab has joined #ocaml
fariseo has joined #ocaml
pac_away has joined #ocaml
slashvar[lri] has quit [bear.freenode.net irc.freenode.net]
bk_ has joined #ocaml
slashvar[lri] has joined #ocaml
Naked has joined #ocaml
Hadaka has quit [Read error: 104 (Connection reset by peer)]
Naked is now known as Hadaka
jdrake has joined #ocaml
<jdrake>
"Aaand... in order to distract you from the fact that there's no comic, I will use the incredible cuteness of my cat, Gandalf! You cannot resist the cute! It is overpowering!!" http://www.reallifecomics.com/rantpics/gandalf.jpg
<lambdawar>
lo jdrake
<jdrake>
hello :-)
<jdrake>
trying to get a gl binding compiled, 'ocamlgl' is proving to be a mystery, I was just about to try lablgl
ionOS has quit ["Using KVIrc 3.0.1 'System Virtue'"]
<jlouis>
ronwalf: that sounds a lot like ''code in ocaml instead kind of problem'
<jlouis>
Wouldn't it be possible to write a combinator parser for that?
Snark has quit ["Parti"]
avlondono has joined #ocaml
vezenchio has quit ["With little power comes little responsibility"]
jamessan|work has joined #ocaml
<avlondono>
hello, I have a question
<avlondono>
I need to be able to hold functions of various different kinds, and according to a certain integer value, choose the appropriate one to apply
<Smerdyakov>
You probably want to use a variant type.
<Smerdyakov>
(if "various kinds" means "different types")
<avlondono>
hehe, yes, that's what it means Smerdyakov
<avlondono>
hm .. don't see how .. could you explain a little bit further Smerdyakov ?
<Smerdyakov>
Do you know what variant types are?
<avlondono>
lemme read, it is either that I really don't know, or I didn't explain enought the problem
<avlondono>
I will have to define a type with all the possible function signatures, right? I didn't think about that explicit way to do it.
<avlondono>
eh, sorry for my terms. I am messy with them.
<avlondono>
done, thanks Smerdyakov
<Smerdyakov>
Right.
jamessan|work has left #ocaml []
<avlondono>
I wanted something less explicit, but of course, although faster, I was getting in troubles. I was using C stuff in the middle.
<Smerdyakov>
Why would you want something less explicit, from the standpoint of attempting to develop a correct program?
jdrake has quit [Read error: 60 (Operation timed out)]
<avlondono>
that's why I asked ;)
<avlondono>
this runs in parallel, so the functions are called quite often and all a program has is the tag of the function (an integer). We would like to be able to define at the beginning what functions can be called in parallel, and so to register new tags.
<avlondono>
without much overhead in the process. I will do it this way and will try to figure out some other hack later.
<avlondono>
ie. register parallel function at runtime.
<avlondono>
so it's not very safe already
<TheDracle>
Hm.
<monotonom>
Even the highly dynamic Java has a very strong notion of explicitness.
cm47` has left #ocaml []
cm47 has joined #ocaml
<jlouis>
avlondono: if you have a variant type of functions and you have an integer, can't you just select the correct function once and for all, add it to the function in question and be done with it?
<jlouis>
I am afraid I am too weak at Ocaml notation to even attempt it
* jlouis
is an SML-bastard
<dan2>
does anybody use FrontC here?
<avlondono>
I just didn't want to go through the overhead of matching the function type. I have to use marshal to transmit the information so it's not type safe.
<avlondono>
anyway, I was being a true bastard for doing that to my program in ocaml. I will improve it later if needed.
<jlouis>
avlondono: one single integer test is not going to be your problem hopefully
<jlouis>
if it is, you could probably transpose the program around something else
cjohnson has joined #ocaml
jdrake has joined #ocaml
avlondono has quit ["Lost terminal"]
buggs^z has joined #ocaml
buggs has quit [Read error: 60 (Operation timed out)]
larsr has joined #ocaml
pac_away has joined #ocaml
<ronwalf>
jlouis: Write an RDF parser from scratch in Ocaml? That's quite an undertaking
pac_away is now known as pac_
jdrake has quit ["Leaving"]
<dan2>
how do I find the length of an array
<TheDracle>
Holy crap, it worked...
<dan2>
?
larsr has quit ["User disconnected"]
<TheDracle>
Nothing.
<TheDracle>
Lol.
<TheDracle>
Sorry.
<TheDracle>
Hm, I have a little problem.
<TheDracle>
I know how to initialize members, but how do I initialize the state of an object with Ocaml?
<TheDracle>
Like, I have a socket and I'd like for it to do "connect" upon construction.
<TheDracle>
Right now I have to do something like: method init = connect ssock (ADDR_INET(inet_addr_of_string ip, port));
<TheDracle>
And then call init after mySocket is constructed.
<TheDracle>
Anybody?
<TheDracle>
Hm, does anybody know how to flush to stdout then?
* dan2
wants to know how to find the length of an array
<TheDracle>
Heh.
<TheDracle>
Serious?
<bk_>
Array.length yourarray
<TheDracle>
List.length actually.
<TheDracle>
Right?
<TheDracle>
Wait.
<TheDracle>
He said Array, sorry :p
<Smerdyakov>
TheDracle, I don't know if what you want is possible.
<TheDracle>
Yeah, I suspect that is true.
<TheDracle>
It's not such a big deal, just another function call.
<TheDracle>
Hm, now I'm having some weird namespace conflict error.
<Smerdyakov>
Why are you using OO for this?
<TheDracle>
When I say "Open Unix" it pulls in some global define.
<TheDracle>
Because I don't understand the Ocaml Object system, and I'm trying to learn it through example.
<TheDracle>
For stdout.
<Smerdyakov>
OK. Don't be surprised if you can rarely get help here, because most of us rarely use OO. ;)
<TheDracle>
How do I reference the previous stdout?
<TheDracle>
Yes, I know :)
<Smerdyakov>
The initial bindings are from the Pervasives module.
<TheDracle>
Ah, so just Pervasives.stdout.
<TheDracle>
Heh, sweet :)
<TheDracle>
Yeah, I just wrote a Socket object with an "each_line" method that connects to a server, and then forks every line read from that socket to a provided function.
<TheDracle>
Takes about four lines of code in Ocaml to set up what would take 20 in C++.
<jlouis>
ronwalf: if that is the case, then RDF is too abstract
<smimou>
TheDracle: your method init should be an "initializer" I think
<smimou>
and to flush stdout "flush stdout;" should do :)