<_JusSx_>
Smerdyakov : i like you. you are really nice.
<Smerdyakov>
I am the nicest of all human beings.
<_JusSx_>
Smerdyakov : u should be black
<Smerdyakov>
OK. I'll get an operation today.
<_JusSx_>
Smerdyakov : tua madre spegne le candele col culo
<_JusSx_>
Smerdyakov : la zoccola di tua madre è una grande puttanaccia che ti ha comcepito con l'ennesimo cazzo di merda che si è ficcata in culo
<_JusSx_>
translate it in the channel
<Smerdyakov>
SYNTAX ERROR
<vect>
hum
<vect>
jussx stop it now
<_JusSx_>
he can't fool me around. ok my english sucks. so what's the prob? he's so stupid he doen't know any italian words
Demitar has quit [Read error: 104 (Connection reset by peer)]
demitar_ has joined #ocaml
Xolution has quit [Read error: 104 (Connection reset by peer)]
_JusSx_ has quit [Client Quit]
lament has joined #ocaml
lament has quit [Client Quit]
Kinners has joined #ocaml
mimosa has quit ["I like core dumps"]
gim has quit ["bonne nuit les petits"]
ayrnieu has quit [Read error: 110 (Connection timed out)]
lus|wazze has quit ["If we don't believe in freedom of expression for people we despise, we don't believe in it at all -- Noam Chomsky"]
brwill is now known as brwill_zzz
ayrnieu has joined #ocaml
jdmarshall has joined #ocaml
Kinners has left #ocaml []
cgxt has joined #ocaml
<cgxt>
hey can someone help me out with making a fibonacci function with continuation passing style in linear time
<cgxt>
i have this so far
<cgxt>
let rec fib n k =
<cgxt>
let rec aux n ka =
<cgxt>
match n with
<cgxt>
| 0 -> ka a
<cgxt>
| _ -> aux sub n 1 (fun y -> plus
cgxt has quit []
jdmarshall has quit ["ChatZilla 0.8.31 [Mozilla rv:1.4/20030624]"]
ayrnieu has quit ["gnome does not please me"]
vegai has joined #ocaml
demitar_ is now known as Demitar
gim has joined #ocaml
mimosa has joined #ocaml
phubuh has joined #ocaml
kjs3|zzZZzzzz has quit [Read error: 104 (Connection reset by peer)]
_JusSx_ has joined #ocaml
<_JusSx_>
wuuru : HI
<wuuru>
_JusSx_: hi :-)
owll has joined #ocaml
<_JusSx_>
wuuru : why did u say "One more poor guy"?
owll has left #ocaml []
<wuuru>
one more american joined :-)
<_JusSx_>
i think you was saying to me
<wuuru>
no :-)
<_JusSx_>
i know i told stuping thing
<_JusSx_>
but i don't like to be fooled arounf for my english
<_JusSx_>
of if i make mistakes by typing on keyboard
<wuuru>
:-)
<_JusSx_>
wuuru : do u use a email antispammer?
<wuuru>
not yet
<wuuru>
but I looked at ocamoracle
<_JusSx_>
do u use mldonkey?
<wuuru>
no :-)
<wuuru>
I use ftp :-)
<_JusSx_>
so how do u download porn?
<wuuru>
HTTP/NNTP, if any :-)
<_JusSx_>
ok
buggs has joined #ocaml
<carm>
anyone know why the module specifics for Arg in the ocaml manual != module specifications of arg.ml for ocaml 3.07? Specifically, the spec type is missing Set_string of string ref, Set_float of float ref and Set_int of int ref...
<wuuru>
carm: 'Changes' should now, there is a note on Set_string for 3.07 there :-)
<carm>
wuuru: thanks, will take a look at the note
<carm>
hmm I might have 3.06 anyway, I currently have no idea how to check the version, but I do have the 3.06 source tree
<carm>
oops, it appears that 3.07 has Set_string, but I had 3.06, which did not. my own error.
<carm>
well I give up, cameleon is just not compilin
<Demitar>
I even got cameleon compiled on w2k once. :)
thomas__ has joined #ocaml
<thomas__>
hi,how whould you implement something like widgets (different types,buttons,windows...) without using the O in OCaML? ;)
<thomas__>
i thought of a union type and many match .. with expressions,or of a record with closures
<Demitar>
thomas__, use an abstract type.
<Demitar>
And in the case of implementing a widget set I must first as you why? :)
<thomas__>
it was only an example
<thomas__>
abstract type? wow i read that somewhere in connection with modules ;-)
<thomas__>
i want to do something in (o)caml
<Demitar>
thomas__, yes, an abstract type is a type where the module interface only exports it's name but not it's definition.
<thomas__>
Demitar: and how whould i do something like methods?
<Demitar>
How do you mean?
<Demitar>
Operating on that type?
<thomas__>
i mean polymorphism
<Demitar>
Do you want inheritance?
<Demitar>
Or what are you seeking?
<thomas__>
e.g. i have a list of widgets,where every widget can be a window or a button or a textfield...and i want to draw all widgets in the list,what whould i do?
<thomas__>
(it's an classical example for abstract base classes and inheritence,yes)
<thomas__>
but i wanted to do it without OCaML's object system
<Demitar>
Perhaps, let draw_list lst = List.iter (fun widget -> match widget with Button b -> draw_button b | Window w -> draw_window) lst, would be one example.
<Demitar>
But if you want virtual functions you should probably use objects.
<Demitar>
modules and classes really extend things along different vectors.
<thomas__>
or perhaps List.iter (fun widget -> widget.draw ()) lst;; ? with type widget={draw:unit->unit} ?
<Riastradh>
Why don't you want to use the object system? (aside from the fact that it sucks)
<thomas__>
Riastradh: i used such message dispatch object systems a long time in several programming languages (mainly C++) i wanted something different
<Smerdyakov>
The object system doesn't suck.
<Smerdyakov>
It's just rarely applicable.
<thomas__>
i came on ML and LISP, OCaML can create amd64 binaries so i've choosen it first ;-)
<Smerdyakov>
No one capitalizes it OCaML.
<Riastradh>
Or LISP.
<Smerdyakov>
Some use OCAML, some use OCaml, some use O'Caml, no one says OCaML.
<mattam>
the autorithative syntax (from the website) is OCaml
<phubuh>
I believe you were just proven wrong, Smerdyakov
<thomas__>
damn case sensitive chats ;-)
<Riastradh>
mattam, ocaml.org uses 'OCaml,' 'O'Caml,' 'Ocaml,' and 'Objective Caml.'
<mattam>
but the real source is caml.inria.fr
<mattam>
the naming scheme is very consistent there btw
buggs is now known as buggs|afk
malc has joined #ocaml
thomas__1 has joined #ocaml
thomas__1 has quit [Client Quit]
thomas__ has quit [Read error: 60 (Operation timed out)]
karryall has joined #ocaml
malc has quit [tolkien.freenode.net irc.freenode.net]
Demitar has quit [tolkien.freenode.net irc.freenode.net]
Hadaka has quit [tolkien.freenode.net irc.freenode.net]
mattam has quit [tolkien.freenode.net irc.freenode.net]
mellum has quit [tolkien.freenode.net irc.freenode.net]
Maddas has quit [tolkien.freenode.net irc.freenode.net]
async has quit [tolkien.freenode.net irc.freenode.net]
cm has quit [tolkien.freenode.net irc.freenode.net]
malc has joined #ocaml
cm has joined #ocaml
lus|wazze has joined #ocaml
Hadaka has joined #ocaml
async has joined #ocaml
mattam has joined #ocaml
Maddas has joined #ocaml
jrosdahl has joined #ocaml
mellum has joined #ocaml
Demitar has joined #ocaml
malc has quit ["no reason"]
mattam has quit [Read error: 110 (Connection timed out)]
mattam has joined #ocaml
_JusSx__ has joined #ocaml
ayrnieu has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
ayrnieu has quit [Client Quit]
ayrnieu has joined #ocaml
_JusSx__ is now known as _JusSx_
systems has joined #ocaml
brwill_zzz is now known as brwill
systems has quit ["Client Exiting"]
<Hadaka>
hrm
<Hadaka>
a simple question
<Hadaka>
I have a list, how do I remove the nth element from it
<Hadaka>
obviously producing a new list without that element
<mellum>
sounds like homework :)
<Riastradh>
Well, what do you do if N is 0?
<Hadaka>
it isn't
<Hadaka>
I can trivially write a recursive function to do it
<Hadaka>
but I'm looking for a library solution
buggs|afk is now known as buggs
<mellum>
I don't think there's one
<Hadaka>
if we have List.nth, why don't we have List.remove_nth?
<Hadaka>
whimper
<mellum>
It's not such a frequently used operation, I guess
<Hadaka>
sounds odd for it not to be
<mellum>
After all, if you need it, you are probably using the wrong data structure anyway
<Hadaka>
well, in a way I am, but for the simple reason of verifying equal functionality with another, more complex, data structure
<Hadaka>
hrm, I need a two-dimensional array
<Hadaka>
I wonder if I need to pick up some matrix library somewhere or just use an array and handle the indexes myself or if there's something trivial I can use
buggs has quit ["maybe it crashed"]
<whee>
I think the trivial thing to use would be Array.make_matrix
<Hadaka>
hmh, right, indeed
buggs has joined #ocaml
<Hadaka>
though I have no reason for it to be an array of arrays, just an array I index with a.(y*dimy+x)
<whee>
well, syntactically it would be easier to handle an array of arrays
<Demitar>
Hadaka, I think the reason List.remove_nth isn't very common is because you almost always want to do List.filter instead.
<Hadaka>
Demitar: perhaps - in my case it wouldn't have helped at all though - unless putting the index into a refrence and incrementing it on every evaluation and then returning false once would be called "helping"
<whee>
I always tend to look at the list library provided by haskell (ghc specifically) when I need to do list manipulations; if it's not covered by what's there, then I'm probably looking at it wrong
<Demitar>
Hadaka, since a recursive function would be trivial why don't you make one and consider it to be a library function. ;-)
<whee>
ocaml's list library is pretty bare compared to haskell's
<Hadaka>
Demitar: already did
<Hadaka>
hmh, since I'm a caml newbie, do you have some comments on this?
<Hadaka>
let rec remove_nth l n =
<Hadaka>
match l with
<Hadaka>
| [] -> raise (Failure "remove_nth")
<Hadaka>
| h :: t -> if n = 0 then t else h :: remove_nth t (n - 1);;
<whee>
I think I agree with Demitar here in that what you probably want to use is filter
<phubuh>
that'll take a lot of stack memory, it'd be better if you kept the current list on the stack and made it tail recursive ... do you know about tail recursion?
<Hadaka>
yeah, but hmm
<Demitar>
But I'll have to agree that sometimes the standard lib feels a bit bar. :)
<Hadaka>
I do have to generate new list elements for every element before the 'nth', so I'm not sure how I should do it then
<Demitar>
(Not that it generally matters though since it's so easy to create neat new functions. :)
<Hadaka>
ah! I think I got what you meant phubuh
<Hadaka>
let's see
<Hadaka>
gah, it would mean yet another function :(
<phubuh>
yeah, you generally define it inside the other function, named something like aux or loop
<Hadaka>
erm, now I lost it again - how do I keep the beginning of the list on the stack if I don't know yet what the rest of it will be? or would i need to reverse the direction of traversal in that, eg. from end to beginning?
buggs has quit [Remote closed the connection]
<Hadaka>
hrm, honestly, short of making it non-functional, I'm not sure how I should make it tail recursive
<phubuh>
let remove_nth lst n =
<phubuh>
let rec loop acc i = function
<phubuh>
| [] -> acc
<phubuh>
| x::xs when i = n -> loop acc (i + 1) xs
<phubuh>
| x::xs -> loop (x :: acc) (i + 1) xs
<phubuh>
in List.rev (loop [] 0 lst)
<phubuh>
is one way
<Hadaka>
hmmh
<Hadaka>
ah yes
<Hadaka>
building it the other way, and then reversing it
<Smerdyakov>
Replacing a non-tail recursive function with one that keeps an accumulator of size proportional to the call depth for the old function shouldn't be much of a win.
<Smerdyakov>
But I guess it is with silly fixed size stacks in OS's today.
<Hadaka>
Smerdyakov: indeed
<Smerdyakov>
It's sure not worth doing if you can bound the call depth, though.
<Hadaka>
well, I won't go breaking up this implementation just because of that since I won't be removing elements from lists larger than 100 elements
<Hadaka>
if it were a library function, then things could be different
<wuuru>
here is the tail-recursive version
<wuuru>
let remove_nth l n n_acc h_acc =
<wuuru>
let rec remove_nth l n n_acc h_acc =
<wuuru>
match l with
<wuuru>
[] -> List.rev h_acc
<wuuru>
| h::t when n_acc = n -> remove_nth t n (n_acc+1) h_acc
<wuuru>
| h::t -> remove_nth t n (n_acc+1) (h::h_acc)
<wuuru>
in remove_nth l n 1 []
<wuuru>
still with List.rev, and that sucks :-)
<wuuru>
ah :-)
<Hadaka>
:)
<wuuru>
the same is above :-)
<Hadaka>
about yeah
<Hadaka>
but I'll fix mine up a bit since you showed me the leet usages of the 'when' part ;)
<Smerdyakov>
Maybe that's how you do things in Italia, but this is the civilized world!!
<_JusSx_>
Smerdyakov we are like mexican, greeks, bulgarians ;)
<_JusSx_>
we do it better because we aren't americans
<_JusSx_>
we knoe how to fuck but not to make war
<Hadaka>
hmh, tuareg mode indents them the same, regardless if it has that sign or not :)
<Smerdyakov>
Didn't the Italian government vote to support war recently? :)
<Hadaka>
hmmh
<Smerdyakov>
Hadaka, with or without, you have the same meaning.
<_JusSx_>
we can't make war
<Smerdyakov>
_JusSx_, but you can say "OK, America, go ahead. We're behind you all the way!"
<_JusSx_>
we help american soldier by cooking
<Hadaka>
I'll try one thing though...
<_JusSx_>
yyeah Smerdyakov ; you have understood
<wuuru>
Smerdyakov: and you say "We will make war" and make it :-)
<vegai>
war is bad, mmkay?
<Smerdyakov>
wuuru, not really. I don't say it. They do it anyway. Go figure.
<_JusSx_>
Smerdyakov : why don't u die for your country?
<_JusSx_>
it will be beatiful for your country, for you, and for me
<wuuru>
:-) :-)
<Smerdyakov>
_JusSx_, I'll see if I can pencil that into my busy schedule.
<_JusSx_>
lol
<Hadaka>
how do you like this?
<_JusSx_>
stick your pencil in your ass and smell it. that's the fear smell
<Hadaka>
let remove_nth l n =
<Hadaka>
let rec loop acc n = function
<Hadaka>
| [] -> raise (Failure "remove_nth")
<Hadaka>
| _ :: t when n = 0 -> List.rev_append acc t
<Hadaka>
| h :: t -> loop (h :: acc) (n - 1) t in
<Hadaka>
loop [] n l;;
<_JusSx_>
Smerdyakov you are so busy you have time to say many bullshits
<_JusSx_>
why?
<Smerdyakov>
Because I'm a graduate student. It's my job to say many bullshits.
<_JusSx_>
loooooooool
<Smerdyakov>
I probably don't say as many bullshits as Umberto Eco, though. He's pretty much the king of that pursuit.
<_JusSx_>
USA is great country. even a shit like you can be graduate
<Hadaka>
the rev_append is tail recursive, does the reversion - and the rest of the list doesn't even need to be changed since it can be used as is
<Smerdyakov>
I think this is going too far. _JusSx_, I've just been joking in everything bad I've said to you, except that it would be nice if you could improve your English.
<_JusSx_>
am i improved my english too much?
* whee
finds this entertaining
<Smerdyakov>
You've improved it some, but definitely not "too much"! :D
<_JusSx_>
so i can go on
<Smerdyakov>
You can go quite far on.
* Hadaka
sulks since no-one finds my version of the function interesting.
<wuuru>
Hadaka: looks like it would be better to do 'rev' once rather than every time loop is called :-)
<_JusSx_>
lol Hadaka : you re right
<_JusSx_>
Hadaka : sorry
<Smerdyakov>
Hadaka, what are we supposed to find interesting about it?
<Hadaka>
okay, if someone didn't get it, I was being humorous with that comment
<Smerdyakov>
Hadaka, maybe someone didn't get it. Let's take a poll to see who didn't get it.
<Hadaka>
wuuru: isn't the reversion done only at the end
<wuuru>
yes
<wuuru>
ah, really
<Hadaka>
well, pondering about this simple issue did teach me a couple points about ocaml again, and how to do the functions properly
<Hadaka>
thanks everyone
<Smerdyakov>
Nooooo problem, Hadaka!
_JusSx_ has quit ["BitchX Lite I said!"]
<Demitar>
Smerdyakov, for the poll, I didn't get it.
<Demitar>
(Well if it's free I didn't get it atleast.)