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)
<jemfinch> that's the theme I want.
<GnuVince> Taaus: Do you know the name of that israeli violinist that's very good and also handicapped?
<GnuVince> MacOS 9?
<jemfinch> yeah, I like that theme.
<Taaus> I don't think so, no... The only Israeli violinist I know is Yehudi Menuhin... Not personally, though ;)
<Taaus> Or is it 'Mehunin'? I forget.
<GnuVince> jemfinch: how about this one: http://gtk.classic.themes.org/php/pic.phtml?src=themes/gtk/shots/979251061.jpg
<GnuVince> Hrmmm
<GnuVince> I'll need to search
<jemfinch> that looks like kde.
<Taaus> My violin is a Stradivarius... Kinda :)
<GnuVince> pfff
<GnuVince> Stratocaster is cooler :)
<GnuVince> (even though it's not the same thing)
<Taaus> I ain't a guitarist ;)
<GnuVince> I was
malc has quit ["no reason"]
<GnuVince> Itzhak Perlman!
<GnuVince> That's the guy
<GnuVince> ever heard that guy play?
<Taaus> I know the name from somewhere... I'm not sure I've heard him play, though :/
<GnuVince> I heard hinm once on TV
<GnuVince> very good
<GnuVince> he played a "caprice"
<GnuVince> And was playing fast like ell
<GnuVince> s/ell/hell
<Taaus> By Paganini, probably.
<GnuVince> I don't know
<GnuVince> I can't remember
<GnuVince> it's been a year since then
<GnuVince> But that guy is really good
<Taaus> Okay.
<GnuVince> You could always try to find a song or two of him on *cough*Napster*cough*Kazaa*cough*
<Taaus> I'm not that into, uh, listening to classical music... I prefer to compose/play it myself :)
<GnuVince> I'm also looking for another violinist
<GnuVince> but i won't ever find her :(
<jemfinch> eh, don't marry another violinist.
<jemfinch> marry a viola player or something -- someone who can complement you, not mimic you or compete with you.
<GnuVince> jemfinch: 1. I'm no violin player
<GnuVince> 2. I don't want to marry her
<jemfinch> my bad :)
<Taaus> LOL, stay as far away from viola players as you possibly can... ;)
<Taaus> (Sorry, musicians in-joke :)
<GnuVince> Heh boy...
<GnuVince> what it must be at school :)
<GnuVince> nyway
<GnuVince> I'll ask you again Taus
jemfinch has quit []
<Taaus> lol
<GnuVince> Asia player
jemfinch has joined #ocaml
<GnuVince> a girl obviously
<GnuVince> she played electric violin
<Taaus> Oh, no... Not her.
<GnuVince> (it was white)
<GnuVince> she looked VERY cute
<GnuVince> she played remixed versions of symphonies
<GnuVince> More modern iif you want
<Taaus> Yeah, I know about her... I can't remember her name, though.
<GnuVince> OK
<GnuVince> Google directory :)
<GnuVince> is this her?
<Taaus> Dunno.
<GnuVince> mkay
<GnuVince> well
<GnuVince> if you remember
<GnuVince> tell me
<Taaus> Hmm.. No, I don't think that's here...
<Taaus> Are you thinking of Vanessa Mae?
<GnuVince> I don't know
<GnuVince> can't remember her nam
<GnuVince> name dis-je
<GnuVince> Yeah!
<GnuVince> That's her!
<Taaus> Neat :)
<GnuVince> OK
<GnuVince> Now the bad part, I can't listen to anything made by her :)
<Taaus> Why not?
<GnuVince> Nothing to download a non-midi sample
<Taaus> :/
<GnuVince> Kza on linux doesn't work anymore
<GnuVince> Napster is dead
<GnuVince> etc.
<Taaus> :/
<GnuVince> hehehe!
* GnuVince is t3h evil!
<GnuVince> :)
<GnuVince> crappy quality
<GnuVince> but who cares?
<GnuVince> Heh!
<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
<GnuVince> speaking of factor
<GnuVince> [vince@vincent: ~/prog/ocaml/factor]% ./factor 10
<GnuVince> 1 and 10
<GnuVince> 2 and 5
<GnuVince> [vince@vincent: ~/prog/ocaml/factor]% ./factor 100
<GnuVince> 1 and 100
<GnuVince> 2 and 50
<MegaWatS> in C you need to ALWAYS put parens around a function's argument
* GnuVince kicks his computer
<MegaWatS> <- brb
<Taaus> What's wrong, Vince?
<GnuVince> of course!
<GnuVince> where's 4 and 25?
<GnuVince> 5 and 20?
<GnuVince> 10 and 10?
<Taaus> Oh...
<Taaus> I thought that output was just a small part of the entire output :)
<GnuVince> OK
<GnuVince> no
<MegaWatS> re
<GnuVince> So I'm writing the program on paper
<Taaus> Heh.
<GnuVince> but since I'm intelligent, I know that I'm using big_int's
<GnuVince> so I will remove all those big_int's things from my paper
<GnuVince> so I will find logic erros more easily
<MegaWatS> hm any idea on when the cracks start to wake up / peek their heads into this channel? :;|
<MegaWatS> hmm btw
<GnuVince> never
<GnuVince> they don,t hang out here
<MegaWatS> :|
<GnuVince> except for jemfinch
<GnuVince> and samx
<MegaWatS> but?
<MegaWatS> btw taeus
<Taaus> Yeah?
<MegaWatS> in that piece of code you posted
<Taaus> I know... There's a bug.
<MegaWatS> shouldnt, after it found a divisior, it then divide the number by that?
<MegaWatS> shouldnt it
<Taaus> lol, yeah.
<MegaWatS> before continuing?
<Taaus> Thanks :)
<MegaWatS> np
<Taaus> Hmm.. In that case, using the square root is really silly...
<Taaus> I'll just check for number==1.
<GnuVince> In a 'if' is the equality operator '=' or '==' ?
<MegaWatS> depends
<MegaWatS> = means structural equality
<MegaWatS> like [1] = [1] is always true because the two lists have the same contents
<MegaWatS> but
<MegaWatS> [1] == [1] is not
<MegaWatS> necessarily
<MegaWatS> only if its the same list, i.e. the poiner points to the same adress
<MegaWatS> for numbers both are the same
<MegaWatS> let rec factorize n =
<MegaWatS> let min = int_of_float (sqrt (float_of_int n)) in
<MegaWatS> let rec fsf k = if k > min then [n] else if n mod k == 0 then k :: factorize (n / k) else fsf (k + 1) in
<MegaWatS> fsf 2;;
<MegaWatS> thats what i just came up with
<MegaWatS> i dunno how good it is
<MegaWatS> but it works ...
<Taaus> I'm going to bed.
<Taaus> 4 am... Buargh...
<MegaWatS> good night
<Taaus> And tomorrow, I'm switching over to SML.. At least I've got books about that...
<MegaWatS> :/
<MegaWatS> well the differences are relatively small :]
<MegaWatS> you just replace val and fun with let :p
<MegaWatS> and ocaml has more features :]
<Taaus> Uhhh, whatever.
<MegaWatS> :(
<Taaus> Somehow, I find it difficult to use a programming language if the syntax keeps getting in my way ;)
<MegaWatS> well the syntax is the same in sml ...
<Taaus> There are differences...
<GnuVince> Oh shit yeah!
<GnuVince> Paper and pen rules!
<GnuVince> I found my bug Taaus :)
<Taaus> Heh, congrats.
<GnuVince> thanks
<GnuVince> I only needed some paper and a pen
<GnuVince> and some patience
<GnuVince> and I realized while simulating
<GnuVince> Wanna know?
<Taaus> Sure.
<GnuVince> ok
<GnuVince> my recursive function call was in my "then" condition (I have no "else")
<GnuVince> so when it did not go into the "then" condition, it exited the function
<GnuVince> and it happened when diviser was 3
<GnuVince> so I movied it out
<GnuVince> and now it works :)
<GnuVince> OK, so you won't talk to me anymore? :-)
<Taaus> Umm... I'm going to bed :)
<GnuVince> Yeah
<GnuVince> What time is it?
<GnuVince> 3:20 AM?
<MegaWatS> let factorize n =
<MegaWatS> let rec tail_fact n sofar =
<MegaWatS> let min = int_of_float(sqrt(float_of_int n)) in
<MegaWatS> let rec fsf k = if k > min then n :: sofar else if n mod k == 0 then tail_fact (n / k) (k :: sofar) else fsf (k + 1)
<MegaWatS> in fsf 2
<MegaWatS> in tail_fact n [];;
<Taaus> 4:20.
<MegaWatS> that should be better
<MegaWatS> sorry couldnt resist :)
<GnuVince> MegaWatS: check this out:
<GnuVince> ./factor 1000000000000000 12.65s user 0.05s system 98% cpu 12.918 total
<Taaus> MegaWatS: Why not check if n=1?
<GnuVince> can you factor one quadrillion?
<Taaus> Instead of sqrt.
graydon has quit []
<MegaWatS> well not without a bignum lib :/
<MegaWatS> or wait
<MegaWatS> int64 should suffice for that
<GnuVince> :)
<GnuVince> Yeah
<GnuVince> But I prefer big_int
<GnuVince> so I'm sure some smart ass won't bug my program
<Taaus> Argh... Bedtime. Now.
<GnuVince> See ya Taus
<GnuVince> talk to you tomorrow
<GnuVince> MegaWatS: do you know the difference between a list and an array?
<MegaWatS> so how many zeroes did your numbe have?
<MegaWatS> works like a charm
<MegaWatS> # factorize_64 (Int64.of_string "1000000000000000");;
<MegaWatS> - : int64 list =
<MegaWatS> ["5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5"; "5";
<MegaWatS> "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"; "2"]
<MegaWatS> GnuVince: an array is just like a C array
<MegaWatS> ie
<MegaWatS> it is a pointer to a table of contiguous memory locations
<MegaWatS> containing your values
<MegaWatS> so you can access its items in constant time
<MegaWatS> and modify (mutate) them
<MegaWatS> a list is like a C linked list
JGibson has joined #ocaml
<MegaWatS> ie
<GnuVince> Oh?
<MegaWatS> struct CONS { int car; struct CONS *cdr; };
<GnuVince> You made your program find indécompsoable (what's that in english?) factors?
<MegaWatS> it just looks for the smallest ones
<MegaWatS> but thats the same thing, so yes
<GnuVince> ok
<GnuVince> mine find pairs
<MegaWatS> btw hi @ JGibson
<MegaWatS> its just 10 lines or so:
<JGibson> hi
<MegaWatS> let factorize_64 n =
<MegaWatS> let ( * ) = Int64.mul
<MegaWatS> and ( + ) = Int64.add
<MegaWatS> and ( - ) = Int64.sub
<MegaWatS> and ( / ) = Int64.div
<MegaWatS> and ( mod ) = Int64.rem
<MegaWatS> in
<MegaWatS> let rec tail_fact n sofar =
<MegaWatS> let min = Int64.of_float (sqrt (Int64.to_float n)) in
<MegaWatS> let rec fsf k = if k > min then n :: sofar else if n mod k = Int64.zero then tail_fact (n / k) (k :: sofar) else fsf (Int64.succ k)
<MegaWatS> in fsf (Int64.succ Int64.one)
<MegaWatS> in tail_fact n [];;
<MegaWatS> could prolly still be made faster
<GnuVince> hi JGibson
<GnuVince> Slept well?
<MegaWatS> but for the quadrillion or what that was in the bytecode interpreter it took no noticable time
<MegaWatS> would prolly get pretty slow on numbers with large factors though :/
<MegaWatS> JGibson: are you an ocaml expert?
<GnuVince> MegaWatS: you should go in France
<GnuVince> lots of O'Caml classes there
<GnuVince> and you'll find Jérôme Vouillon
<MegaWatS> heh im pretty happy with using ocaml in my spare time
<MegaWatS> so i can learn it at my own speed :]
<GnuVince> MegaWatS: heh
<GnuVince> I wish I was good with O'Caml like Jérome Vouillon
<MegaWatS> for a number with a large prime factor my routine took about 14 seconds :/
<GnuVince> MegaWatS: what was the number?
<MegaWatS> 7894367893475894
<JGibson> GnuVince: yea, i've been asleep ever since we talked last! hehe
<JGibson> MegaWatS: not by a long shot
<GnuVince> JGibson: !!
<GnuVince> almost 22 hours!
<JGibson> i was joking
<JGibson> i just got back from work
<GnuVince> mkay
<GnuVince> Where do you work
<GnuVince> ?
* GnuVince prepares anti-IRS bat
<GnuVince> and MegaWatS, your algorithm is more efficient than mine
<GnuVince> it's been more than one minute now
<MegaWatS> mine currently hangs
<GnuVince> !!
<MegaWatS> i dont know whats up
<MegaWatS> i just wanted to time it exactly :/
<GnuVince> But I am guessing that big_int's are longer to process
<JGibson> i work at an isp
<GnuVince> JGibson: you are forgiven
<GnuVince> unless you work for the ISP of where I work
<GnuVince> they get hacked monthly
<JGibson> hehe nah, we've got good security
<GnuVince> Good
<GnuVince> what are your servers running?
<JGibson> i hate the job though :) i need to invent something one of these days and make a boat load of money
<GnuVince> (Don't worry, I'm no script kiddie)
<JGibson> freebsd
<JGibson> haha it's ok
<GnuVince> Good!
<GnuVince> Very good!
<JGibson> yes ;)
<GnuVince> Our ISP uses RedHat 5.2
<GnuVince> on a 2.0 kernel
<JGibson> hehe default install, right?
<GnuVince> No
<JGibson> heh
<GnuVince> they put X Windows
<JGibson> have you guys looked at a profiler for your algorithms?
<MegaWatS> 14.5 seconds in the bytecode interpeter
<MegaWatS> turns out i just didnt know how to use the Unix library ...
<GnuVince> MegaWatS: why the Unix library?
<MegaWatS> for gettimeofday
<MegaWatS> to time the call
<GnuVince> oh
<MegaWatS> heres the line i used:
<GnuVince> I use time
<GnuVince> time ./factor 10
<MegaWatS> let n = Int64.of_string "7894367893475894" in time_call Unix.gettimeofday (fun () -> factorize_64 n);;
<MegaWatS> well im a windows weeny :)
<GnuVince> Heh
<JGibson> use cygwin hehe
<GnuVince> As long as you pay for your software, I'm ok with that
<GnuVince> I don't like "I warez th4 planet" guys
<MegaWatS> well ocaml is free, and windows came with the computer so o_O
<JGibson> yea. but you figure, they don't really hurt the companies unless they're using it for a business or something
<JGibson> if anything, they're helping the company by training themselves in their software
<MegaWatS> depends on the software i think
<MegaWatS> but oh please come on now dont let this deteriorate into a warez discussion :/
<JGibson> but! but!
<GnuVince> yeah
<GnuVince> back to O'Caml
<MegaWatS> ^^
<GnuVince> Should we say O'Caml or OCaml when abbreviating?
<MegaWatS> jgibson so you dont think you could maybe help me with my ... little problem with ocaml's float arrays?
<MegaWatS> hm i think thats answered in the faq
<JGibson> MegaWatS: i doubt it.
<MegaWatS> it says OCaml everywhere that im aware of
<MegaWatS> :/
<MegaWatS> why is no one here who can?
<MegaWatS> i mean .. this is the ocaml channel isnt it :p
<JGibson> because it's irc, and the people who know more have better things to do
<MegaWatS> :]
<MegaWatS> well then i will probably justr have to post it to fa.caml or something :|
<JGibson> i didn't catch everything you were trying to do. is it just that a float array is slow or something?
<MegaWatS> but i dont udnerstand all that irc hating ... irc > all :]
<JGibson> yea, irc is great
<MegaWatS> my question is about how i can use them from c functions
<MegaWatS> ie if they are compatible with C double * arrays
<MegaWatS> ie
<MegaWatS> if i can just do things like
<MegaWatS> double *soandso = &Double_field(arr, 0);
<MegaWatS> soandso[0] = 1.0;
<MegaWatS> memcpy(&soandso[10], &soandso[20], sizeof(double) * 10);
<MegaWatS> and so on
<MegaWatS> because then
<MegaWatS> i could just pass them on to opengl primitives like glVertex3dv
<JGibson> i'll look in the ocaml book
<MegaWatS> double *arr;
<MegaWatS> arr = &Double_field(arr, 0);
<MegaWatS> glVertex3dv(arr);
<MegaWatS> without needing to use Bigarray's and/or copying
<MegaWatS> also for bigarrays of floats and doubles the same question applies
<JGibson> there's a whole chapter on c interoperability, so gimme a little time here and i'll look through it
<GnuVince> Hrmmm
<MegaWatS> thanks a lot :D
<MegaWatS> that ocaml book is supposed to come out in english kinda soon too, isnt it?
<GnuVince> converting a string to int64 is: let n = Int64.of_string "2382791" in
<GnuVince> right?
<MegaWatS> yep
<MegaWatS> Int64.of_string : string -> int64
<GnuVince> Hrmmm
<GnuVince> Then my error must be somewhere else...
<MegaWatS> what doesnt work?
<GnuVince> File "factor2.ml", line 22, characters 15-16:
<GnuVince> This expression has type int64 but is here used with type
<GnuVince> (int64 -> int64 -> int64) -> int64 -> int64
<GnuVince> get_factors n sqroot one
<GnuVince> this is line 22
<GnuVince> 15-16 is 'n'
<MegaWatS> care to paste the whole function?
<MegaWatS> i cant say just like this :/
<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)]
<wazze> ??? :||||
wazze is now known as MegaWatS
<MegaWatS> btw
<MegaWatS> yeah it just does a
<MegaWatS> *(double *)(value *)((double *)(v) + (i))
<MegaWatS> so i can just use the value as a double * pointer and it should work
<JGibson> ah
<MegaWatS> or in a more portable way, do
<MegaWatS> &Double_field(v, 0)
<MegaWatS> btw gnu ill close the query window now if you dont mind - i already have way to many windows open here in irc already :)
<MegaWatS> and your question is answered now, or is it? :|
<MegaWatS> :[
<MegaWatS> btw
<MegaWatS> yeah ! :D
<MegaWatS> my stub code generator now supports double arrays :]
samx has joined #ocaml
<MegaWatS> hi @ samx
<JGibson> great
GnuVince is now known as GnuVince|AwAy
<samx> hi
samx2 has joined #ocaml
samx has quit [Read error: 110 (Connection timed out)]
samx2 has quit [Remote closed the connection]
<MegaWatS> bye
MegaWatS has left #ocaml []
<jemfinch> .
JGibson_ has joined #ocaml
MegaWatS has joined #ocaml
<MegaWatS> rehi
JGibson has quit [Read error: 113 (No route to host)]
MegaWatS has quit ["oyasumi nasai"]
__DL__ has joined #ocaml
JGibson__ has joined #ocaml
JGibson_ has quit [Read error: 110 (Connection timed out)]
malc has joined #ocaml
malc has quit ["no reason"]
MegaWatS has joined #ocaml
<MegaWatS> rehi
<Taaus> Hey, hey.
<MegaWatS> ^^
<Taaus> I wish there was an O'Caml lexer in SciTE :/
<MegaWatS> ?
<MegaWatS> SciTE = ?
<Taaus> You use O'Caml on a Windows machine, right?
<MegaWatS> yes
<Taaus> SciTE is an excellent editor.
<Taaus> Open Source..
<MegaWatS> oh
<MegaWatS> you mean a syntax highlighting scheme ...
<MegaWatS> or editing mode
<MegaWatS> or something like that
<Taaus> Yeah.
<Taaus> It's called a lexer in SciTE.
<MegaWatS> ic
<Taaus> What editor do you use?
<MegaWatS> vim
<Taaus> Ah.
<MegaWatS> vim has a nice ocaml editing mode :)
<Taaus> Yeah, but I'm quite opposed to everything Vi/Vim...
<MegaWatS> :/
* MegaWatS slaps Taaus around a bit with a large trout
<MegaWatS> :p
<Taaus> I'm not too fond of the Emacs OS either ;)
<MegaWatS> well there are people who use emacs ...
<MegaWatS> yeah
<Taaus> I know...
<MegaWatS> i dont get it either
<MegaWatS> vim is pretty much perfect i think
<MegaWatS> its really slim
<MegaWatS> its basically just the one small executable file
<MegaWatS> the rest is all optional
<MegaWatS> i dont want a huge ide or something like that
<MegaWatS> i just want a text editor
<MegaWatS> just like in the olden days :]
<Taaus> Well, SciTE is completely IDE-less...
<JGibson__> i could never get any of the emacs ml modes to work
<MegaWatS> nonono
<Taaus> I'm not trying to convert you to SciTE ;)
<MegaWatS> for me the olden days were those of hacking together small programs tinkering with vga registers in DOS :)
<MegaWatS> the kind of program / editor im thinking of is just thusly
<MegaWatS> an interface, but a simple intreface, and slim, and most important of all - you fire it up, it comes up quickly etc
<MegaWatS> i mean with emacs - it even takes quite a time to load, on my slow machine at least :/
<Taaus> Heh, I guess those are the requirements I have as well... But I want my interface to be intuitive as well as simple ;)
<MegaWatS> yeah well i think vim is kinda easy to get into actually
<MegaWatS> ahh i just love my new opengl-specific stub code generator :))
<Taaus> Uhh, not from what I've seen... But I don't care, really... I'm sticking with SciTE, coz I use it when I program in AGAST :)
<MegaWatS> !!
<MegaWatS> AGAST
<MegaWatS> then you must REALLY udnerstand me :]]
<Taaus> Yeah?
<Taaus> lol
<MegaWatS> heh
<MegaWatS> i meant that in reference to
<MegaWatS> [18:48:45] <MegaWatS> for me the olden days were those of hacking together small programs tinkering with vga registers in DOS :)
<MegaWatS> i mean
<MegaWatS> that WAS the high time of adventure games right? :>
<Taaus> It was indeed.
<MegaWatS> in my opinion, indy4 hasnt, and also will never be, surpassed so far in greatness X[
<Taaus> Well... I was always partial to Indy 3 :)
<MegaWatS> :)
<MegaWatS> heh to my shame I have to admit i never played that one all the way through :/
<MegaWatS> for me it really started with monkey I :]
<Taaus> Ahh, you're an MI-person...
<MegaWatS> heh i like both
<MegaWatS> but as i said indy4 >> all
<MegaWatS> i mean, the three different paths alone
<Taaus> I played the MI games on the Amiga with one of my friends, but it's so far back I can't remember... :/
<MegaWatS> and then the sidekick ... what was she called again ... sophia
<MegaWatS> :)
<Taaus> I do believe Sam'n'Max is my favourite, though.
<MegaWatS> hmm i didnt like that one ALL that much really
<MegaWatS> i mean it was great and all
<MegaWatS> but imho after indy4 the curve sloped slightly downward again
<MegaWatS> like
<MegaWatS> monkey2 and indy4 were the greatest heights the genre could ever achieve
<MegaWatS> monkey2 just oh so VERY slightly surpassed by indy4
<MegaWatS> and then those that came after, while still being great, still could not compare to the greatness of the ages past
<Taaus> I'm not sure I agree... But it's useless to discuss these things..
<MegaWatS> but maybe im just more nostalgic about monkey2+indy4 :]
mellum has joined #ocaml
<Taaus> Of course, my homepage is down, so I can't show you some pictures from my adventure game :/
* Taaus yells at adventuredeveloper.com
<MegaWatS> lol :)
<JGibson__> heh what a crock, scintilla doesn't come with a pre-built binary for windows
<Taaus> Yes it does.
<JGibson__> where
<Taaus> It's called SciTE.
<Taaus> SciTE is the editor, Scintilla is the, uh, control.
<Taaus> Unless if you were referring to Scintilla in which case I plead ignorance :)
<JGibson__> i was talking about the editor. i still don't see it
<JGibson__> yea that's wehre i am
<JGibson__> i don't see any binary distro
<JGibson__> ah
<JGibson__> they need to make their site easier to navigate
<Taaus> Uhh, I never had any problems navigating the site...
<Taaus> Maybe the problem is elsewhere? (Hint, hint ;)
<Taaus> MegaWatS: http://www.thescoops.co.uk/agastlib/gallery.shtml has a couple of thumbnails from my game... (The Weirdo Arts one :)
<MegaWatS> damn
<MegaWatS> those look pretty good :0
<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)]
<JGibson___> haha yea, my client isnt' very smart
JGibson___ is now known as JGibson
<Taaus> What client do you use?
<JGibson> www.klient.com
<Taaus> Interesting...
<JGibson> it's nice, except for a few bugs
<Taaus> Ah.
<Taaus> My client is a bit... Different ;)