gl changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | happy new year, dudes.
pants1 has joined #ocaml
Mr_Awesome has joined #ocaml
<jiffyjeff>
Can anyone speak to the general performance of f# compiled under mono?
Submarine has quit ["Leaving"]
<Mr_Awesome>
this is #ocaml
Submarine has joined #ocaml
jiffyjeff has left #ocaml []
dblmit has quit ["Leaving"]
romanoffi has joined #ocaml
gudzu has quit [Remote closed the connection]
pants1 has quit [Read error: 110 (Connection timed out)]
sponge45 has joined #ocaml
seoushi has joined #ocaml
Submarine has quit ["Leaving"]
dbueno has joined #ocaml
batdog|gone has quit [Read error: 110 (Connection timed out)]
dbueno has quit ["Leaving"]
Submarine has joined #ocaml
levi_home has joined #ocaml
Submarine has quit ["Leaving"]
mc__ has quit [Read error: 110 (Connection timed out)]
mc__ has joined #ocaml
levi_home has quit [Remote closed the connection]
levi_home has joined #ocaml
levi_home has quit [Remote closed the connection]
johnnowak has joined #ocaml
Anusien has joined #ocaml
<Anusien>
I'm missing something obvious, but how do you construct a string that contains the " character?
<seoushi>
use \" ?
<Anusien>
val a : string = "\"a"
<Mr_Awesome>
try print_string "\"a";;
<Mr_Awesome>
it will print "a
<Mr_Awesome>
the interpreter also escapes quotes so you know they are there
<Anusien>
ah, okay. I was really confused, thanks
<Mr_Awesome>
np
<Anusien>
I get really frustrated and all of a sudden OCaml goes "This task is actually really simple, just use me properly"
<Anusien>
Sooo close to that lightbulb moment in functional programming
<Mr_Awesome>
once you get there, programming becomes a lot of fun :)
<Mr_Awesome>
so good luck :)
<Anusien>
It's a hassle, since I'm still mentally in imperative mode
<seoushi>
yeah I know that feeling, I'm somewhat there as well
<Mr_Awesome>
i know the feeling
<Mr_Awesome>
though im past it ;)
<Mr_Awesome>
this is why i dont think beginners should be taught imperative languages
<seoushi>
at my university the first class was in Dr. Scheme, I hated it then but now I think it was a good thing
<Mr_Awesome>
they emphasize idiomatic copy/paste coding instead of teaching proper concepts
<Mr_Awesome>
i believe mit uses sicp as the textbook to their introductory cs course
sponge45 has quit ["zzzzzzzzzz"]
<Anusien>
Most intro level CS courses aren't exclusively for major candidates
<Anusien>
A lot of times, it's a general requirement
<seoushi>
not so sure of that
<Anusien>
Especially among engineering students, some students in the sciences, and related majors
<seoushi>
never heard of a computer gen ed heh
<seoushi>
ah for sci/eng yeah
<Anusien>
So there's a requirement for the CS101 to be something functional for everyone.
<Anusien>
Of course this is an outmoded thought process that doesn't properly assume computer algebra systems, but whatever
Mr_Awesome has quit ["...and the Awesome level drops"]
levi_home has joined #ocaml
seoushi has quit ["Leaving"]
Shimei has quit [Client Quit]
malc_ has joined #ocaml
mc__ has quit [Read error: 110 (Connection timed out)]
mc__ has joined #ocaml
chi11 has joined #ocaml
Smerdyakov has quit ["Leaving"]
Shimei has joined #ocaml
seoushi has joined #ocaml
Shimei has quit [Client Quit]
Shimei has joined #ocaml
EvanR has quit ["Leaving"]
jajs has joined #ocaml
pants1 has joined #ocaml
pango is now known as pangoafk
smimou has joined #ocaml
shawn has quit [Read error: 113 (No route to host)]
pants1 has quit [Read error: 110 (Connection timed out)]
khaladan_ has quit [Client Quit]
malc_ has quit ["leaving"]
velco has joined #ocaml
slipstream has joined #ocaml
slipstream-- has quit [Read error: 60 (Operation timed out)]
smimou has quit ["bli"]
Alneyan has joined #ocaml
Alneyan has quit [Remote closed the connection]
seoushi has quit ["Leaving"]
david_koontz has joined #ocaml
ludwig_ has quit [Read error: 110 (Connection timed out)]
ludwig_ has joined #ocaml
johnnowak has quit []
david_koontz has quit ["This computer has gone to sleep"]
david_koontz has joined #ocaml
david_koontz has quit ["This computer has gone to sleep"]
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
ramky has joined #ocaml
<flux->
can one have two objects which are structurally equivalent, but of which one cannot be used in the place of other?
<flux->
hm, I suppose an extra type needs to be declared and somehow embedded into the object
jlouis has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit [zelazny.freenode.net irc.freenode.net]
Shimei has quit [zelazny.freenode.net irc.freenode.net]
Anusien has quit [zelazny.freenode.net irc.freenode.net]
haelix has quit [zelazny.freenode.net irc.freenode.net]
ikaros has quit [zelazny.freenode.net irc.freenode.net]
chi11 has quit [zelazny.freenode.net irc.freenode.net]
mellum has quit [zelazny.freenode.net irc.freenode.net]
oscarh has quit [zelazny.freenode.net irc.freenode.net]
Hadaka has quit [zelazny.freenode.net irc.freenode.net]
pattern has quit [zelazny.freenode.net irc.freenode.net]
jajs has quit [zelazny.freenode.net irc.freenode.net]
romanoffi has quit [zelazny.freenode.net irc.freenode.net]
Smergo has quit [zelazny.freenode.net irc.freenode.net]
Riesz has quit [zelazny.freenode.net irc.freenode.net]
tsuyoshi has quit [zelazny.freenode.net irc.freenode.net]
bebui has quit [zelazny.freenode.net irc.freenode.net]
ramky has quit [zelazny.freenode.net irc.freenode.net]
flux- has quit [zelazny.freenode.net irc.freenode.net]
danly_ has quit [zelazny.freenode.net irc.freenode.net]
zagzig has quit [zelazny.freenode.net irc.freenode.net]
cmeme has quit [zelazny.freenode.net irc.freenode.net]
TaXules has quit [zelazny.freenode.net irc.freenode.net]
jajs has joined #ocaml
Shimei has joined #ocaml
chi11 has joined #ocaml
Anusien has joined #ocaml
romanoffi has joined #ocaml
haelix has joined #ocaml
ikaros has joined #ocaml
Smergo has joined #ocaml
Riesz has joined #ocaml
ulfdoz has joined #ocaml
mellum has joined #ocaml
tsuyoshi has joined #ocaml
Hadaka has joined #ocaml
oscarh has joined #ocaml
pattern has joined #ocaml
cmeme has joined #ocaml
bebui has joined #ocaml
TaXules has joined #ocaml
ramky has joined #ocaml
flux- has joined #ocaml
danly_ has joined #ocaml
zagzig has joined #ocaml
Anusien has quit [Read error: 60 (Operation timed out)]
jajs has quit ["Quitte"]
jajs has joined #ocaml
Anusien has joined #ocaml
Anusien has quit []
batdog|gone has joined #ocaml
Smerdyakov has joined #ocaml
Plazma has joined #ocaml
batdog|gone is now known as batdog
nodie has joined #ocaml
Alneyan has joined #ocaml
ludwig_ is now known as ludwig-
jlouis has joined #ocaml
Anusien has joined #ocaml
<Anusien>
Is this the right place to ask about ocamllex as well?
<Smerdyakov>
Yes
<Anusien>
In Ocamllex files, in order to recursively call your rule, the code to call the rule needs to be in the footer section, right?
<Smerdyakov>
Beats me.
<Anusien>
Because I have a function that needs to use my rule, but my rule needs to call the function...
mnemonic has joined #ocaml
<mnemonic>
hi
stevan_ has joined #ocaml
<zmdkrbou>
Anusien: but then the function wouldn't be usable is your rule's code, i suppose. you could pass the rule as an argument to your function.
<zmdkrbou>
s/is/in/
romanoff1 has joined #ocaml
levi_home has quit [Read error: 110 (Connection timed out)]
stevan__ has quit [Connection timed out]
levi_ has joined #ocaml
levi_ is now known as levi_home
Anusien has quit [Read error: 110 (Connection timed out)]
<Plazma>
would any of you reccomend ocaml as a good starting language?
<Plazma>
for someone who has dabbled a bit in programming, but has a good background in sys/network administration?
<hcarty>
Plazma: As one who is learning OCaml now as a 5th or 6th language, I think it would be a very good language if you're willing to deal with a potentially steep initial learning curve
Anusien has joined #ocaml
<Plazma>
hcarty, ive dabbled in many diff languages, but havent fully mastered one
<Plazma>
i would be considered a novice in that field
<hcarty>
It supports (and encourages) a very broad range of programming methods which will be helpful whether you settle on OCaml or some other language
<Plazma>
hmm
<Plazma>
i guess im looking for something fun
<zmdkrbou>
starting in ocaml requires a bit of mathematical knowledge, imho (and it's not the better language to program sys/net admin stuff ...)
<hcarty>
Personally, I think programming in OCaml is a blast
<Plazma>
hmm
<Plazma>
cisco/*nix admining , NT admining, thats where i dwell and specialize in, so
<Plazma>
i just read a bit about ocaml and so forth.. figured id stop in and check some opinions
<jlouis>
Plazma, python is a good bet for that problem space
<hcarty>
Plazma: It's kind of demonized in some places, but Perl may be another good option if you want something useful
* zmdkrbou
agrees with jlouis
<Plazma>
see ive played with perl/python and i kinda like them both, but i guess im looking for a language that i can know just some about, and do some useful/fun/cool things, instead of having to learn the entire lagnauge (damn near) and then can do useful things
<Plazma>
hmm
<hcarty>
OCaml also has the benefit of being run as a (sort of) scripting language or as a compiled language
<hcarty>
Which is helpful when learning and playing with it
<Plazma>
see thast the other thing i am looking for
<Plazma>
something that is cross-platform and can be compiled for portability
<zmdkrbou>
Plazma: ??? python is the easiest language i know about
<Plazma>
zmdkrbou, do you prefer python over perl?
<zmdkrbou>
yes
<Plazma>
i like easy, but i dont want to feel like a 2 year old either
<zmdkrbou>
you don't need to know much about python to use it
<zmdkrbou>
why would you ?
<Plazma>
good point..
<Plazma>
dont know i guess..
<jlouis>
2 year old? Try Java
<zmdkrbou>
:)
<zmdkrbou>
python is not a joke language
<zmdkrbou>
(java is)
<Plazma>
java annoys me
<zmdkrbou>
yes it's kind of a bad joke
<Plazma>
the only reason i tried to learn java at one time was to be more marketable.. but.. its just so damn annoying
<Plazma>
it gets in the freakin way of everything
<Plazma>
the only thing i like about java is the ease of using SWING for gui appps
<jlouis>
... but closures through inner classes
<velco>
don't you like the type-safety guarantees of the bytecode verifier ? The class loaders ?
<jlouis>
You should learn OCaml though.
<Plazma>
i really dont like the fact that the main method is a class itself
<jlouis>
velco, that are properties of the implementation. I am more disagreeing with the properties of the language
<velco>
no, these are not properties of the implementation
<velco>
these are properties of ALL implementations
<velco>
as for python, it does not even have formal semantics.
<zmdkrbou>
it's not a clean language, it's a useful and powerful one
<zmdkrbou>
(and does java have clean formal semantics anyway ?)
<velco>
JVM has.
<zmdkrbou>
the JVM is not java
brainly-green has joined #ocaml
<velco>
the Java language has no weaker form if specification than python.
<velco>
but it has a JVM spec also.
<velco>
where's python bytecode spec ?
<velco>
(I'm not sure why you talk about java, btw)
<zmdkrbou>
(we were just joking about java because we -- at least i -- don't like java)
jajs has quit [Remote closed the connection]
Alneyan has quit [Remote closed the connection]
velco has quit ["<boris``> reduction ad absurdum is a fallacious method of proof"]
<Anusien>
How do you take a string and add something to it? I feel like I'm missing somethign
<pango>
what do you mean by "add" to a string ? concatenate strings ?
<Anusien>
I want to take the string foo and concatenate something to the end of it, but keep it around
<Anusien>
the equivalent of C's foo = foo + "bar";
<pango>
foo ^ " something to the end of it"
<Anusien>
Right, but you can't put that equal to foo
<Anusien>
you can't do foo <- foo ^ "bar"
<Anusien>
I need to keep my strings around until I find out there's no errors, so I can write them out to a file; is there an easier way to keep track of that?
<pango>
I don't think that's C code, maybe C++
<flux->
anusien, maybe you want to use the Buffer-module
<Anusien>
C++, yeah. C has no native strings
<flux->
anusien, however, what you are suggesting would need a type of string ref, which can be reassigned with :=
<Anusien>
ah, thanks flux
<Anusien>
output_buffer seems to be exactly what i want
<pango>
yes, Buffer is probably the best answer, it will take care of reallocation for you
<Anusien>
I need to make it a ref, right?
<pango>
the only drawback of Buffers is that they're imperative ;)
<flux->
no, Buffer is mutable
<flux->
iow, imperative :)
<Anusien>
iow?
<pango>
(I mean, the API is imperative)
<flux->
"in other words"
kasv has quit ["Leaving"]
<pango>
in functional code, it may be cleaner to use a string list, and concatenate/flush all list elements as a last step
<jlouis>
even better: Build a datatype for concatenated strings and build a tree. Output is now walking this tree in the right order and outputting stuff.
<pango>
yes, depends on case
<jlouis>
pango, indeed
<seoushi>
hurray, I finally got ocamlsdl to work properly on OS X, man that took awhile.. I'll have to post what I did somewhere
sponge45 has joined #ocaml
<Anusien>
What is wrong with this syntax?: Buffer.add_string output (sprintf "%d\n%s\n%d\n" a b d
<Anusien>
where output = Buffer, a = int, b = string, d = string
<Anusien>
waitwait
<pango>
use Printf.bprintf, that'll save the building of a temporary string
<Anusien>
How do I use it? Printf.bprintf output "%d\n%s\n%d\n" a b d ?
<pango>
yes
pango has quit [Remote closed the connection]
pango has joined #ocaml
ikaros has quit [Read error: 60 (Operation timed out)]
Anusien has quit []
ikaros has joined #ocaml
benny99 has joined #ocaml
pango has quit ["I shouldn't really be here - dircproxy 1.0.5"]
pangoafk has joined #ocaml
velco has quit ["I'm outta here ..."]
brainly-green has quit [Connection timed out]
<benny99>
Is recursion in ocaml as slow as it would be in C for example?
<Smerdyakov>
C has no performance model, so the question is ill-defined.
<benny99>
ok
<Smerdyakov>
OCaml has a pretty poor compiler. I would recommend SML and MLton if you care about performance.
<Smerdyakov>
Many complicated recursive programs end up compiled just like GCC does loops.
<benny99>
That was the answer I was searching for :)
<benny99>
Although -> What is a performance model?
<Smerdyakov>
You mentioned "slowness" in connection to C.
<Smerdyakov>
C is a language, with no concept of speed.
<benny99>
Well, I thought about calling functions in C, because C is putting all the registers on the stack and back again
<Smerdyakov>
No, it isn't.
<Smerdyakov>
C has no concept of "stack."
<benny99>
?
<Smerdyakov>
You are talking about particular C implementations, not C.
<benny99>
ok
<benny99>
But on most machines it's done in that way isn't it?
<Smerdyakov>
It's not an issue of "which machines." It's an issue of "which compilers."
<benny99>
And it would be slower than a loop, so I was just wondering if Ocaml is doing the same
<benny99>
*the standard ocaml-compiler
<jlouis>
benny, All compilers which are not experimental would compile the assembly to utilize a stack yes
<jlouis>
(in C)
<benny99>
So, if I do "let rec myfun = ...", is it compareable to a loop in C? In performance
<jlouis>
benny, I suggest you look up and read about the term "tail recursive"
<benny99>
it's might a stupid question :(, just wondering "how fast ocaml is"
<benny99>
jlouis, thanks :)
<stevan_>
benny99: ocaml is very fast (for some things) and not so fast for other things
<stevan_>
benny99: but the same can be said about C
<benny99>
stevan_, hm, I don't expect a enumerations of the things that are fast, but which things are fast :S ?
<stevan_>
benny99: see the computer language shootout for how ocaml compares
<benny99>
ok, thanks so far :)
<Smerdyakov>
stevan_, not very useful figures there, since the implementations don't use much abstraction and modularity.
<Smerdyakov>
stevan_, so far as seeing how soundly MLton whumps the OCaml native code compiler
<stevan_>
Smerdyakov: your correct, the examples tend to be trival, and some use the more imperative features too
<stevan_>
Smerdyakov: well MLton is only useful if you are writing ML :)
<Smerdyakov>
stevan_, usually, when you're using any ML (OCaml or SML), you have significant choice about which to use...
<stevan_>
hmm, maybe in academia
<jlouis>
Smerdyakov, that is interesting. I know quite a bit about the MLton internals.
<Smerdyakov>
There's so little ML code out there that the usual reasons for programming language lock-in apply very little compared to mainstream languages.
<stevan_>
for me, SML does not have enough relevant libraries to be useful, whereas OCaml does
<Smerdyakov>
stevan_, wrapping C libraries is easy.
bluestorm has quit ["Konversation terminated!"]
<stevan_>
Smerdyakov: yes, but I don't want use crappy C APIs from ML
<jlouis>
stevan_, what are you thinking about specifically?
<stevan_>
so wrapping is IMO only a partial soltion
<Smerdyakov>
Creating better interfaces to C libraries is also easy.
<Smerdyakov>
You are working on trivial projects if the time to create libraries that rely on existing code for most functionality is significant.
<stevan_>
jlouis: I do mostly web application programming, so basically CGI (ocamlnet is very nice) and database (haven't actually found one I like here yet)
<stevan_>
Smerdyakov: yes, I saw that a while back
<Smerdyakov>
stevan_, I'm pretty confident that it trumps OCaml for both categories of functionality you mentioned.
<stevan_>
Smerdyakov: I prefer seperation of presentation and code actually so I am not a fan of the templating system
<Smerdyakov>
stevan_, I don't understand. "Separation of presentation and code" is exactly what a template system achieves.
<stevan_>
Smerdyakov: last time looked,.. this felt more like an SML port of PHP
<jlouis>
I hate seperation of presentation and code
<stevan_>
code and HTML mixed
<Smerdyakov>
stevan_, sure, and you can put the "code" off in separate SML files.
<Smerdyakov>
stevan_, it supports any mode of use you'd apply with a "templating system," and more.
* stevan_
is looking over the examples again
<stevan_>
Smerdyakov: hmm, not as bad as I remember it, but looks pretty much like you arent working on it anymore
* stevan_
is downloading the source for a closer look
<Smerdyakov>
stevan_, I'm not, but it's been in use on production sites for years.
<jlouis>
ML (SML or OCaml) code doesn't tend to "rot" as much as other languages
<benny99>
jlouis, "rot" ?
<stevan_>
less about rot, and more about continious improvment
<jlouis>
benny, get too old
<jlouis>
benny, if you take some python 1.5 code there is a great chance it doesn't work in python 2.5
<benny99>
jlouis, ah :)
<stevan_>
no offense to Smerdyakov, but this code can't be "perfect"
<Smerdyakov>
stevan_, I don't have the foggiest idea what you're getting at.
<benny99>
Hope it's not a stupid question again, but what are you using ocaml for? Except stevan_ :p
<jlouis>
benny, look up bitrot
<Smerdyakov>
benny99, I mostly use OCaml for extending/interfacing with Coq.
<stevan_>
Smerdyakov: I am saying that if you (the author) are no longer supporting or using this code, then if I were to start building code on it, then I would essentially be taking on the burden of maintainership
<Smerdyakov>
stevan_, I have been using it in production code for 5 years.
<stevan_>
Smerdyakov: you are not understanding my point
<Smerdyakov>
stevan_, and I haven't stopped using it there.
<Smerdyakov>
stevan_, you said "no longer supporting or using." This shows that the "using" party is clearly not applicable.
<stevan_>
Smerdyakov: are you actively maintaining this codebase?
* benny99
looks up Coq
<Smerdyakov>
stevan_, I am not making changes recently because I don't see any reason to....
* benny99
ah, sounds like what SML was designed for
<jlouis>
benny, I am not hacking OCaml code this semester.
<stevan_>
is sourceforge the latest version?
<Smerdyakov>
stevan_, yes
<jlouis>
In the olden days, ML was a lisp-extension, hehe
<stevan_>
Smerdyakov: does the SQL_CLIENT sig support operations other than selects?
<Smerdyakov>
stevan_, did you even read it? :P
<stevan_>
reading it right now... there is oneRow and oneOrNoRows
<stevan_>
then app and map which operate on the results
<Smerdyakov>
stevan_, you missed an important line.
<stevan_>
include SQL_DRIVER
<stevan_>
ahh I see query now
<benny99>
ok, thanks for helping me, I'm going to read on, bye :)
<stevan_>
Smerdyakov: again, no offense, but this is very minimal and not sophisticated enough for my needs
<Smerdyakov>
stevan_, what is it missing?
<stevan_>
Smerdyakov: take a look at Perl's DBI interface,. that is what I need
<Smerdyakov>
stevan_, I'd rather you gave a simple example now, since Perl makes me puke.
benny99 has quit ["Leaving"]
<stevan_>
Smerdyakov: the point is that I can't give you a simple example
<stevan_>
cause its not simple stuff
<Smerdyakov>
stevan_, you can't even describe any aspect of the problem?
<stevan_>
Smerdyakov: we build reporting applications, which have complex queries, and require much post processing of results
<stevan_>
what your library is missing is:
<stevan_>
- no abstraction for SQL, so everything is pushing strings around
<jlouis>
hmm
<stevan_>
- no way to do prepared queries (at least not that I can tell)
<jlouis>
that makes me ponder a SQL sig
<stevan_>
jlouis: look at SQLAlchemy (its Python), but they have an interesting take on the approach
<Smerdyakov>
stevan_, is that the end of the list?
<jlouis>
stevan_, I am knowledgeable in SQLAlchemy, yes
<stevan_>
Smerdyakov: nope, still skimming your code as I make the list
<Smerdyakov>
stevan_, so far, Laconic/Web addresses your complaints perfectly, but it's not ready for serious use. http://laconic.sf.net/
<Smerdyakov>
stevan_, do you claim that something pre-available for OCaml addresses your complaints, too? That was the issue, SML vs. OCaml for web dev today.
<stevan_>
yes, i saw you post this link the other day,, I very interesting
<stevan_>
Smerdyakov: no, I have not found a suitable OCaml DB lib yet
<stevan_>
Smerdyakov: how does smlweb run? can it do FastCGI, or just plain vanilla CGI?
* stevan_
switches to looking at Laconic
<Smerdyakov>
stevan_, the implementation uses CGI. Nothing fundamental about that.
<stevan_>
Smerdyakov: that would be another drawback, the amount of traffic we get, we need a FCGI interface (but that would be pretty trivial)
* jlouis
thinks of paul grahams viaweb: No database, and clisp (interpreted bytecode, dynamic language)
<jlouis>
and 1996's computers, heh
<jlouis>
not to forget
<stevan_>
jlouis: if I could get rid of my database I would, but thats not my choice :)
<stevan_>
Smerdyakov: re: Ocaml vs. SML state-o-web-dev, ... I dont see an ocamlnet equiv for SML
<Smerdyakov>
stevan_, which parts of it are important to you?
<stevan_>
the generic server framework is handy for me
<stevan_>
netplex i think it is called
<stevan_>
for background daemons to process reports, etc
<stevan_>
the CGI libraries are very mature,.. which is nice
<stevan_>
I like the transactional aspect
<stevan_>
I come from Perl, so I am used to well developed web tools (say what you will about perl as a language, it has nice tools)
<stevan_>
Smerdyakov: what is the state of Laconic? is it a current project of yours?
<Smerdyakov>
I won't dispute that OCaml has more libraries for that kind of thing, but you could also port them to SML with minimal effort.
<Smerdyakov>
stevan_, the front page at SF says it all.
<stevan_>
ah,,... I skipped right to the examples :)
<stevan_>
Smerdyakov: porting them to SML means I then have to maintain them
<stevan_>
I already have my own apps to maintain,.. I dont want to take on a slew of libraries too
<stevan_>
not to mention the fact I can't charge clients for that kind of work
<stevan_>
but anyway its dinner time,.. so I must go
Alneyan has quit [Remote closed the connection]
<stevan_>
Smerdyakov: I will keep an eye on Laconic