<pango_>
(btw I started rereading the book, because I never finished it. Some things are outdated, like the monomorphic constraints examples, that no longer work because of relaxed type system)
dark_light has joined #ocaml
pango_ is now known as pangoafk
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
meng has joined #ocaml
pango_ has joined #ocaml
fab_ has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
<Smerdyakov>
And we can help him in a way where he actually _learns_ something.
<whats_in_a_name>
or any other client
<Smerdyakov>
Then I guess he's out of luck. I'm sure the cheating policy for whatever class this is prohibits having people on IRC solve your programming problems for you.
<meng>
change [] -> [] to [] -> [z], i think
<meng>
im noob too
<Smerdyakov>
...and apparently a "noob" who likes to prevent others from learning.
<meng>
im sorry then
<meng>
i havent been in school for years
bohanlon has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov>
This is independent of "school." You can't learn to program if someone writes your programs for you.
<meng>
hi, pango_
<whats_in_a_name>
neg. sometimes they are just simple oversights
<whats_in_a_name>
a for loop that uses < instead of <= for example
<Smerdyakov>
whats_in_a_name, there are systematic debugging techniques that catch all errors, and I am happy to help people who come here themselves learn to use these techniques.
<whats_in_a_name>
ALL errors?
<whats_in_a_name>
lol
<whats_in_a_name>
you try debugging a corrupted stack frame in a recursive function
Radiohead235 has joined #ocaml
Radiohead235 has quit [Read error: 104 (Connection reset by peer)]
<Smerdyakov>
whats_in_a_name, this is OCaml. No stack frames here.
<Smerdyakov>
whats_in_a_name, systematic verification techniques certainly work poorly in poorly-designed languages like C++ and Java; I agree with you there.
<Smerdyakov>
But they're very easy to apply to OCaml.
bohanlon has joined #ocaml
<whats_in_a_name>
ocaml does not use a run time stack?
<whats_in_a_name>
lol
<whats_in_a_name>
thats pretty strange, if true
<Smerdyakov>
The language semantics has no concept of "memory."
<Smerdyakov>
The implementation may use common techniques, but this need not concern the programmer.
<Smerdyakov>
(I should say that there is no concept of numerically-addressed memory. The semantics of references and arrays can be thought of as involving memories with an abstract address type.)
<whats_in_a_name>
in other words, memory is cleared for you
<whats_in_a_name>
that doesent mean no run time stack is used, you big goof
<Smerdyakov>
No, the language involves no concept of "memory..." just like I said. :)
<Smerdyakov>
OCaml is a language.
<Smerdyakov>
Perhaps you mean to say "the OCaml compiler"?
<whats_in_a_name>
memory management would be part of the standard
<whats_in_a_name>
which the compiler would conform to
<Smerdyakov>
Nope.
<whats_in_a_name>
no?
<Smerdyakov>
OCaml is a high-level language with no concept of memory management in the semantics.
<whats_in_a_name>
well obviously its handled at some level
<Smerdyakov>
But not in the language semantics, so the programmer doesn't need to think about it.
<whats_in_a_name>
if the standard doesent specify how, thats pretty sad
f78 has joined #ocaml
<Smerdyakov>
I disagree. It would be sad to find a high-level language whose definition _does_ mention "stack frames," since that means the programmer has an overcomplicated execution model to worry about.
<whats_in_a_name>
oh noes, garbage collectors for everyone!
<whats_in_a_name>
dont make the programmer think about whats going on underneath
<whats_in_a_name>
lets abstract away all those annoying little details, regardless of the fact its useful to know
<whats_in_a_name>
and understand
<whats_in_a_name>
you would love java i think
<Smerdyakov>
Yes, let's. It's hard to find a knowledgeable programmer today who doesn't agree that this is the right move for most domains.
fab_ has quit [Read error: 110 (Connection timed out)]
<meng>
gc is not everything. if you want a fast program, you have to code it in c
<whats_in_a_name>
or c++
<whats_in_a_name>
just not interepreted crap
fab_ has joined #ocaml
<Smerdyakov>
meng, that is obviously false.
<Smerdyakov>
meng, I've seen several examples of ML programs compiled to faster executables than C programs via GCC.
<Smerdyakov>
And, of course, complex algorithms are easier to implement in ML than C, so if your asymptotically-superior algorithm is too hard to get right in C, then you have no chance against an ML implementation.
<meng>
yes, yes. i like lisp, and start liking ocaml. they are short, concise, like writing a poem :)
<Smerdyakov>
meng, and also much easier to optimize than C programs.
meng has quit []
dark_light has quit [Connection timed out]
f78 has quit [Remote closed the connection]
<youknow365>
anyone still up ?
<TSC>
Yes, you
<youknow365>
i seeeeeee
Smerdyakov has quit ["Leaving"]
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
jewel has joined #ocaml
_velco has joined #ocaml
Carillon has joined #ocaml
Carillon_ has quit [Read error: 110 (Connection timed out)]
Carillon is now known as Carillon_
Snark has joined #ocaml
f78 has joined #ocaml
jewel has quit [Read error: 110 (Connection timed out)]
<youknow365>
hmmmmm
<youknow365>
i still cnt get this try...with to work
<whats_in_a_name>
ocaml rules!
<whats_in_a_name>
not because of the language per se, but because camels rox
<youknow365>
whats_in_a_name: have you used ocaml quite a bit ?
<whats_in_a_name>
no
<whats_in_a_name>
never
<whats_in_a_name>
i just like camels
<pango__>
and trolls
<youknow365>
pango__: man it really takes persistence to learn this ocaml stuff
<whats_in_a_name>
i dont know any functional languages
<whats_in_a_name>
but i doubt it would hard to pick up
<whats_in_a_name>
i know just imperative - java and c++
jewel has joined #ocaml
<youknow365>
whats_in_a_name: instead of flooding the channel why jnot learn
NamelessOne has joined #ocaml
<whats_in_a_name>
i dont want to now
<whats_in_a_name>
im content with the languages i know
pango__ has quit [Remote closed the connection]
<youknow365>
i think i got this try with thing
love-pingoo has joined #ocaml
pango__ has joined #ocaml
<pango__>
whats_in_a_name: don't know what it proves, beside your lack of curiosity
DRMacIver has quit [Read error: 104 (Connection reset by peer)]
pango__ has quit [Client Quit]
smimou has joined #ocaml
DRMacIver has joined #ocaml
gmh33__ has joined #ocaml
pango has joined #ocaml
gmh33_ has quit [Read error: 60 (Operation timed out)]
<pango>
syntax is try expression with exception1 -> handler for exception1 | exception2 -> handler for exception2 | ... | exceptionn -> handler for exceptionn
<youknow365>
pango: could you give me an example for this case ?
<youknow365>
val sock_send : Unix.file_descr -> string -> int = <fun>
<pango>
try connect client_sock (ADDR_INET ((inet_addr_of_string "1.1.1.1"), 4550)) with Unix_error (ETIMEDOUT, _, _) -> prerr_endline "server not ready"
<youknow365>
pango: i was thinking that but it didnt look all to professional ?
<youknow365>
is that a good way of doing it ?
<pango>
what do you mean ?
<youknow365>
i mean i would have thought there would be some way where i could just do it once .....like pull out the ETIMEOUT and from there do a simplt pattern match
<youknow365>
this way i would have to have a full expression for ECONNREFUSED ETIMEOUT etc etc i think theres a few more
<pango>
try connect client_sock (ADDR_INET ((inet_addr_of_string "1.1.1.1"), 4550)) with Unix_error (ETIMEDOUT, _, _) -> prerr_endline "server not ready" | Unix_error (ECONNREFUSED, _, _) -> prerr_endline "I've been told to go away"
<youknow365>
ahhhhh
<youknow365>
i thought i would use && ?
<pango>
try with already does pattern matching, no need for try ... with e -> match e with -> ...
<youknow365>
yea i noticed
<pango>
what would you use && for ?
<youknow365>
i was thinkig && was |
<pango>
no, pattern matching separator is |
<youknow365>
i did not know that
<TSC>
...
<youknow365>
why does the ocaml intepreter spit out val sock_send : Unix.file_descr -> string -> int = <fun>
<pango>
first | after with is optional, personally I like to put one here for indentation consistency
<youknow365>
and it still spit out Exception: Unix.Unix_error (ETIMEDOUT, "connect", "").
<pango>
that's the inferred signature of the function, so you can check it's what you expected
<TSC>
You need to READ all the documentation people have directed you to
<pango>
that's results that are pattern matched, not the expressions ;)
<youknow365>
TSC: its getting late .........i thought i did something different
<youknow365>
also anyone know the default kerrnel timeout ?
<youknow365>
90 or 180 sec right ?
velco has joined #ocaml
<pango>
should your code depend on it ?
<youknow365>
naw
<youknow365>
but i would think a timeout of 20 seconds wuld clearly be more suitable then make the user wait 180 seconds or w/e it waits
<pango>
then I think you should set an alarm, and the connect will be interrupted when the timeout is reached
<youknow365>
#use "tcp.ml";;
<youknow365>
Objective Caml version 3.09.2
<youknow365>
#
<youknow365>
val sock_send : Unix.file_descr -> string -> int = <fun>
<youknow365>
server not ready
<youknow365>
- : unit = ()
<youknow365>
what is that unit thing ?
<youknow365>
i know its a type
<TSC>
...
<youknow365>
TSC: i am just not really understanding how the interpreter feeds back info on type etc
<TSC>
It tells the type then the value
<youknow365>
so in this case unit is the type right ?
<youknow365>
why is there no vlaue and what is it the type too the expresson
<youknow365>
grrrrr
<TSC>
Yes
<youknow365>
i make myself sound confusing
<TSC>
The value is ()
<youknow365>
is that like a NULL value?
<pango>
() is the unique value of type unit
<TSC>
Not really
<youknow365>
pango: what does this mean
<pango>
more like void
<youknow365>
unit was the type of the try...with expression ?
<flux__>
try expr with .. has the same type as expr
<TSC>
Doesn't it have the same type has the .. ?
<flux__>
well yes, they need to equal
<TSC>
Duh, they're all the same (:
<TSC>
Of course
<youknow365>
im just confused what - : unit = () means and where it comes from
<TSC>
Sorry (:
<TSC>
unit is a type
<TSC>
It has only one value
<TSC>
That's all
<youknow365>
like int etc right ?
<TSC>
PLEASE read the tutorial
<youknow365>
i did
<youknow365>
and i saw that
<youknow365>
i jus didnt understand it
<TSC>
Well, now you do (:
<youknow365>
i mean i understand it a type
<pango>
TSC: the exception handlers must have the same type as the expression
<youknow365>
its just bugging the hell out of me why () is the value
<TSC>
Yeah
<pango>
so that the whole construct type does not depend on exit branch
<flux__>
consider simpler cases: try "foo" with _ -> "hello"
<flux__>
obviously the type of that expression is string
<youknow365>
so instead of unit it would be a string ?
<flux__>
yes
<youknow365>
ahhhhhhhh
<flux__>
try "Foo" with error -> 42 - what would be the type? it's a type error
<youknow365>
for some reason i was belving it returned a unit everytime
<flux__>
many imperative functions return unit
<flux__>
because they only have side effects
<youknow365>
so becasue it was an exception it returned unit or what?
<youknow365>
why unit in this case
velco has quit ["Ex-Chat"]
<flux__>
is the last paste the code you're talking about?
<youknow365>
yes
<flux__>
connect returns 'unit'
<flux__>
my guess is prerr_endline also returns 'unit'
<youknow365>
ahhhh
<flux__>
hence the return type is, tadaa, unit :-)
<youknow365>
i see isee
<flux__>
if you want to return a flag, like success/failure, consider something like:
<youknow365>
i just want to understand every little bit of this
<youknow365>
flux__: a flag would work fine
<youknow365>
anything that gets the job done
<flux__>
let connected = try connect .. ; true with ... -> prerr_endline "blah"; false in if connected then "Surely connected!" else "Not connected :/"
<flux__>
so the idea is to put the return value after the imperative expression to be evaluated in sequence
<flux__>
the value of the expression is the last expression in the expression list
NamelessOne has left #ocaml []
<youknow365>
i seeee but i need to match to more then one thing
<youknow365>
ETIMEOUT - ECONREFUSED and im sure there other a few other errors i dont know of
<flux__>
btw, you can write that also like .. with Unix_error (ETIMEDOUT | ECONNREFUSED | morestuffhere, _, _) ..
<youknow365>
but each one will have a different response you know ?
<flux__>
ok, well in that case you will have different cases
<youknow365>
Server down for timeout - connection refused - is pretty much conneciton refused
<youknow365>
so service down
<pango>
there's two ways of handling this, different return values, and exceptions
<flux__>
there is also Unix.error_message ercode-function that returns a string
<youknow365>
well whats the most effective way
<youknow365>
will the way i have noe work good ?
<pango>
depends, but probably exceptions here
<youknow365>
thats what i have is an excpetion
<youknow365>
pango: the first thing you showed me is what im talking about
<pango>
but you're catching it locally, in a place where maybe you don't know what to do out of it
<youknow365>
with Unix_error (ETIMEDOUT, _, _) -> prerr_endline "server not ready"
<youknow365>
that way
<pango>
maybe it's just enough to let the exception leave your function and handle the problem in calling function(s)
<youknow365>
and add | if i need more matching
<youknow365>
im saying is this the most effective way of doing it lol ?
<youknow365>
or is this some ghetto way and should be avoided
<pango>
Unix module interface is to raise exceptions on errors/exceptional conditions
<youknow365>
so is that a yes or no lol ?
<pango>
it's a "it depends". If you're about to handle exceptional cases in your own code using exceptions, you can choose when (in what layer) to handle them
<flux__>
for example, that code could try to reconnect a few times
<pango>
if you want to handle exceptional conditions with different values, you must catch exceptions locally everywhere
<youknow365>
it should ?
<flux__>
or it could let the exception fall to the previous function which may display a dialog
<pango>
but that's not really ocaml way
<youknow365>
flux__: i would think most applications try to connect once gaim firefox etc and give a timeout if no connection
<youknow365>
its not like re connecting is going ot make it not timeout if theres no internet or no server then yea
<youknow365>
if it timed out i would assume if teey really had a connection they would clikc re connect
<pango>
I guess your GUI program will have to handle (at least) the different connected/unconnected states (maybe more, like "connection attempt", you name it)
<youknow365>
how many autoamtic connection attempts should it try ?
<youknow365>
3?
<pango>
so success or failure of connection will result in different changes of state
<pango>
program so you can change it later anyway
<youknow365>
i understand well if it fails i could just have it re connect and then add +1 to a global var and if it reaches the number 3 ......that means it has try's to connect 3 times and would quit
<youknow365>
i dont really see a point in trying to re connect but i guess it would be ok
<pango>
if the GUI doesn't "quit" in case of connection failure, it could also be left to the user to retry manually
<pango>
looks like what other IM clients do
pangoafk has quit [Nick collision from services.]
<youknow365>
pango: thats what i was saying i dont really see a point to start doing automatic connection retry most im clients you just retry connection manually
<youknow365>
pango: but like i said you have ot have a crappy server for it to timeout on 2 connection s then connect on the third it would be slow slow
<youknow365>
ususally the first time if it times out server is down or your connection is down
<pango>
TCP already does several attempts for you anway
<youknow365>
it does ?
<youknow365>
yea so i dont see no point in doing that
<youknow365>
how many does it do ........it took liek 2 minutes for it to timeout
<pango>
with exponential backoff, to avoid flooding server with requests, making situation worse if the problem is that it's overloaded already
<youknow365>
i would say 30 seconds of it timeouting would be fine
<youknow365>
this is offtopic but i use tcp but how do you dsitinguish UDP from tcp port range ?
<zvrba>
you don't
<zvrba>
they're different protocols
<youknow365>
im saying how do u specify which protocl to use
<youknow365>
i assue i am using tcp right now
<pango>
yup, ports just happen to be 16 bit values for both
<pango>
port numbers that is
<youknow365>
so what is UDP i mean how would you open a UDP connection use a higher port ?
<youknow365>
i know UDP is not for im client i am just wondering though
<zvrba>
google
<wkh>
so that' show things are in here, huh
<youknow365>
i will look into it when i need it ........it was just a little curiocity zvrba
<wkh>
"STFW"
<pango>
when creating you socket with PF_INET and SOCK_STREAM, you requested a streamed connection, that's why you got a TCP connection
<zvrba>
wkh: stfw?
<zvrba>
wkh: as for youknow365, he insulted me and several other people on #c
<pango>
$ wtf stfw
<pango>
STFW: search the fucking web
<zvrba>
wkh: (got banned for it)
<youknow365>
pango: what would be different for UDP ?
<youknow365>
zvrba: no offense but me and C od not get along
<zvrba>
wkh: and he's half-trolling the chan here; asking questions first w/o reading docs
<zvrba>
wkh: therefore, STFW is more than appropriate in his case
<youknow365>
and zvrbafor YOUR FYI if you think a simple ban would kee p someone out come on now
<wkh>
fine, i misjudged. sorry. there is a solution for people like him
<wkh>
just type /ignore youknow365
<youknow365>
me and you both know bans do nothing ............2ndly it was a dispute between the ignorant and political bullshit
<wkh>
watch:
<zvrba>
wkh: i seriously considered that
<youknow365>
dude wtf
<zvrba>
wkh: but I can't filter out the rest of the noise he's generating
<youknow365>
your bringing in some bullcrap from 2 weeks ago from another channel
<wkh>
a /clear and we're done:
<wkh>
ahhh.
<zvrba>
wkh: i.e. he's actually getting replies from ppl I don't want to ignore
<wkh>
yeah i know
<wkh>
that happens
<wkh>
irc should have votekick like in games
<zvrba>
heh, true :)
<youknow365>
both of you are ignorant no nothing good bastards you get envy out of banning people
<zvrba>
oh, here he comes again
<youknow365>
yes here i come
<youknow365>
i NEVER said ANYthing about you
<zvrba>
showing his true face
<zvrba>
you did
<youknow365>
you came at me remember ???
<youknow365>
no
<zvrba>
i directed you to read docs
<youknow365>
you insulted me
<youknow365>
i never asked for help in C
<zvrba>
oh, you did
<wkh>
i only troll people who deserve it
<wkh>
like "web 2.0" marketing airheads
<youknow365>
i think i was having problem compiling an app or something it had some crap about delminated vars
<TSC>
wkh: Want to see my AJAX-enabled site?
<youknow365>
and then you started bitching about how its offtopic or something and started a whole community discuccsion .......
<wkh>
sure
<pango>
youknow365: by default (on Linux anyway) 5 retries are attempted, see man 7 tcp
<youknow365>
pango: yea .....i just read that myself
<youknow365>
zvrba: im not going ot get into any IRC flame war .........but you know how some of these ops on IRC are .........some are very nice and will ehlp you ........and the others will degrate you and ban you for their own enjoyment, those people usually suffer from no social enviroment / depression and use IRC as a tool for their pleasure , and obitz is one of those kind of people
<zvrba>
no, he's not
<youknow365>
LOL
<youknow365>
i remember you ;)
<zvrba>
you got banned because you were not civil, i.e. you said to me to "suck somebody's dick"
<youknow365>
i just read my logs
<zvrba>
that's more than a good reason to ban somebody
<youknow365>
no no listen you were defedning Zhicago
* wkh
likes C better than C++
<youknow365>
ZHivago
<youknow365>
Zhivago**
<zvrba>
i don't care. you were behaving primitively and got banned. period.
<youknow365>
remmeber he types like half your nick name
<wkh>
because i don't have the terrible feeling in the back of my mind that i'm about to stumble upon something i didn't know about. you can use C++ for years and still discover new stuff all the time. that's awful
<youknow365>
no your wrong that was not the reason
<zvrba>
wkh: awful?
<zvrba>
wkh: why?
<wkh>
yeah. i mean something that screws you up. i want to know what's going on and i want something simple
<youknow365>
you were defending him .........and me and ms| were commenting about how stupid he was for using an irc client that did not use Tab ........
<zvrba>
wkh: but that, in a camouflaged form, is used as one of C++ strengths
<youknow365>
and he called us idiots becasue we used tab and it made us lazy
<youknow365>
**exact** reason
<youknow365>
and twkm came in and got the last 4 comments and just banned
<zvrba>
wkh: they just turn it around to say "you can learn pieces that you need, when you need them" :)
<zvrba>
wkh: they just never say "ups, there is a million of them" ;)
<wkh>
they can take their verbosity and memory leaks and shove it
<zvrba>
now, now, you _do_ have GC for C++ :)
<wkh>
huh? since when?
<youknow365>
zvrba: just to add a little factorial inforamtion to your brain orbitz has admitted to have had mental issues and seeing doctors becasue of it .........he has talked things such as being bullied in school and never having a girl friend
<youknow365>
he also admits he finds it enjoying banning people
<TSC>
I can understand why he would enjoy banning you
<zvrba>
wkh: look for boehm gc.. it's for C and C++
<wkh>
oh, that. meh
<wkh>
seems like an instance of greenspun's 10th rule
<youknow365>
zvrba: and please to address any moree persoanl issues between us please take it up in Pm
<zvrba>
wkh: ?
<wkh>
"every sufficiently complex c or fortran program contains a slow, bug-ridden, ad-hoc implementation of half of common lisp"
<zvrba>
ah, that :)
<zvrba>
i've heard it zillion times :)
<wkh>
why doesn't c++ add some dynamic typing, something similar to but not as good as closures, maybe even some abstract syntax tree manipulation to give some of the benefits of macros except with a lot more pain
<wkh>
it will be so _INNOVATIVE_.
<wkh>
or maybe steal from the ML family instead and do smarter type inference
<wkh>
revolutionary.
<zvrba>
wkh: oh, they'll put type deduction in the next C++ :)
<zvrba>
wkh: you'll be able to write "auto x = <expr>" instead of "vector<blah>::const_iterator x = <expr>"
<zvrba>
for example :)
<wkh>
it's a good thing there are practitioners who can create some real innovation
<wkh>
god knows those propellerhead ivory tower pedants aren't good for anything
<youknow365>
pango: why am i having to define a block of code as let _ = ?
<pango>
youknow365: see ocaml-tutorial.org, it's related to the use of ;;
<youknow365>
(going there now)
<youknow365>
im just trying to have my whole connt stuff wrapped into one function
<youknow365>
connect*
<pango>
(specifically, you could use ;; instead)
<youknow365>
is there any up or down in either way ?
gmh33__ has quit [Read error: 60 (Operation timed out)]
<pango>
I don't understand what you mean
<youknow365>
reading the tutorial part once again ;)
<pango>
semantically it's the same
<pango>
(someone corrects me if needed)
<youknow365>
pango: im just trying to wrap my whole connection stuff up in 1 function
<youknow365>
pango: http://phpfi.com/151790 that code works good but i dont get what let _ = is doing
<youknow365>
once i get the connect stuff all complete ......then goes the recieving and thats where things get interesting
<pango>
let ... = ... is used to define stuff, either values or functions (well, in fact functions *are* values)
<pango>
let _ = expr evaluates expr and discard its value
<youknow365>
well how can i define my whole connect function and it only run when i call it
<youknow365>
right now anytime the script is ran it will just run everything
<youknow365>
oooo grrrr im sounding stupid
<youknow365>
i think its about bed time
<pango>
if you define a function instead of a value, it won't be immediately evaluated, so just replacing let _ = with, say, let connect () = should do
<youknow365>
pango: just curious but have you ever worked with openssl or Gnutls ?
<pango>
no
<youknow365>
well after i get alll my connection stuff done i would like to add some openssl support
<youknow365>
im wondering if that will make me re write all this or it would be simple to plugin
<pango>
I think you should try getting it working without SSL first ;)
<youknow365>
oh yea i am :P
<youknow365>
im just looking out for the very near future
<pango>
depends whether you'll write GUI part before or after ;)
<youknow365>
basically i wanted ot get all tcp stuff done tonight but i guess i will have ot wait till tom to get it all done .........i got sending with error support working now ....tommorrow i need to get reciving working with the use of Select which i think is a form of a poll
slipstream has joined #ocaml
<youknow365>
i wanted to get all the tcp stuff done then the GUI
<youknow365>
and GLIB has that function where it has a top level function it reposnds to at all timees (the gui of course) and you can set other things for it to run also
<youknow365>
for instanct my select
<pango>
however GUI programs are usually event driver, so code is organized differently
<youknow365>
yes
<youknow365>
i just wanted to get connection + sending + recieving done before i do gui
cognominal has joined #ocaml
<youknow365>
also can i statically link libraries with ocaml per say .......if i was to use SDL_AUDIO could i statically link the ocaml and c library in so the user would not have to download and install sdl audio
<youknow365>
its very small like 300 kb
<cognominal>
I am reading a paper about type theory. What is a "ground type"?
slipstream-- has quit [Read error: 110 (Connection timed out)]
Snark has quit ["Leaving"]
dgdfgfdgdfgdfg has joined #ocaml
youknow365 has quit [Connection reset by peer]
f78 has quit ["Leaving"]
joshcryer has quit [Client Quit]
chessguy has joined #ocaml
pango is now known as pangoafk
jewel has quit [Read error: 110 (Connection timed out)]
<LUCAS>
mmm... hello, I'm a bioinformatics student from Italy with almost no programming skill, but interested in OCaml and functional programming <- very dummy presentation... et puis vous seraient bien tous francophones ;)
<jeremy_c>
I'm coming from object oriented world. When should you use objects vs. types? i.e. a representation of a database record of the table user.
<jeremy_c>
I could create a type that contains the fields in the user record and then: u.first_name, u.last_name ... I could then create functions like let user_full_name u = u.first_name ^ " " ^ u.last_name
<jeremy_c>
or I could create an object to do the same thing. A bit confused.
pango has joined #ocaml
<zvrba>
jeremy_c: DB row = Ocaml record :)
<zvrba>
the simplest as it gets
<jeremy_c>
zvrba: then all the associated functionality that works on the row should be functions? user_save, user_remove, find_notes_by_user user, etc ???
<zvrba>
anyway you need some kind of DB handle, no?
<zvrba>
so your functions take db handle and user record..
<jeremy_c>
zvrba: I was hoping to make that global :-)
<zvrba>
ew >:
<zvrba>
you can but then your functions are overly specific
<zvrba>
imho, it's easier to write polymorphic and general code with functions than with objects
<jeremy_c>
making the db handle global?
<zvrba>
yes
<zvrba>
with functions you have a potentially infinite set of methods operating on users
<jeremy_c>
zvrba: but if my app only uses 1 db connection, why does it matter?
<zvrba>
with objects, you have to modify the class each time
<zvrba>
jeremy_c: because it easily generalizes to more than 1 db conn
<zvrba>
it's modular, and portable between apps
<zvrba>
_reusability_ :)
<zvrba>
anyway, i have to go now
<zvrba>
sadly, i can't give any reference to discussion of these issues
<zvrba>
my personal preference are functions over "objects"
<jeremy_c>
zvrba: thanks.
_jol_ has quit ["leaving"]
<flux__>
hmh, apparently cygwin+ocaml+sdl is not an easy combination
Carillon_ has quit [Connection timed out]
Carillon is now known as Carillon_
postalchris has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
_jol_ has joined #ocaml
chessguy has joined #ocaml
zmdkrbou_ has joined #ocaml
Snark has quit ["Leaving"]
zmdkrbou1 has joined #ocaml
zmdkrbou has quit [Read error: 60 (Operation timed out)]
luca83 has joined #ocaml
zmdkrbou1 is now known as zmdkrbou
_jol_ has quit ["temci lo nu muvdu"]
zmdkrbou_ has quit [Read error: 113 (No route to host)]
inaro has joined #ocaml
gmh33 has joined #ocaml
velco has quit ["I'm outta here ..."]
whitespace has joined #ocaml
TSC has quit [Remote closed the connection]
TSC has joined #ocaml
chessguy2 has joined #ocaml
chessguy has quit [Nick collision from services.]
chessguy2 is now known as chessguy
<luca83>
hey guys, do you think I've to read that huge O'Really book to learn OCaml? ;)
<zmdkrbou>
not cover to cover :)
<luca83>
zmdkrbou: may I skip the index?
<zmdkrbou>
:)
<luca83>
zmdkrbou: I've already read about 50 pages... but I don't know how is this approach good
<zmdkrbou>
i didn't read it myself, so i wouldn't know precisely how efficient it is
<pango>
they're several kinds of chapters; Some on the language itself, others about specific modules of the standard lib, others on tools (debugger, profiler,...)
<luca83>
pango: that's true... however the language itself is a big thing!
<pango>
The most important ones are most probably the former. For chapters about tools for example, you can read them when needed
<luca83>
pango: Will there be any further edition?
<pango>
no idea... indeed some things are missing (polymorphic variants, objects,...), and some details are no longer true
<luca83>
pango: included french-only...
<luca83>
pango: ouff
<pango>
the details that are no longer true are in general restrictions that have been since then lifted
<pango>
(I'm thinking of the chapter on monomorphic constraints; They're some more anecdotical, for example on pattern matching)
<luca83>
pango: because OCaml 4 doesn't exist yet ;)
<pango>
for now they're working on 3.10... Don't know if they're plans for a v4 ;)
<luca83>
pango: but I think the wiki tutorial has some details...
<pango>
yes, but I like the book style better
<luca83>
pango: I had translated a few wiki pages in italian
<pango>
just translated one in french ;)
<pango>
it's quite time consuming
<luca83>
;) and I had some issue about wiki naming conventions!
<luca83>
oh yes... too time-consuming
<pango>
was wondering when I would see the end of that d*mn page ;)
<luca83>
pango: the page about recursion seems like an infinite loop
<pango>
hehe
<luca83>
pango: however, the tutorial has a bunch of nice exemples
<luca83>
examples
<pango>
I think it can give "a taste of ocaml", and veterans may find small gems here and there... But inbetween, for the "real" learning phase, I'm not sure it's the best resource
<luca83>
pango: right
<luca83>
pango: I was wondering weither it might be useful to view some real code... I was looking for something simple
<pango>
I'd search in libraries sources... For one, it's supposed to be written for reuse ;)
whitespace has quit []
<pango>
standard libraries, but also third parties, I'm sure there's a lot of readable code in 3rd parties too
<pango>
which ones are considered "good style" is a more difficult question
<luca83>
I'm a bioinformatics student... But i see that biocaml isn't maintained anymore :(
<pango>
it's your chance! ;)
jeremy_c has quit [Client Quit]
<luca83>
pango: For sure ;) but it happens that it's a bit complicated to understand for me...
<luca83>
most importantly, bioperl/biopython/biofoo are big libraries
<luca83>
I think an IRC channel is very good for the kind of support I 'm looking for
<pango>
I'm with you :)
<luca83>
(so escape if you can :) )
<pango>
I'm not *always* in front of the keyboard, but when I am, I enjoy answering questions, specially when I know the answer :)
<luca83>
pango: :)
<luca83>
pango: but i must rtfm!
<pango>
please do ;) I guess the ora book explains many things better than I could, even if I had the time
<luca83>
eheh! and the reference manual? it's almost up-to-date i think, at least...
<pango>
yes, it's updated... but it really looks like a reference manual, even with "user manual" written on the cover
jeremy_c has joined #ocaml
<luca83>
pango: "dry" documentation hai its advantages too... hmm... but thanks for all your hints!
<luca83>
hai -> has
<pango>
sure, just not designed for learning
<pango>
whether the ora book will be updated is actually a question I wondered myself, because I think it still has no challenger for its specific role
<jeremy_c>
hm. opps. TextMate is too slick. that wasn't meant to be pasted yet :-/
<luca83>
pango: n8
<jeremy_c>
However, in that, I want to make "original" be a user_rec or None. I am not sure how to do that.
<luca83>
pango: (I think that's important!)
<luca83>
jeremy_c: I'm a new-newbie sorry...
<jeremy_c>
luca83: ?
<jeremy_c>
I tried type user = User of user_rec | None ; but it's a recursive definition, in regards to who get's defined first? type user needs user_rec defined, but user_rec needs user defined.
<TSC>
Maybe add "rec" after "type" in the paste?
fab_ has quit []
<TSC>
(I'm pretty new to OCaml too, thought)
<dgdfgfdgdfgdfg>
pango: do you ever sleep ?
<jeremy_c>
TSC: it'll relate to itself, no need for rec. Problem is that I want it to be itself or None. Not sure how to accomplish that.
<Fly_101>
well for my tcp connection .......no one wouldnt happen to kknow what a successful tcp connection throws do you ? like ETIMEOUT - ECONNREFUSED im tryingto figure out what successful is