jemfinch` changed the topic of #ocaml to: nob: it's not an option keyword. It's a datatype. 'a option. It can be either "None" or "Some data" -- it represents either data that's not there (None) or data that's there (Some data)
jemfinch has quit []
jemfinch has joined #ocaml
<Taaus>
wb jemfinch
<Taaus>
:)
<GnuVince>
Jeremy "I disconnect a lot" Fincher ;-)
<jemfinch>
one of my servers was down earlier today.
<jemfinch>
and I'm too lazy to reconnect manually, so I just restart xchat :)
<Taaus>
Is it possible to trace a function that's nested inside another function?
<jemfinch>
with a debugger?
<Taaus>
In the toplevel loop.
<jemfinch>
you can trace functions in the toplevel loop?
<Taaus>
Yeah.
<Taaus>
#trace funcname;;
<jemfinch>
how?
<jemfinch>
ah, there it is.
<Taaus>
But it doesn't seem to trace nested functions :(
jemfinch has quit [Remote closed the connection]
jemfinch has joined #ocaml
<Taaus>
wb
<Taaus>
Again :)
<GnuVince>
jemfinch: you should do something about that
<jemfinch>
GnuVince: I'm reconfiguring X, yo.
<GnuVince>
Oh
<GnuVince>
Yo
<GnuVince>
Yeah man
<GnuVince>
Yeah man! Yo yo pout pout yeah yeah ma-ma-man yo pou-pout pout pout!
* Taaus
backs away from GnuVince
<Taaus>
Uhhh.
<GnuVince>
I'm rapping y'know?
<jemfinch>
haskell is nearly tempting too.
<Taaus>
jemfinch: Join the LOTY project... ;)
<jemfinch>
nah...it was started by Ruby folks.
<GnuVince>
*sigh*
<jemfinch>
(that says enough about the leadership there :-P)
<GnuVince>
You REALLY have something against Ruby
<jemfinch>
GnuVince: yes, I do :)
<GnuVince>
like you had something against Python a year ago
<GnuVince>
etc.
<jemfinch>
no, there's a significant difference.
<jemfinch>
(and it was about 1.5 years ago)
<jemfinch>
back when I complained about python, I knew 2 languages: Perl, and C.
<jemfinch>
now, I know (and can write code in without a second thought) C, Perl, Python, and O'Caml, and "know" (as in, could write code *almost* immediately with a good reference) Lisp, Scheme, SML, Ruby, and several others.
<GnuVince>
But how does the fact that these people made a Ruby affect your decision to check them out?
<GnuVince>
Ruby book dis-je
<jemfinch>
I checked them out.
<GnuVince>
and what's wrong?
<jemfinch>
well, it was started by Ruby programmers, for one.
<jemfinch>
for two, I don't really need it -- I can learn Haskell without LOTY just as easily as with it.
jemfinch has quit []
<GnuVince>
But so what if they are Ruby programmers?
jemfinch has joined #ocaml
<GnuVince>
But so what if they are Ruby programmers?
<jemfinch>
it says something about their judgment :)
<GnuVince>
Well, in my mind, it says something about your ability (or lack thereof) to judge people
<Taaus>
I'd have to agree... 'Don't judge the book by its cover', etc. :)
<Taaus>
the -> a
<jemfinch>
Taaus: there you go correcting mistakes most non-native speakers of english wouldn't correct :)
<Taaus>
Hehe :)
<Taaus>
You forget I am a native speaker... Well, kinda, anyway ;)
<jemfinch>
oh, you are?
<jemfinch>
I thought you spoke Dutch natively.
<GnuVince>
?
<GnuVince>
English is the official language of Denmark?
<Taaus>
Well, not really, but I've been to England so many times I speak it fluently... I'm not native, though... ;)
<Taaus>
GnuVince: No, hence the 'kinda' :)
<Taaus>
jemfinch: Dutch? Grrrr..
<jemfinch>
my bad :)
<GnuVince>
Yeah
<GnuVince>
Why does it have to be this way?!
<jemfinch>
ugh. I need a good gtk theme.
<GnuVince>
jemfinch: does gtk.themes.org work?
<jemfinch>
not well.
<GnuVince>
or gtk.classic.themes.org?
<jemfinch>
unfortunately, the theme I love crashes my server.
<GnuVince>
Email the maintainer
<GnuVince>
threaten him
<Taaus>
Make your own theme! ;)
<GnuVince>
say you will sue (link to Bernard Shiffman if you must)
<Taaus>
I don't like her interpretations of good classical music..
<Taaus>
I much prefer Jacques Loussier.
<GnuVince>
...
<GnuVince>
I haven,t heard a song yet where she truely "capotes"
<Taaus>
Heh.
<Taaus>
Argh... She's completely slaughtered 'Classical Gas' by Synergy...
<GnuVince>
I am thinking that electric guitar sounds bettter than electric violin
<Taaus>
I quite agree.
<GnuVince>
I'm listening to "Summer Song" by Joe Satriani
<GnuVince>
and damn he can make that guitar sing!
<Taaus>
So... What's your next O'Caml project, GnuVince? :)
<GnuVince>
Taaus: probably a factorization one
<Taaus>
Ahh, a classic :)
<GnuVince>
Yeah
<GnuVince>
I've done that program in more language than I can count
<Taaus>
And an obvious choice for recursion, I think.
<GnuVince>
(this means 7)
<Taaus>
lol
<GnuVince>
hum
<GnuVince>
no factorial
<GnuVince>
factorization
<Taaus>
Um... Yeah, factorisation.
<GnuVince>
ah ok
<GnuVince>
Some people mistake both sometimes
<Taaus>
Ah.
<GnuVince>
Yeah
<GnuVince>
I'll do that after my shower.
<Taaus>
Neat :)
<GnuVince>
yeah, I'll be neat and clean
<GnuVince>
(and mostly naked too...)
<Taaus>
Heh.
MegaWatS has joined #ocaml
<MegaWatS>
hello
<Taaus>
Hey.
<MegaWatS>
ahh someones here :]
<MegaWatS>
I have a question about ocaml's float arrays ...
<Taaus>
Umm.. Okay...
<MegaWatS>
well do you have time?
<MegaWatS>
and do you think you could maybe answer it?
<Taaus>
Yes, but I'm fairly new to O'Caml, so I may not be able to help...
<MegaWatS>
ah ic
<MegaWatS>
well im kinda new to the functional word at all :]
<MegaWatS>
but ocaml won my heart :0
<Taaus>
Ah.
<Taaus>
:)
<MegaWatS>
now im trying to do some opengl coding in it
<MegaWatS>
but I kinda didnt like the labltk bindings
<MegaWatS>
especially because they need tcl / tk
<MegaWatS>
so im writing my own opengl stub stuff
<Taaus>
Okay...
<MegaWatS>
and now my stub generator program that ive written especially for that purpose is done so far that it works fine
<MegaWatS>
now my problem is
<MegaWatS>
many opengl primitves take arrays of floats or doubles
<MegaWatS>
now with floats as i see it im stuck with Bigarray's
<MegaWatS>
but the standard ocaml float array type
<MegaWatS>
is iirc simply an array of packed double's
<MegaWatS>
is that right?
<MegaWatS>
ie
<MegaWatS>
can I, for example, do something like
<Taaus>
Out of my league... Sorry. :/
<MegaWatS>
:|
<MegaWatS>
thanks anyway for listening to my ramblings :)
<Taaus>
Hey, anytime :)
<MegaWatS>
hmm
<Taaus>
I do the same with GnuVince already ;)
<MegaWatS>
:>
<GnuVince>
Yeah, but I pay!
<Taaus>
Heh.
<MegaWatS>
so do the experts sometimes peak there heads in here? :)
<MegaWatS>
ahh
<MegaWatS>
hi GnuVince
<GnuVince>
Hey Mega
<MegaWatS>
have you read my question? do you think you could answer?
<GnuVince>
I don't think I can
<GnuVince>
I really suck at O'Caml and functionnal programming in general
<MegaWatS>
hm :\
<MegaWatS>
heh :]
<GnuVince>
I seem more like a imperative/OO guy :/
<MegaWatS>
im completely new to it too
<MegaWatS>
i gues sif some of the functional experts would see the source of my stub generator theyd get a heart attack o__O
<MegaWatS>
though I try to learn :]
<GnuVince>
Heh
<GnuVince>
I mean
<GnuVince>
I just understand loops better than recursion
<GnuVince>
I can't visualize recursion in my head
<MegaWatS>
hmmm
<MegaWatS>
well i guess i kinda even over use recursion in my current way im doiung things in caml
<MegaWatS>
but its pretty imperative still
<GnuVince>
Yeah me too
<GnuVince>
It seems more natural in my head
<MegaWatS>
like i go do sandso; and then soandso; and continue on in this imperative way; now; let rec loop accum = ... in loop accum_start; then do soandso
<MegaWatS>
and so on in imperative style only the loops replaced by equivalent let rec ... = ... in ... constructs :)
<MegaWatS>
especially when working with lists this is just what my programs turn out to look like when im not especially paying attention to it o__O
<MegaWatS>
im just more used to thinking of it way of "now it does that, and then, after that, it does this and goes on then to continue with doing that there etc"
<GnuVince>
Taaus: I'm looking at primes.ml, and I'm thinking that it can't be done with a for loop in O'Caml.
<Taaus>
Hmm...?
<Taaus>
I haven't looked at primes.ml... :)
<GnuVince>
of course you did
<GnuVince>
you even gave me a function
<Taaus>
Eh?
<MegaWatS>
hmm
<Taaus>
Umm...
<Taaus>
Is primes.ml the file you made?
<GnuVince>
yes
<MegaWatS>
can i help? :]
<Taaus>
Ahhh.
<GnuVince>
the one with isPrime
<Taaus>
Of course :)
<GnuVince>
unles...
<GnuVince>
hrmmm
<GnuVince>
what's C's "continue" or Ruby's "next" in O'caml&
<MegaWatS>
for loops?
<MegaWatS>
i dont think it exists
<MegaWatS>
but you can easily replace it by recursion i think
<MegaWatS>
except if that is what you wanted to NOT do?
<GnuVince>
well that's the thing
<GnuVince>
I'm trying to do it in an imperative manner
<MegaWatS>
well ocaml's imperative means are relatively limited
<MegaWatS>
you could try with a while loop
<MegaWatS>
and a large if
<MegaWatS>
like while so-and-so do ... if (not-continue) then begin ... end done
<MegaWatS>
nwo that i think about it this would also work with a for loop
<MegaWatS>
why do you want to do it imperatively?
<MegaWatS>
heh tell me if im not of any help ill shut up then :p
<GnuVince>
for fun
<GnuVince>
hrmmm
<GnuVince>
can't be done
<GnuVince>
Oh well
<GnuVince>
Functionnal programming seems to require more thought before actual coding...
<MegaWatS>
it does apparently
<MegaWatS>
well i think its still possible to get along without thinking out things beforehand
<MegaWatS>
it just shows even more obviously in the code you produce then than in imperative languages
<MegaWatS>
^^
<GnuVince>
Yeah
<GnuVince>
Imperative languages can get quite spagetthi
<GnuVince>
I'd say that with O'Caml it's more difficult
<MegaWatS>
heh but ive noticed since i started learning functional programming
<MegaWatS>
that a lot of those pesky functional idioms start creeping into my imperativ language programs even :p
<MegaWatS>
unfortunately that has led to me using goto again in my c programs : but only to imitate a tail-recursive self-call :/
<MegaWatS>
so once in a while things like /* THIS IS A TAIL CALL NOT A GOTO: :[ */ para1 = newval1; ..; paraN = newvalN; goto startoffunc;
<MegaWatS>
now appear in my c programs :0
<GnuVince>
heh boy...
<MegaWatS>
for some kinds of loops it just lends itself TOO well and then i cant resist
<MegaWatS>
especially when going through lists :/
<MegaWatS>
but i most of the time still have the discipline to then afterwards go through the code again and patch it up to re-replace it
<Taaus>
Grrr.. Someone tell me what's wrong with the syntax here:
<Taaus>
let factorise number =
<Taaus>
let rec factor number sqrtnum divisor listofdivisors =
<Taaus>
if (divisor > sqrtnum) then listofdivisors
<Taaus>
else if (number mod divisor == 0) then factor number sqrtnum divisor (divisor::listofdivisors)
<Taaus>
else factor number sqrtnum (divisor+1) listofdivisors
<Taaus>
in factor number int_of_float(sqrt(float_of_int(number))) 2 []
<MegaWatS>
after i SEE how the tail-recursion / loop should work after having done that i often can then again replace it with a loop
<MegaWatS>
you forgot a pair of ( parentheses )
<Taaus>
Where?
<MegaWatS>
application is left-associative
<MegaWatS>
in factor number int_of_float(sqrt(float_of_int(number))) <-- the INNERMOST pair of parens is superflous
<MegaWatS>
but you need to put a pair outside of the int_of_float
<Taaus>
Oh, crud.
<GnuVince>
ARGH!
<MegaWatS>
around factor's second argument
<MegaWatS>
yeah it is kinda annoying at first :/
<MegaWatS>
its just the opposite logic than in C and the like
<JGibson>
MegaWatS: yea, i'm helping with that project actually. i'm doing proof reading and editing
<MegaWatS>
great
<MegaWatS>
because, well, my french isnt very good
<MegaWatS>
its been a long time since ive had it in school :/
<GnuVince>
MegaWatS: I'll do it in private
<GnuVince>
I don,t want to flood
<MegaWatS>
k
<MegaWatS>
but dcc doesnt work for me because of my firewall
<MegaWatS>
so just put it into a query
<GnuVince>
I did :)
<MegaWatS>
ahh
<MegaWatS>
ive just yesterday starteed to use mirc (the new version=multi server support=i can use it again) again
<MegaWatS>
and im not used to it yet again
<MegaWatS>
i have to find the option that it pops up queries right away:/
<JGibson>
it looks like almost all the values that you share between c and ml have to be translated, so i'd imagine that wouldn't be great for something that needs to do that often
<MegaWatS>
:\
<JGibson>
i'm still reading though, so maybe it says more
<MegaWatS>
well i hoped i could use the float array standard type
<MegaWatS>
just directly
<MegaWatS>
because it is packed
<JGibson>
it says it's because the garbage collector needs extra info
<MegaWatS>
well
<MegaWatS>
i do all the gc stuff already
<MegaWatS>
ie
<MegaWatS>
ive got the c/ocaml interface stuff pretty much down
<MegaWatS>
the only thing i dont know is IF i can use float array's directly as double[] in C
<MegaWatS>
or not
<JGibson>
float arrays in ocaml are continuous blocks of 32 bit words. so a double in c will map to that
<JGibson>
so, i believe that if you get a pointer to the beginning of that block, you can treat it as an array
<JGibson>
i haven't seen anything that says if the arrays are layed out the same for more than one dimension though
<JGibson>
you could always give it a try
<MegaWatS>
no for more than one dimension they arent
<MegaWatS>
but i thought float arrays were special
<MegaWatS>
ie
<MegaWatS>
normal arrays in ocaml are simply continous blocks of 32 bit words
<MegaWatS>
but float arrays were directly continous blocks of (64-bit?) float values
<JGibson>
i think you can do what you want. you can probably write to the blocks once you get the offsets right. the conversion functions are mainly macros that put you in the right place, etc
<JGibson>
the online manual has a whole section on this stuff
<MegaWatS>
i know
<MegaWatS>
thats my whole source :)
<MegaWatS>
but there they only talk about using
<MegaWatS>
Double_field(arr, i)
<MegaWatS>
to access float arrays :/
<JGibson>
look at the source for that macro and see if you can side step it
wazze has joined #ocaml
MegaWatS has quit [Read error: 104 (Connection reset by peer)]
<MegaWatS>
you dont happen to be interested in doing some art if i ever decide to do a game .... in caml of course :) ... when im finished with this my opengl wrapper here? :)
<Taaus>
Thanks... My friend (the one with MI) is a great artist :)
<MegaWatS>
they - the leftmost one in particular - look VERY dottish
<Taaus>
Ah, I'm just the programmer... I don't do art ;)
<MegaWatS>
pity :(
<Taaus>
Well, we were aiming for a DOTT/Sam'n'Max look :)
<MegaWatS>
dott was another of my all time favourites
<MegaWatS>
third-most to be exact, immediately after monkey 2 :]
<Taaus>
And our company name pretty much explains everything ;)
<MegaWatS>
damn i love my ogl stubber proggy :)
<MegaWatS>
its just fun simply copying the ogl primitive prototypes, adjusting them a little here and there, and it comes out just *exactly* like i want it to :)
<Taaus>
Kewl.
<MegaWatS>
unsigned string glGetError();
<MegaWatS>
a line from my interface definition
<Taaus>
I've been quite unable to get anything remotely graphical to work with O'Caml under Windows.. (I may have told you already :)
<MegaWatS>
i just like that somehow :>
<MegaWatS>
well i already got some very simple test proggy's working before i started work on this new interface
<MegaWatS>
with some ad-hoc stub routines
<Taaus>
Oh, well.. Must dash.. Dinner :)
MegaWatS has quit ["oyasumi nasai"]
awwaiid has joined #ocaml
malc has joined #ocaml
graydon has joined #ocaml
jynx has joined #ocaml
jynx has left #ocaml []
graydon has quit []
JGibson___ has joined #ocaml
<Taaus>
Geez, JGibson... You just keep on adding '_' to your nickname ;)
JGibson__ has quit [Read error: 110 (Connection timed out)]