<Maddas>
it's not a book about Scheme, but it teaches you a little
<Maddas>
it's a book about Programming in general
<Maddas>
(That book was written as an introduction to programming, every CS/EE student must take it in the beginning)
<Maddas>
and it's very good, even I learned a lot
<Maddas>
(about programming)
<srv>
it looks like what I call a "bracket language" :)))
<Maddas>
The brackets are a part of the language design
<Maddas>
they are important, once you get better, you'll see why
<Maddas>
they let you do very powerful things in LISP for example, which in that way no other language can (which is why LISP is still used)
<srv>
I already see why
<Maddas>
why?
<Maddas>
And, additionally, there is very little syntax to learn to do basic things, so the students don't get distracted by the syntax, but can focus on the ideas and concepts
<srv>
because I've written a compiler for a recursive lgg, and I know bracket make the grammar nicer
<Maddas>
Scheme is very easy to parse
<Maddas>
I see
<Maddas>
TinyScheme is < 80kb :)
<srv>
and it makes the lgge more intuitive
systems has joined #ocaml
<Maddas>
Well, the brackets in LISP are necessary for certain features :)
<Maddas>
not just visual decoration
<srv>
lisp without brackets would be charmless :))
<Maddas>
and pretty useless compared to LISP now
<srv>
well right now I gotta work....
<Maddas>
I wouldn't know how to implement it otherwise :)
<Maddas>
is coding in O'Caml more rewarding than in C/C++?
<srv>
what do you mean when you say "rewarding"?...
<Maddas>
less frustrating :)
<Maddas>
you get things done more easily, or at least it's more fun to get things done
<srv>
well, compared to C++, I have the impression I spend more time on "what do I want to make" than on "how can I make it" and "how can I get this shit to compile" :)
<Maddas>
I see :)
<Maddas>
So you get things done more quickly?
<Maddas>
with less debugging and all :)
<srv>
I'm really fed up with the 2 pages long g++ errors about the C++ STL, which are impossible to read
<Maddas>
heh :/
<bk_>
no pointers, no memleaks, no dangling crap anywhere - that is a BIG benefit of ocaml vs c++
<bk_>
no templates :>
<whee>
you get the functionality of templates with the parametric polymorphism and functors
<whee>
and there's camlp4 if you're into defining new constructs in your source
<srv>
ocamlc warnings are understandable because OCaml is a well conceived lgg (read "it doesn't have a grammar which has been tortured for years in order to add features, which has lead to complete nonsenses")
<Maddas>
That's what I expected, thanks :)
<srv>
the main asset of C++ compared to OCaml is the amount of libraries which are available, but if you learn how to use OCaml/C interoperability, there's always a way to use existing libs
<Maddas>
Yea, I see.
<Maddas>
I'm quite surprised that O'Caml isn't more popular, considering that it has important features for achieving mainstream recognition (can be compiled to machine-code, cross-platform compilers exist, it's fast)
<srv>
it takes a lot of time to change the companies habits...
<Maddas>
I'm thinking more of private people
<Maddas>
small projects and all
<srv>
I've seen some customers saying "no way, I want my stuff done in C++. No Ocaml". That's frustrating
<Maddas>
doesn't seem to make much sense, but then, what do I know :-)
<Maddas>
Yeah, I agree, that sucks.
<Maddas>
But then, people are stubborn, and mostly caught in the Blub Paradox
<Maddas>
which is very widespread and contagious
<srv>
what's more, there is no big lobying and advertising for OCaml like Sun has been pushing Java
<Maddas>
That's true
<Maddas>
A pity, really, that marketing has so much influence on things like this
<srv>
yep
<srv>
my vision of the thing is : "INRIA provides us the language, the compiler and the standard lib. We (communauty) now have to make some groovy libs to make the lgg more popular, that's exactly what I'm trying to do :)"
<Maddas>
:-)
<Maddas>
Maybe, if I find anything I could do and want to do, I should do it, just to show that O'Caml exists
<Maddas>
that's what I'm thinking
<Maddas>
:)
<Maddas>
I think MLDonkey is a success in that way, it shows that good software (I don't like P2P, mind you, but I've heard that it's one of the best clients) needn't be done with mainstream programming languages
<srv>
exactly
<srv>
that's what makes GNU/Linux's success. Share the code! :)
<bk_>
M$ is 'advertising' ocaml with F# in a way
<mattam>
Maddas: Blue Paradox ?
<srv>
bk_: LOL :)
<bk_>
if it helps giving ocaml more recognition when ppl. want to know where F# has its origins, it is a kind of advertisement imho
<Maddas>
I think that's good to have F#, gives OCaml some attention.
<Maddas>
And I'm VERY happy that they didn't just invent a OCaml# or something.
<mattam>
It's like OCaml-- I think
<Maddas>
It's an implementation of OCaml, it seems.
<Maddas>
oh crap, it's not.
<Maddas>
no wait it is
<Maddas>
it's just another target or something :)
<Maddas>
Not a new language
<bk_>
its on top of .net
<mattam>
I was told some things can't be done
<Maddas>
F# is an implementation of the core of the Caml programming language for the .NET Framework, along with cross-language extensions.
<whee>
F# is lacking a few features of OCaml
<Maddas>
Oh, ok
<Maddas>
At least it's still OCaml
<srv>
Well I fear that they want to give developers the habit of using THEIR compiler (with all the licensing restrictions it means) instead of the INRIA compiler...
<Maddas>
Oh, ok, th at sucks.
<Maddas>
that, even.
<mattam>
he... it's a company
<whee>
srv: I don't see it that way at all
<Maddas>
But don't forget, it might also just make developers aware of O'Caml, and they'll use the normal compiler if they want cross-platform compability.
<whee>
if you want to use a caml workalike and windows, you'd probably be better off using F#
<mattam>
just don't do what you don't want to
<whee>
especially because of the .NET support (which is actually pretty useful)
<srv>
whee: well, look at what happened with Java...
<whee>
Java flopped on its own merits
<Maddas>
Java was never supposed to get popular :)
<srv>
1) ms has made a java vm 2) they've tried to crush Sun (i.e. to make everybody use Ms's compiler and not sun'sone)
<whee>
srv: the thing is, F# isn't O'Caml
<whee>
they aren't passing it off as such, either
<Maddas>
I've just seen, whee is right.
<Maddas>
In particular it is the first ML language where all the types and values in an ML program can be accessed from some significant languages (e.g. C#) in a predictable and friendly way.
<Maddas>
It's not OCaml.
<Maddas>
It's an own language, similar to OCaml, it seems
<srv>
well, the future will tell us if I'm wrong
<srv>
I'd be curious to know what the INRIA folks think of all this
<Maddas>
here are no current plans to commercialize F#, and the source code for the F# compiler is due to be published in June 2003.
<whee>
a lot of the .NET languages aren't done directly by microsoft in order to take over the world
<Maddas>
But the rest sounds like crap. They're implementing a Windows-only Caml-like thing for universities to be used to teach.
<Maddas>
How stupid :)
<whee>
Maddas: eeh, .NET is useful :P
<Maddas>
well, VB is useful too.
<whee>
think the java libraries, available in many many languages, with complete interoperability
<srv>
Maddas: it's not stupidity. It's strategy
<Maddas>
srv: I know, but the explanation is stupid :)
<Maddas>
Well, stupid not from a business point of view, but from a students point of view.
<Maddas>
Why would you (as a teacher, for example) actively encourage to code in a language which can only be used on Windows?
<srv>
Maddas: agreed
<Maddas>
or why would a student want to learn that in CS? Not like you can't do that by yourself if you are interested in that
<Maddas>
I'm worried that some universities might fall for it.
<Maddas>
but then, my university sticks to C++ and Java, *sigh*
<srv>
Maddas: well I think that a teacher who uses MS will find this interesting because it enables him to benefit from the whole framework
<whee>
Maddas: the curriculum shouldn't be language specific, anyway
<whee>
if a CS course is teaching a student how to use a specific language, it's wrong
<Maddas>
Yes, that's what I agree.
<Maddas>
s/what/where/
<Maddas>
But our courses seem to do that, I couldn't see why you would use C++ for concepts :)
<whee>
you teach concepts, not languages. The actual language used should make no difference when the student completes the course
<Maddas>
I completely agree
<Maddas>
Which is why I don't understand why Java and C++ are used in the first courses, as opposed to languages which were made to be taught.
<whee>
I think you'll find that many of today's students are lazy and would rather be spoon-fed industry languages :)
<Maddas>
I will, but I don't know why the teachers give in
<Maddas>
If you teach something much less popular like Scheme or Smalltalk, you also have the advantage that almost all your students will know nothing about it, so they start from the same level.
<srv>
when you get out of the school, companies want you to speak the language theyuse...
<Maddas>
srv: yes, but university isn't a language school
<Maddas>
it's called Computer SCIENCE, not "Learning Industry Languages"
<whee>
srv: well, I think the easy solution is to not specialize on any language
<Maddas>
Indeed
<Maddas>
And the radical differences between those language (Scheme, Smalltalk, ...) and popular languages will stop the students from thinking that they already know how everything works, and they'll pay more attention
<whee>
perhaps every week, switch to a new language; the concepts are mostly the same, the syntax changes
<Maddas>
Every week is a bit too frequent, you don't have that many good languages :)
<srv>
I agree, but the final aim is to get a job...
<Maddas>
no, srv
<whee>
Maddas: it'd work here :)
<Maddas>
The final aim isn't to get a job, it's to make you a good programmer
<whee>
there's only 9-10 weeks in a quarter here, I can think of that many languagse worth using
<Maddas>
whee: well, you can't really dive into the core concepts of many languages in one week
<Maddas>
Don't forget, I'm thinking about students who program the first time in their lives, too
<whee>
Maddas: you're learning the concepts as you go; it's just a matter of getting people familiar with syntax
<Maddas>
Yes, I think the frequently changing syntax would just confuse many people.
<whee>
you don't have to introduce the entire language, just enough to introduce the concept
<Maddas>
Unnecessarily
<Maddas>
whee: in many cases you need a lot of syntax for that
<whee>
well, it'd get people to not associate the problem with the language
<srv>
I'm not saying I like this situation. I'm saying that's the situation
<Maddas>
Yes, but would it get people to be able to solve any real problem in any language?
<Maddas>
C++ for example needs a lot of syntax to understand many concepts
<whee>
I don't see it that way
<Maddas>
whee: And people like me will only have a few hours of similar classes every week :)
<Maddas>
I think that you need to have one language for problem solving and larger projects, but that ought not to be the language used to teach the concepts
<whee>
Maddas: things like template template parameters in C++ are really just fancy delegation and the like
<whee>
sure there's lots of syntax to learn in C++, but the concept is much simplier
<Maddas>
Yes
<Maddas>
But they'd rather learn a language good enough to continue on their own IMO
<Maddas>
The MIT course for example works very well, and the students seem to agree
<Maddas>
The introductory one
<whee>
I suppose
<Maddas>
pretty much every other course uses a language most fit to its tasks
<whee>
I like to tortute people, though :)
<Maddas>
which is what I think should be done
<whee>
torture, even :\
<Maddas>
The introductory course is based on one language, Scheme, to teach concepts. That's a language where you need almost no syntax to teach most concepts :)
<whee>
yes, scheme's a great learning language
<Maddas>
You'll probably not use Scheme later on, but I don't know anybody who says he didn't profit (massively) from learning to code in Scheme.
<Maddas>
Their book is great.
<whee>
I had the joy of learning to program with perl and C++, that was rather painful :)
<Maddas>
It focuses on common problems, and only uses Scheme to highlight possible (multiple) ways to solve it, and discusses the benefits/disadvantages.
<Maddas>
whee: Perl was the first language I really started using, I got around fine
<Maddas>
although I agree that it's a terrible language to teach
<whee>
I found it started a lot of bad habits
<Maddas>
Heh.
<Maddas>
I knew basic C/C++/Java before I started, I just never coded anything in those languages.
<Maddas>
And I never coded without strict/warnings :)
<Maddas>
But already now I see that Scheme has affected my way of thinking, showing me new ways of solving problems
<Maddas>
even though I only read the online-version of the book for two days
<Maddas>
a few hours every day
<Maddas>
most important of all, it showed me that there is no 'best' programming language, which then motivated me to look for more alternatives to C/C++/Java, which then got me here :)
<Maddas>
You could say that it freed me of the Blub Paradox
<whee>
heh
<Maddas>
Although a few of my friends are exactly like described there
<whee>
I started learning as many languages as I could a couple years ago
<Maddas>
That's what I started a couple of days ago :-)
<Maddas>
Going for Scheme and O'Caml now, I hope I can code decent things in O'Caml before University starts
<whee>
I find I can approach problems a bit more effectively now, having dealt with them in many different paradigms
<Maddas>
once it starts I won't have much time left to study
<Maddas>
whee: I find the biggest difference is that it made me enjoy programming more :)
<Maddas>
My friends though, they don't take anything or anybody seriously unless it/they use C++ or C#.
<Maddas>
For them, everything else are just toys
<Maddas>
They are CS students :)
<whee>
right now I'm working on learning haskell more extensively
<Maddas>
I see
<whee>
one of the few languages I can't pick up by reading the reference manual and running :)
<Maddas>
I'd like to pick up haskell, maybe Common Lisp (that's supposed to be really powerful) and Smalltalk later on
<Maddas>
haha whee :-)
<whee>
lisp is a lot of fun too
<Maddas>
Scheme is, I don't know LISP yet :)
<Maddas>
For me as more of a Perl coder, and after having started a bit of Scheme, Haskell has terribly lot of syntax though :-)
<Maddas>
Reminds me of Perl 6
<Maddas>
err, not Haskell, O'Caml
<Maddas>
Lot of syntax isn't bad, I'm just worried that I'll forget it quickly if I don't have much time to keep my O'Caml skills up to date later on.
* srv
going back to LibNN
<whee>
I didn't find retaining the syntax to be much of a problem
<srv>
whee: same for me
<whee>
I don't do a lot of O'Caml code these days, but I can still pull off most of it
<Maddas>
I see, cool
<Maddas>
I'm just worried, I don't know yet
<Maddas>
Because I won't be able to use O'Caml in Uni, at least definitely not in the beginning :-*
<Maddas>
Actually, it's annoying that you have to use ONE language, they should let you choose between 4 or 5 well spread languages for the assignments
<Maddas>
I should annoy the teacher who teachse in C by doing all in Perl and converting that to C code, what a mess :->
<Maddas>
teaches, even
docelic has joined #ocaml
docelic has quit ["Client Exiting"]
polin8 has quit ["Lost terminal"]
polin8 has joined #ocaml
<Maddas>
haha
<Maddas>
C++ allows you to have fun! Look at this function declaration:
<bk_>
i hardly ever use fun or function, mostly i use let ... =
<bk_>
perhaps fun & function make more 'sense' when used to define anonymous funs
<Xcalibor>
bk_: nod, but fun works like lambda in scheme or haskell, letting you gather several args in an anonymous function
<Xcalibor>
bk_: there ... :)
<bk_>
right
<Xcalibor>
from stdlib/list.ml: let append = (@)
<Xcalibor>
does this mean that the operator @ is the 'good one'?
<Xcalibor>
i mean: [1;2] @ [3;4] -> [1;2;3;4] ...? curious...
<bk_>
@ is mentioned in the docs about lists
<bk_>
OR use List.append
<Xcalibor>
indeed, List.append = (@)
<bk_>
val append : 'a list -> 'a list -> 'a list
<Xcalibor>
the weird thing is that the operator is defined first, instead of the function...
<bk_>
Catenate two lists. Same function as the infix operator @. Not tail-recursive (length of the first argument). The @ operator is not tail-recursive either.
<Xcalibor>
yup
systems has quit [Read error: 110 (Connection timed out)]
<Xcalibor>
let rec for_all p = function
<Xcalibor>
[] -> true
<Xcalibor>
| a::l -> p a && for_all p l
<Xcalibor>
this one looks like List.map ?
<Xcalibor>
but it doesn't return the list...?
<bk_>
nope for_all and map are different funcs on lists
<Xcalibor>
yes but... for_all checks that p applied to all elements of list is true?