<bluestorm>
you could translate the second list into a map
<bluestorm>
so that you'd have a O(n log n) algorithm
<bluestorm>
(of course if you consider small lists only, the simpler the better)
<palomer>
my program is so inefficient in so many other aspects
<palomer>
I'll just optimize later
<bluestorm>
indeed
<bluestorm>
(an other choice, with is probably simpler if you're restricted to stdlib only, is to sort the second list, convert it to an array, and then use dichotomic search)
pants1 has quit [Read error: 110 (Connection timed out)]
asmanur has quit [Read error: 110 (Connection timed out)]
<bluestorm>
hey, ocamlbuild is actually handy
<bluestorm>
i just tried it for the firt time on a project wich is not mine
<bluestorm>
i just had to download the "interacting with ocamlfind" plugin, write a two-line tags file, and that's it
<bluestorm>
for a project using ocamllex, ocamlyacc, gtk and syntax extensions (ulex), that's not bad
* palomer
is scared of ocamlbuild
coucou747 has quit ["bye ca veut dire tchao en anglais"]
dibblego has quit [Read error: 113 (No route to host)]
dibblego has joined #ocaml
Jeff_123 has quit []
Jeff_123 has joined #ocaml
seafood has joined #ocaml
seafood has quit [Client Quit]
Jeff_123 has quit []
<palomer>
ugh, my code looks like (if .. then if .. then ... else if .. then .. ) ....
<palomer>
and everything inside those ... is really small
<palomer>
my code looks like lisp:P
<bluestorm>
you may be interested in a pa_cond syntax extension
ikatz has quit [Read error: 110 (Connection timed out)]
bluestorm has quit [Remote closed the connection]
jeddhaberstro has quit []
woogs2 has joined #ocaml
<woogs2>
Hi
<woogs2>
Is ocaml recommended as a first language?
<woogs2>
I want to learn to program but I only have a basic background in math.
woogs2 has left #ocaml []
ikatz has joined #ocaml
wolgo has joined #ocaml
wolgo has left #ocaml []
LDE has quit [Remote closed the connection]
Jeff_123 has joined #ocaml
ygrek_away has joined #ocaml
Gionne has joined #ocaml
mishok13 has joined #ocaml
seafood has joined #ocaml
seafood_ has joined #ocaml
rwmjones has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
<jynxzero>
woogs2: It's fine as a first language.
<jynxzero>
Except, I guess that, some more popular languages might have more teaching resources available.
<jynxzero>
Maths background shouldn't matter.
<flux>
do you mean as in school material?
<flux>
there's plenty of tutorial-level (and more advanced) documentation at ocaml-tutorial.org
<jynxzero>
As in, there are 1001 "How to Program Java" books, but relatively few for O'Caml.
<jynxzero>
(But still plenty enough IMHO)
<flux>
fortunately even a short piece like print_endline "hello world";; is a valid ocaml program - no boilerplate ;)
lde has joined #ocaml
<flux>
(shame there isn't a function called "print" ;-))
Yoric[DT] has joined #ocaml
wolgo has joined #ocaml
<jynxzero>
I'm not sure that really has a serious impact on learning time.
<flux>
I think when you combine that with the interactive toplevel, it can help in the beginning
<jynxzero>
Yeh, interactive toplevel is definitely a big win.
<jynxzero>
Don't all proper languages have one though, these days?
<jynxzero>
There's even Java ones.
<wolgo>
Hi, I am preparing to attend college for CS and I am looking at different languages to familiarize myself with programming. I have only a small amount of experience programming. I know I will probably get some bias in here but is ocaml a decent first language? I am not interested in python because of the forced indentation and the people I talk to have huge egos.
<wolgo>
People recommend python to me a lot.
<jynxzero>
O'caml good for your purpose, because it's multi-paradigm
coucou747 has joined #ocaml
<wolgo>
I have been doing some Java programming which I like but I want to get familiar with different paradigms.
<jynxzero>
You can play with functional, imperative and OO programming styles all in one language.
<wolgo>
Is it O'caml or Ocaml?
<flux>
if you've already learned to dislike static type systems, o'caml is the way to go ;)
<wolgo>
I dont like how verbose java seems to be
<wolgo>
I think it is stupid that I have to say "THIS IS THE MAIN SECTION" everytime I want to do something.
<wolgo>
But like I said. I am new.
<flux>
I suppose OCaml is the official form
<wolgo>
So I do not know much.
<flux>
wolgo, perhaps you should give a test drive to a tutorial and see if you like it
<wolgo>
I am
<wolgo>
and I think ;; is dumb haha
<flux>
fortunately you don't need ;; in real programs
<wolgo>
But that is minor
<wolgo>
Oh okay.
<jynxzero>
There's deeper things to a language then syntax anyway.
<vixey>
wolgo: lol
<wolgo>
vixey: hahaha
<wolgo>
Hi vixey
<vixey>
hi
<vixey>
wolgo: I agree
<wolgo>
I was in Haskell earlier asking about that fibs thing :)
<wolgo>
Okay. I am going to work with ocaml for a while.
<wolgo>
It seems to have gotten a reputation for not being a first language.
<wolgo>
But I dont really care about that.
<vixey>
wise
<flux>
I don't know if there's anyone here who has actually learned it as their first language
<flux>
unless there are some students of the some french university where they teach it as the first one
<wolgo>
It doesn't matter much to me.
<wolgo>
There are so many stupid opinions out there about "good languages" and "first languages" that it makes finding information difficult for noobs like me.
<wolgo>
Which actually pisses me off.
<wolgo>
So I will program in ocaml
<wolgo>
and java
<wolgo>
and that is it
<jynxzero>
wolgo: What to "they" give for it not being suitable for a first language?
<jynxzero>
Sorry, "what reason do", I meant.
<vixey>
wolgo: You should also learn lisp and prolog
<wolgo>
jesus hahaha
<wolgo>
jynxzero: Shit I dont understand
<jynxzero>
Ah, OK.
<wolgo>
jynxzero: like LACK OF A RECOMBOB
<wolgo>
or other stupid buzzword
<jynxzero>
ic
<wolgo>
they are probably pissed off because they cannot figure something out that is in the docs
<wolgo>
Anyhow
<coucou747>
jynxzero> a lot of people hate ocaml, it must be their first reason
<wolgo>
here I go
<vixey>
lol
<wolgo>
Can I say lol in here?
<wolgo>
lol
<wolgo>
in #python you cannot say lol
<wolgo>
so I am boycotting them
<wolgo>
not that it matters
<vixey>
wolgo: ya #python-metadiscussion
<Jeff_123>
python has good list comprehensions, I want to steal them for caml :(
<jynxzero>
Jeff_123: Do it then :)
<jynxzero>
campl4 FTW
<wolgo>
brb testing your satanic cons operator
<wolgo>
Sorry for being annoying.
<wolgo>
I have been researching this stuff all week and have found nothing but blog after blog of armchair opinions and baseless claims.
<coucou747>
jynxzero> I hate python syntax
<wolgo>
I guess that speaks to my stupidity though.
<Jeff_123>
camlp4 is a huge pain in the rear
<coucou747>
a non C-like, for an imperative language...
<vixey>
wolgo: Why are you interested in programming?
<jynxzero>
coucou747: I don't really know python so I couldn't comment.
<mbishop>
pretty sure there is already a list comprehensions camlp4 extension
<jynxzero>
The lazy lists extension does it I think.
<jynxzero>
Haskell stylee.
<coucou747>
the lazy programmers to :) never write { }
<jynxzero>
Dunno if that's the same as the python style that Jeff likes.
munga_ has joined #ocaml
<Jeff_123>
there is a camlp4 extension for list comprehensions, but it's not very mature.
<jynxzero>
Does it keep making fart jokes?
<jynxzero>
Sorry, I'll get my coat.
<wolgo>
vixey: I think it is the coolest thing in the world.
<wolgo>
I want to prove things with programs. I just don't know how.
<Jeff_123>
prolog is good for proofs
<wolgo>
That is why I am going to college.
<wolgo>
Err, will be going to college.
<vixey>
wolgo: Oh in that case yeah, learning a typed language like ocaml is a good idea. and yeah having an understanding of prolog will help a lot with proving
<wolgo>
I want to work in A.I.
<wolgo>
Well, work on A.I. stuff
<mbishop>
and learn Coq, so you can prove your program before you prove other things :P
<sbok>
I hear college chicks dig OCaml, too.
<wolgo>
DUDE SERIOUS?
<jynxzero>
lol
<wolgo>
just kidding.
<wolgo>
haha
<sbok>
I will get back to you next semester :P
<wolgo>
Haha.
<wolgo>
How do I say this in english? val fact : int -> int = <fun>
<wolgo>
factorial takes an int and returns and int and equals what?
<jynxzero>
"fact has type int to int"
<Jeff_123>
"fact is a function from integers to integers"
<vixey>
yeah : is read 'has type'
<wolgo>
Oh okay so if it was val wolgo : [float] : float = <fun> it would read wolgo has type list of float to float?
<vixey>
wolgo: No
<Jeff_123>
oh fine. what about "val somefun : ?start:int -> ?default:string -> ~end:int -> (int -> unit) = < fun >"
<vixey>
float list
<wolgo>
vixey: oh okay
<wolgo>
type float list to float
<wolgo>
okay
<vixey>
wolgo : float list -> float
<lde>
Btw, what does ocaml display '= <fun>' for?
<lde>
Ah, it just always displays type = value.
<lde>
braino
seafood_ has quit []
<rwmjones>
gildor, ping
seafood has joined #ocaml
munga_ has quit ["Ex-Chat"]
munga__ has joined #ocaml
munga__ has quit [Client Quit]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
mrtes has joined #ocaml
mrtes has left #ocaml []
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Client Quit]
vixey has quit [Read error: 104 (Connection reset by peer)]
vixey has joined #ocaml
ygrek_away has quit [Remote closed the connection]
ygrek_away has joined #ocaml
Asmadeus has joined #ocaml
OChameau has joined #ocaml
asmanur has joined #ocaml
bluestorm has joined #ocaml
Gionne has quit ["Leaving"]
seafood has joined #ocaml
<gildor>
rwmjones: pong
<rwmjones>
gildor, hey ... got some questions about warnings from f_ in ocaml-gettext
<rwmjones>
gildor, basically I get a lot of warnings like this:
<rwmjones>
Warning X: this statement never returns (or has an unsound type.)
<rwmjones>
the line that generated that example was:
<rwmjones>
eprintf (f_"%s: cannot find dev_base, dev_base_head or init_net symbols in kernel image.\n") image.domname;
<Yoric[DT]>
Guess what?
<Yoric[DT]>
Extracting a paper from OCaml source code is a boring task...
<rwmjones>
gildor, where f_ in that case came from:
<rwmjones>
module Gettext = Gettext.Program (
<rwmjones>
struct
<rwmjones>
let textdomain = "virt-mem"
<rwmjones>
let codeset = None
<rwmjones>
let dir = None
<rwmjones>
let dependencies = []
<rwmjones>
end
<rwmjones>
) (GettextStub.Native)
<rwmjones>
gildor, don't know if you have any idea about those ...
<rwmjones>
note that the code _does_ work fine, just the warnings are annoying and reduce type safety
MelanomaSky has quit [clarke.freenode.net irc.freenode.net]
szell` has quit [clarke.freenode.net irc.freenode.net]
shortc|desk has quit [clarke.freenode.net irc.freenode.net]
* Yoric[DT]
will take a break and eat something.
<gildor>
i think i know from where it come from
<gildor>
comes
MelanomaSky has joined #ocaml
szell` has joined #ocaml
shortc|desk has joined #ocaml
<gildor>
[A
Associat0r has quit [Read error: 60 (Operation timed out)]
<gildor>
but i don't think i will have time to correct it right now
<gildor>
rwmjones: could you submit a bug in my bts
<gildor>
rwmjones: but without kidding, ocaml-gettext check equivalence between string from the .mo and string to be translated regarding the format6 specification
<gildor>
format_of_string is a trick
<gildor>
(tm) INRIA, so it is better
<gildor>
but you cannot use it dynamically
<gildor>
you have to compile the string that will be casted statically
<gildor>
(maybe things have changed -- but i am not sure)
<gildor>
This expression has type string but is here used with type ('a, 'b, 'c, 'd, 'e, 'f) format6
<bluestorm>
gildor: format_of_string (Obj.magic foo) is as resilient as your "if ..." to impl. change, and clearer (you get the type specialization for free)
<gildor>
bluestorm: i am maybe wrong, but a year ago i have tried different things regarding this problem and conclude the thing about the if ...
<gildor>
i remember that the if ... construct allow to check and build the good type for the "else" branch and force the other type to have this good type
<gildor>
this was safer at the time i have tried to understand it
<gildor>
(i.e. in fact the type of the format is an interpretation of the string)
<gildor>
(providing the string to translate and his format allow you to have a good integration)
<gildor>
but i will look at your solution
guillem_ has joined #ocaml
seafood has quit []
<rwmjones>
no answer to my '() with' question then ...
<Smerdyakov>
rwmjones, what is the question?
<bluestorm>
rwmjones: i tried your code but didn't get it to work actually
<rwmjones>
hmm there are no archives for caml-list in august ...
<bluestorm>
use the google groups archive
<bluestorm>
they are updated more frequently
<rwmjones>
bluestorm, what version of ocaml are you using?
<bluestorm>
hm
<bluestorm>
3.10.2, but that's probably an error on my part
<Yoric[DT]>
Could anyone (preferably native English-speaker) give me a hand?
<Yoric[DT]>
I need a 5 pages-long paper proof-read.
<Smerdyakov>
Yoric[DT], 5 pages with what style? :)
<Yoric[DT]>
And let's just say that my team isn't quite up to the task.
<Yoric[DT]>
Smerdyakov: :)
<Smerdyakov>
If it's LNCS, then I'll do it.
<Yoric[DT]>
ACM, 2 columns
<Smerdyakov>
:(
<Smerdyakov>
What's it about?
<Yoric[DT]>
My C static analysis stuff.
<bluestorm>
"C analysis ? go to hell"
<Yoric[DT]>
:)
<Yoric[DT]>
It's quite vulgarized, as the target is a security track.
<Yoric[DT]>
That and the fact that I haven't written down any proof yet, so everything is bound to be false :)
<rwmjones>
excellent, bluestorm++
<Smerdyakov>
Eh, I think I'll pass, sorry.
* Yoric[DT]
understands.
<Smerdyakov>
You don't have anyone who sits near you who speaks English natively?
<Yoric[DT]>
Technically, I don't have anyone who sites near me.
<jynxzero>
Yoric[DT]: If you don't find anyone before tomorrow luncthime (BST) I'll have a look.
<Smerdyakov>
Yoric[DT], do you have an office?
<Yoric[DT]>
The rest of my team (including my two co-authors) are in holidays.
<Yoric[DT]>
s/in/on/
<Yoric[DT]>
jynxzero: thanks
<Yoric[DT]>
Probably not much of a big deal anyway, since I'm the only one who actually wrote anything.
<Yoric[DT]>
Plus I'm also the only one who did the research.
* Yoric[DT]
still doesn't quite get why he should put three names on this paper.
<Smerdyakov>
Whine whine whine.
<Yoric[DT]>
Smerdyakov: not at the moment, the lab is closed.
<Yoric[DT]>
Yeah.
<Yoric[DT]>
Well, that and writing papers instead of going on honeymoon.
<Smerdyakov>
You pay for your financial security by ceding this basic right.
<Yoric[DT]>
Do I?
<Yoric[DT]>
How so?
<Smerdyakov>
I don't think it's a good trade, but you chose to make it, so reverse the choice or live with it. :P
<Yoric[DT]>
:)
<Yoric[DT]>
Technically, not my choice, but I could hardly have gone on honeymoon without my wife :)
<Smerdyakov>
If you skip out of this "begging for funding" approach and instead build products that people want, you have much more freedom to do things in ways that make sense.
<Smerdyakov>
The reason you are putting extra names on the paper has to do with how you got paid to do the work, right?
<Yoric[DT]>
The reason is that one of these persons is my boss and the other person is his protégé.
<Yoric[DT]>
Whose PhD was already written by the aforementioned boss.
<Yoric[DT]>
But who might just be the right person to get us fundings.
<Yoric[DT]>
Not because of his skills, mind you.
<Yoric[DT]>
Well, anyway, enough complaining.
<Smerdyakov>
It sounds like you just answered "yes."
* Yoric[DT]
remains pissed off and looking for a better job anyway.
mrtes has joined #ocaml
mrtes has left #ocaml []
<Yoric[DT]>
Let's say "partially".
<Yoric[DT]>
(or is that "partly"?)
<Yoric[DT]>
Anyway, gottago.
* Yoric[DT]
will return.
Axioplase_ is now known as Axioplase
rog1 has joined #ocaml
lde has left #ocaml []
lde has joined #ocaml
Linktim has joined #ocaml
jeddhaberstro has joined #ocaml
jlouis has joined #ocaml
pango_ has quit [Remote closed the connection]
<twobitwork>
are there any libs for running ocaml programs across a cluster?
<twobitwork>
google isn't finding much...
pango_ has joined #ocaml
<flux>
jocaml and then there was this other thing I don't remember
<twobitwork>
jocaml seems interesting, thanks
<hcarty>
twobitwork and flux: ocamlp3l is another
<hcarty>
ocamlp3l is a set of libraries on top of OCaml, while JoCaml is a modification of OCaml itself
<Yoric[DT]>
I'd use camlp3l for most things, though :)
<Yoric[DT]>
(of course, I have tested neither, only JoCaml and OCamlMPI)
<hcarty>
jdh30: I've been able to get the example program to work, and done some sequential-mode playing around in the toplevel
<jdh30>
hcarty: thanks. i never tried very hard to get it to work but I just wrote a tutorial article about fork-based parallelism so I should probably cover camlp3l at some point.
<jdh30>
if I can do that before this wonderous parallel GC ships... ;-)
<Yoric[DT]>
:)
<jdh30>
Yoric: Found your own company.
<jdh30>
No more boss, no more funding, no more grant proposals, more wives.
<jdh30>
Ok, not more wives. But it is good...
<Yoric[DT]>
Not my kind of stuff.
<jdh30>
Why not?
<Yoric[DT]>
Plus I kind of doubt "no more grant proposals".
<jdh30>
Selling to customers is a much lower risk way to fund yourself.
<Yoric[DT]>
I don't want to spend my time looking for money.
<jdh30>
Then ship commodity products like books.
<Yoric[DT]>
So trading "grant proposals" for "looking for consumers" is not exactly my dream work.
<jdh30>
Looking for consumers is vastly easier: you just put credit card transactions on a website and let the orders roll in.
<Yoric[DT]>
Yeah, right.
<Yoric[DT]>
Plus that's much *less* interesting than what I'm doing now, static analysis of C or not.
<Yoric[DT]>
(at least to me)
<jdh30>
Our total expenditure on advertising over the past 3.5 years has totalled about £200 of Google ads which turned out to be a waste of money.
<jdh30>
Cornell just ordered 20 copies of OFS.
<Yoric[DT]>
You're John Harrop?
<jdh30>
Yes.
<Yoric[DT]>
Good book :)
<jdh30>
Thanks.
<jdh30>
I consulted for DataSynapse for two days last week: £2,000.
<Yoric[DT]>
I guess consulting could be fun.
<Yoric[DT]>
By I enjoy research.
<jdh30>
Microsoft bought F# for Scientists off us: £25,000.
<Yoric[DT]>
I just don't like my current lab.
<jdh30>
Most of what I do is still research but it is very practical research, which is precisely what I enjoy most.
<jdh30>
If you want to stay in academia, finding the best lab is really hard. I appreciate that.
<jdh30>
Staying there is even harder.
<jdh30>
I was fortunate enough to find an excellent lab by choosing my fourth year undergrad project carefully. The hard work paid off and I got my PhD position.
<Yoric[DT]>
My PhD position was great.
<jdh30>
But I failed to secure a post-doc position and had to leave academia. Looking back, I'm glad that happened though.
<Yoric[DT]>
On my post-doc position, I fumbled and ended up in a bakrupt University.
<Yoric[DT]>
s/bakrupt/bankrupt/
<jdh30>
Yeah, I really enjoyed mine. But it was a lot of hard work. Another one of my friends just bailed on his PhD.
<jdh30>
Easily done.
<Yoric[DT]>
Then I managed to dig my way out and into a good lab... just with a crap status which only appeared in the fine print.
<jdh30>
Incidentally, what are people's thoughts on the current applications of OCaml in technical computing?
<jdh30>
What effect does the bad status have on you?
<Yoric[DT]>
I'm not in the same city as my lab.
<Yoric[DT]>
That is, my teaching is not in the same city as my lab.
<jdh30>
BTW: In case you are forced to leave academia, I still highly recommend keeping a company alive on the outside so you can walk into it without having to get an "ordinary" job.
<Yoric[DT]>
Door-to-door: 2h.
<jdh30>
Ugh.
<jdh30>
Bedroom 1 to bedroom 4 (office) is about 2s for me. :-)
<Yoric[DT]>
:)
<Yoric[DT]>
What do you mean "keeping a company alive"?
<Yoric[DT]>
Creating a company or joining one?
<jdh30>
Getting a company off the ground takes a lot of time.
<jdh30>
I mean creating one.
<Yoric[DT]>
I'm not really tempted by the creation of a company.
<jdh30>
The first two years of FFC basically entailed getting a little recognition for a couple of products over a period of two years.
<jdh30>
Getting Google to notice you etc.
<twobitwork>
ok, I lied... I can't actually find the debian package for ocamlp3l
<Yoric[DT]>
A few times, I could have (I used to be a pioneer of eBooks, back when I was 12 years old).
<jdh30>
I don't think there is a Deb for that. I had trouble compiling it from source, IIRC.
<Yoric[DT]>
But every so often, I consider joining a start-up.
<jdh30>
I used to do graphic design for venue tickets before I went to Uni.
<jdh30>
There are two kinds of startup...
<Yoric[DT]>
Right now, I'm in touch with a start-up which seems quite nice.
<jdh30>
Great. What are they doing, or is it secret?
<jdh30>
OCaml?
<Yoric[DT]>
They base their work on research (and OCaml) and they have secured what seems to be a nice funding.
<Yoric[DT]>
NDA
<Yoric[DT]>
(well, not a formal one, but still)
<jdh30>
That's one kind of startup. The other is the kind without funding.
<jdh30>
NP
<Yoric[DT]>
Right now, I'm more interested in working with them than in working for them.
<Yoric[DT]>
But I keep my options open.
<jdh30>
They may well employ you as a consultant, as Wolfram Research, XenSource etc. did for me.
<jdh30>
Helps if you can say: "I wrote the book on the subject" though. ;-)
<Yoric[DT]>
:)
<Yoric[DT]>
I'm currently working on a book on OCaml.
<Yoric[DT]>
I have three chapters.
<jdh30>
Excellent. OCaml desperately needs more decent books!
<jdh30>
That's a good start.
<Yoric[DT]>
I need to find some time to carry on the work, though.
<jdh30>
If you want to make money from it, publish it yourself and sell it at a similar price to mine.
<Yoric[DT]>
I'm currently staying far from your book so as not to fall into plagiarism.
<Yoric[DT]>
(I meant physically far away, as in "not opening it")
<jdh30>
LOL, no problem
<jdh30>
I'm sure there won't be a problem.
<Yoric[DT]>
From what I recall of your book, there probably won't be any problem.
<jdh30>
There are plenty of aspects to cover that people are crying out for and OFS doesn't cover.
<twobitwork>
OFS?
<jdh30>
OCaml for Scientists./
<Yoric[DT]>
While I like your book very much, I'm trying to convey a very different insight.
<twobitwork>
ahh
<twobitwork>
what about engineers? :P
<jdh30>
You could probably write a book on each of the chapters from mine. I'd like a book on "Structuring OCaml programs".
<jdh30>
Good idea.
<jdh30>
Yes. OCaml for Engineers. A radical departure. ;-)
<jdh30>
Hey, nobody answered my question: who is using OCaml now?
<Yoric[DT]>
I am.
<jdh30>
I believe computational linguists, bioinformaticians.
<twobitwork>
you mean, at a job and getting paid for it?
<jdh30>
What for?
<jdh30>
No, I was thinking of academia.
<Yoric[DT]>
Static analysis of C programs.
<twobitwork>
ohh
<jdh30>
Surprisingly, academics seem more willing to pay for books than industrialists.
<twobitwork>
Yoric[DT]: way to rub it in C's face :)
<Yoric[DT]>
:)
<jdh30>
XenSource refused to buy OFS because £85 was too much but they pay £35k in consultancy instead...
<hcarty>
jdh30: Atmospheric science here
<jdh30>
Static analysis of C programs is very deep comp-sci.
<jlouis>
jdh30, 'who is using ocaml now' <- context?
<jdh30>
Atmospheric science. Yes. My first customer did that.
<Yoric[DT]>
jdh30: more precisely, writing a high-level type system for C.
<jdh30>
I suppose the context is that I've noticed a shift in customer base away from physical scientists towards all other kinds of scientists.
Linktim has joined #ocaml
<jdh30>
Well, maybe atmospheric science is physical science but I am totally unfamiliar with it.
<jdh30>
Dr Fischbacher and I may be the only physicists left... :-)
<hcarty>
Definitely a physical science...
<jdh30>
My guess is that OCaml's awesome parsing capabilities play a key role for other kinds of scientists, because they are often having to munge huge data sets in exotic formats.
<twobitwork>
I'm convinced its also a branch of politics as well... but we won't go there
<Yoric[DT]>
:)
<jdh30>
Can you describe atmospheric science to a physicist for me?
<jdh30>
I really hope those guys pull off the parallel GC: I think it will give OCaml a serious boost in interest.
<hcarty>
Fluid dynamics, optics, radiative transfer are large components
* Yoric[DT]
would love to have that //GC.
<jdh30>
I see. So it isn't such unfamiliar territory after all.
<twobitwork>
jdh30: I thought they gave up on it?
<jdh30>
Yoric: absolutely.
<Yoric[DT]>
Everything else I have issues with, I think I can fix myself :)
<jdh30>
Don't say that. Oh, do you mean INRIA gave up on theirs? Yes. They never got it to work.
<twobitwork>
ahh
<flux>
hm, didn't it use to work for caml-light or something?
<vixey>
is it hard to write a parallel gc?
<gildor>
hcarty, twobitwork: the package is about to be uploaded in debian
<twobitwork>
gildor: ahh
<vixey>
what is involved?
<jdh30>
I'm not so sure actually. If I can put enough money away my pet project would be to develop a new OS OCaml derivative with some of F#'s features and probably built upon LLVM with a concurrent GC.
<gildor>
it is standing right here, in my local git repository
<flux>
vixey, I don't know, but I do believe it's hard to write a parallel gc that is actually fast
<gildor>
i need to fix the last build depends and upload
<jdh30>
Vixey: Efficient concurrent GCs are almost impossible to write. Sun and MS are essentially the only groups ever to have built them.
<vixey>
why is it a hard problem?
<jdh30>
flux: Parallel is not so hard (which is why there is a good chance we can get one for OCaml, just as Haskell has one) but they are only a stop-gap measure.
<jdh30>
You need a real concurrent GC if you have >4 cores, which my next machine will have.
<jdh30>
Vixey: the usual concurrency issues. You need an overall design that never requires the whole system to be synchronized, that alone is hard. Then you have to implement it with minimal locking and shuffling work around to alleviate hot spots (e.g. nursuries).
<flux>
and is shared memory parellellism really an option for many cores?
<jdh30>
Flux: I believe so, yes.
<Yoric[DT]>
I'm not that sure.
<jdh30>
Multicore is critical ATM and shared memory is a key feature of all multicore machines.
<flux>
don't larger systems usually have NUMA - cpu's have local memory?
<flux>
albeit they can access remote memory too, but it's slower
<Yoric[DT]>
Cell (and other SoC) typically have essentially local memory.
<jdh30>
Flux: Yes, memory is not uniform but, then, levels of caches have meant that memory has not been uniform since I was a child (when direct memory access cost 1 cycle).
<jdh30>
Exactly.
<jdh30>
The issue is that they can read function inputs from shared data structures and write function results to shared data structures.
<jdh30>
Fork lets OCaml do the former (this is exactly what my latest article was about) but you still cannot do the latter. You can use nasty hacks like RJ's Ancient module but they can break the run-time and render your whole program unsafe, making it worse than C.
<flux>
and if you don't have really working cache coherency protocols in place, synchronizing that access can be a problem
<flux>
I do wonder how much further such systems can be streched
<jdh30>
The difference in performance is huge, BTW. People on the OCaml list keep saying that OCamlers can just use the same tools that people use for distributed concurrent apps (i.e. message passing) but they are horrendously inefficient on multicore machines.
<flux>
do they need to be?
<Yoric[DT]>
Otoh applying multicore stuff to machines which are essentially networks brings the contrary problem.
<jdh30>
Flux: To about 256 cores, which gives us about 10 years. In other words, OCaml will become slower and slower over the next ten years until it is around 100x slower at which point everyone will have to resort to message passing but OCaml will remain 100x slower if this is not fixed.
<jdh30>
So this is really serious.
<jdh30>
Yoric: I was reading a paper about this recently where a group had implemented a concurrent GC for a distributed system and they claimed good results.
mishok13 has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
With shared memory?
<Yoric[DT]>
That is, with a shared memory layer?
<jdh30>
Not shared memory.
<flux>
jdh30, but what I don't understand is why would message passing need to be slower than shared memory, when shared memory is essentially implemented in terms of message passing
sporkmonger has joined #ocaml
<jdh30>
I don't believe so.
<twobitwork>
do ocamlopt generated binaries have ocaml-specific library dependancies?
<Yoric[DT]>
flux: on multi-core, it's hardware message passing, which does make things a bit different.
<Yoric[DT]>
Well, gottago.
<jdh30>
Flux: hardware acceleration. That is the same as asking why software renderers are slower than GPUs even if they both draw triangles.
<Yoric[DT]>
I'll be back later.
<twobitwork>
or can you just plop them on another machine with the same standard libraries and arch and expect them to run?
<jdh30>
twobitwork: what is your motivation for asking?
<jdh30>
BFN
<twobitwork>
I want to run my test program on a faster machine which doesn't have ocaml installed :)
<twobitwork>
BFN?
<flux>
jdh30, so, there could be hardware accelerated message passing too?
<jdh30>
twobitwork: at least if you are using OGL, you cannot expect them to be portable binaries. This is the reason we pulled our Presenta product (250kLOC of OCaml): it was very unreliable on customers' machines.
<jdh30>
"Bye for now" to Yoric.
<jdh30>
Flux: exactly.
<twobitwork>
ok, now what is OGL?
<jdh30>
twobitwork: you may have more luck without OGL though.
<jdh30>
OpenGL
<twobitwork>
ohh
<jdh30>
LablGL specifically.
<twobitwork>
yeah, no prob
<jdh30>
Depends what libraries you use though. This is one of my pet gripes with OCaml BTW: it makes it almost impossible to sell compiled OCaml code.
<jdh30>
I'd love it if OCaml had a viable commercial market for libraries... :-)
<jdh30>
Ah, so many ideas for improvements. :-)
<jdh30>
Anyway, I am interested in diversifying. We've got F# covered. What language should I look at next?
<jdh30>
I've looked at Scala and Haskell and I think they are not as good, BTW.
* Yoric[DT]
would have thought Scala, actually.
<jdh30>
Yoric: hello again. :-)
<jdh30>
Yes, I studied Scala for a couple of months last year but eventually gave up on it. I also caused a bit of a stir on their mailing list.
<Yoric[DT]>
How did you do that?
<jdh30>
Someone quoted me as saying that I thought the Scala team were trying to improve upon the current state of the art without being aware of the current state of the art (e.g. OCaml and F#).
<jdh30>
That caused a problem so I deviously laid some bait and the lead dev of Scala fell for it. So I left feeling justified.
<jdh30>
IMHO, functional PL researchers are too incestuous.
<twobitwork>
my understanding is that there's a small meme pool to draw from
<jdh30>
You don't get that in mainstream physics, so researchers aren't afraid to speak their minds.
<jdh30>
exactly.
<jdh30>
well...
<jdh30>
they are so worried about upsetting each other and jeopardising their futures in functional PL research that they just brown nose and avoid saying anything critical.
<jdh30>
I personally hate that (as you can probably tell). I think I get it from my Russian PhD supervisor, who was never afraid to speak his mind. :-)
<Smerdyakov>
jdh30, what is it you think Scala developers need to be aware of that comes from OCaml or F#?
<jdh30>
There is also a really serious problem that they are too afraid to test their work in the real world, so they develop ideas because they believe they would go down well in the real world. Which is why they have collectively developed some really stupid ideas...
Linktim has quit [Read error: 110 (Connection timed out)]
<twobitwork>
jdh30: that's true even in the FPL user community. A lot of times griping about certain reprocusions of this or that aspect of some language will get people sneering about how you just aren't using it right
<twobitwork>
then they point you to some research paper which is writen in the typical academicker then thou language which is over your head
OChameau has quit ["Leaving"]
<Smerdyakov>
twobitwork, I don't know. If it's over your head, that might just be _your_ problem.
<twobitwork>
well... something which I find to be very natural and simple to express in a strict language I had a very hard time implementing in constant space with a lazy language
<jdh30>
Smerdyakov: the utility of features like statically checked pattern matching, polymorphic variants, characteristics of OCaml's object system.
<Smerdyakov>
jdh30, Scala doesn't have statically-checked pattern matching?
<jdh30>
Essentially the features that separated OCaml from its predecessors.
<jdh30>
Only partially statically checked.
<Smerdyakov>
OK. That's too bad.
<jdh30>
For example, Scala cannot even determine that "true | false" covers all of the possibilities of a boolean.
<jdh30>
Yes, that sucks a bit.
<jdh30>
But Scala has vastly more serious "problems".
<Smerdyakov>
I'm just against OO in general, so I have no interest in the idea of Scala, let alone interest in whatever particular design and implementation they have today.
<jeddhaberstro>
jdh30, how much does your book cost in $?
<jdh30>
Scala has long since been hyped as a functional language but I would contest that. Lack of tail calls put you back to pre-Scheme FPLs.
<jdh30>
jedd...: £85 is US$170. 30% off for academics.
<jeddhaberstro>
ouch
<jdh30>
Assuming you mean OCaml for Scientists.
<jeddhaberstro>
yes
<jeddhaberstro>
I can't afford that :(
Axioplase is now known as Axioplase_
<jdh30>
F# for Scientists is much cheaper because it is published by a mainstream publisher.
<jeddhaberstro>
Ah, good to know :)
<jdh30>
If you cannot afford it then your best options are to get your library to buy a copy.
<jdh30>
Academic libraries get 30% off as well.
<jeddhaberstro>
True
<jeddhaberstro>
I could probably get that to happen
<jdh30>
Academic research groups often buy copies as well.
<jdh30>
Glad to hear it. :-)
<jdh30>
Anyway, about Scala.
* Smerdyakov
is dubious about the value of those books.
Linktim has joined #ocaml
<jdh30>
I agree that OO sucks donkey brains through a straw.
<jeddhaberstro>
Maybe I'll be able to buy it in the near future. I'm starting a new job soon that pays really well (considering I'm 16 years of age), so maybe then :0
<jdh30>
If you're pre university then I shall extend the academic discount to you as well.
<jeddhaberstro>
:)
<jeddhaberstro>
Thanks
<jdh30>
Drop me a mail.
<jeddhaberstro>
Will do when I've got the cash!
<Smerdyakov>
jeddhaberstro, have you encountered some problem that you think you should solve by reading that book?
<jdh30>
Drop me a mail before you have the cash
<Smerdyakov>
jeddhaberstro, I'm curious as to why you want it.
<Smerdyakov>
jeddhaberstro, Jason Hickey's OCaml book draft is available for free online ATM.
<jeddhaberstro>
I'm a game programmer, so I could see the book being very helpful
<jdh30>
Girls dig OFS.
<vixey>
enthusasm is more important
<jeddhaberstro>
That, and the book looks like a very interesting read.
<Smerdyakov>
jeddhaberstro, I imagine domain-specific details will only help you if you're very unimaginative.
<jdh30>
Jason Hickey's book is also being published by Cambridge University Press, IIRC.
<vixey>
I wonder if I could write some programming books
<vixey>
that would take ages
<jdh30>
The single biggest problem with Scala compared to languages like OCaml is lack of automatic generalization in type inference. That completely destroys the productivity of the language.
<jdh30>
Vixey: Absolutely. I think there is a serious market for such books. Indeed, I have proven that there is...
<Smerdyakov>
jdh30, I'm going to have to disagree with you there. It depends on what you're doing.
<wolgo>
Hi
<jdh30>
When can lack of automatic generalization not suck?
<Smerdyakov>
jdh30, principal typing is incompatible with expressive type systems, and you need to make trade-offs somewhere.
<vixey>
which languages need good books?
<vixey>
every language I know has a bunch of very good books...
<wolgo>
The ocaml tutorial is pretty good.
<jdh30>
Vixey: OCaml desperately needs more books on everything from program structure to games programming. Haskell desperately needs practical books. Scala books aimed at idiots might sell. F# still has room for more books, e.g. a decent basic introductory book that does not assume that you have either a decade of experience with C# or a degree in science.
<wolgo>
ocaml could use a good beginners book, with exercises I think.
<jdh30>
I'm not sure about Erlang.
<jdh30>
The OCaml tutorial is great but I believe it is an orthogonal market to a book.
<Smerdyakov>
I bet against all of OCaml, Haskell, Scala, and F# to be in use in 20 years, to any great extent.
<jdh30>
Wolgo: absolutely.
<Smerdyakov>
So I couldn't really care less if they have good books.
<jdh30>
OCaml and F# are already used to a great extent.
<Smerdyakov>
jdh30, and I'm saying they won't be in 20 years. No contradiction there.
Jedai has quit [Read error: 110 (Connection timed out)]
<jdh30>
You mean they'll die.
<jdh30>
?
<Smerdyakov>
Yup.
<jdh30>
Interesting.
<Smerdyakov>
Their type systems are toys compared to what we know how to do now.
<vixey>
hmmm if I only had been writing games in ocaml for a couple years
<jdh30>
20 years is a long time so that may well be right. I think F# will still be in serious use in 10 years.
<wolgo>
Are there any newbie books for ocaml?
<wolgo>
google here I come!
<jdh30>
They may be toys but we know developers can master them. What improvements are you thinking of?
<wolgo>
actually, you know what, practical ocaml is lame
<Smerdyakov>
In 20 years, we will have one general purpose language that most resembles Coq, among today's languages; and almost all development will actually be done in restricted DSLs.
<wolgo>
I know that
<Smerdyakov>
wolgo, I bet Jason Hickey's book is the best.
<wolgo>
It has a bunch of code examples. But it does not challenge the reader.
<wolgo>
I like exercises
<wolgo>
I think the more pissed off I get about not being able to solve something, the more I learn
<Smerdyakov>
wolgo, why don't you prefer to have projects you actually about, and to learn by trying to complete those projects?
<jeddhaberstro>
An OCaml book teaching how to structure a program and at the same time teaches functional programming (ignores all the OO and imperative features of OCaml - for the most part) would be nice.
<Smerdyakov>
s/you actually about/you actually care about
<vixey>
yeah instead of a one page program write something real
<vixey>
it really is the best way to learn
<vixey>
Why does everybody insist on writing pure code in scheme and ocaml today?
<wolgo>
Smerdyakov: Well, that is the issue exactly, I would like a book that ins't "hello world" but instead says "Implement X practical project using Y techniques learned from this chapter"
<wolgo>
I agree that writing code is the best way to learn. I have little programming experience and I learned more about java and python by writing the code than Bruce Eckels BORING AS HELL
<wolgo>
book
<wolgo>
It was a good book though.
<wolgo>
I learned a lot from it hahah
<jeddhaberstro>
vixey: I want to write code in a pure functional paradigm just to learn the paradigm. Many texts like to intertwine the two
<wolgo>
Anyhow, since I am interested in learning ocaml I am going to go write some newbie ocaml now! Time for some hangman!
<Smerdyakov>
wolgo, I think you should change the way you think, if you want to improve as a programmer.
<wolgo>
Smerdyakov: Tips?
<Smerdyakov>
wolgo, I wasn't suggesting "implementing practical projects that a book suggests."
<Smerdyakov>
wolgo, if you don't already have programs in mind that you want to write, then you are unlikely to ever get really good at programming.
<wolgo>
Yeah, that is something I run into a lot
<wolgo>
No inspiration
<wolgo>
Smerdyakov: What about joining in on projects?
<Smerdyakov>
For me, there are way too many pieces of software that ought to exist that don't. It's more of a problem of triage than "finding motivation."
<wolgo>
really?
<wolgo>
maybe I am lazy as hell
<Smerdyakov>
wolgo, most elite programmers learn by completing some big projects on their own, I think.
<wolgo>
Oh okay
<wolgo>
Well I have some ideas, I just dont have the knowledge to support my ideas
<wolgo>
That is my problem.
<Smerdyakov>
That's not a problem.
<Smerdyakov>
You just have to get started.
<Smerdyakov>
Never put off a project because you don't know how to complete it.
<Smerdyakov>
Just get started and figure things out a piece at a time.
<Smerdyakov>
(This is the only way to learn anything, BTW. :P)
<wolgo>
Not that it would be useful but here is one of my ideas: I want to write a crawler that finds every incorrect use of you're and your and things like ur, funner (FUNNER IS NOT A FRIGGEN WORD) and other useless grammar. I would like to take the total amount of words and find the percentage of "slanguage" that is used.
<Smerdyakov>
I have to agree that it wouldn't be useful. :P
<wolgo>
It would serve well to fuel the rage though.
<wolgo>
AND!
<wolgo>
It would teach me how to write a crawler
<wolgo>
and insert data into a database
<wolgo>
(which would be the purpose)
<wolgo>
meh
<Smerdyakov>
That's a good side effect, but it would be better if the final product really is of independent value.
<wolgo>
Haha true.
<wolgo>
I am insane
<wolgo>
Smerdyakov: You made some good points.
jeddhaberstro_ has joined #ocaml
<Smerdyakov>
You want a hot tip? I think a lot of the action coming up will be in good design and implementation of domain-specific languages.
<wolgo>
I really appreciate that input.
<Smerdyakov>
Find a domain where you can design and implement a language to boost productivity a bazillionfold.
<wolgo>
Is that what you do?
<Smerdyakov>
Yes.
<Smerdyakov>
Some of the time.
<Smerdyakov>
I split my time between formal verification and design & implementation of DSLs.
<twobitwork>
re: DSLs... if we could find something better than camlp4 we'd be in good shape
<wolgo>
I will be going to my first year of CS soon.
<Smerdyakov>
twobitwork, it's hardly a problem to write a new Yacc grammar for each DSL. It's a pain, but the effort rounds down to zero with a big-picture perspective.
<wolgo>
GAGH, starting my first year of cs
<Smerdyakov>
twobitwork, and OCaml has too weak a type system to support embedded DSLs well.
<Smerdyakov>
twobitwork, I plan to design & implement a language that works better for that purpose, but that's at least a few years off/.
<Smerdyakov>
In any case, parsing is far from a dominant issue in DSL implementation.
<wolgo>
I am going to learn ocaml
<vixey>
hi wolgo
<jdh30>
Wolgo: The Little MLer is a beginner book for SML.
<vixey>
oh that is a nice book
<wolgo>
hi vixey
<wolgo>
How close is standard ml to ocaml?
<jdh30>
I have not read it myself but it is well reputed.
<jdh30>
Fairly.
<wolgo>
It should translate easily though after I learn one no?
<vixey>
yes
<vixey>
the book points out differences
<jdh30>
For the basics, different syntax (SML is slightly more verbose), OCaml adds some practical features like printf, marshalling and so on.
<Smerdyakov>
I prefer SML to OCaml, personally.
<jdh30>
OCaml also has a lot more users, libraries and "real world" software.
<Smerdyakov>
The counterbalance jdh30's presentation, the main practical disadvantages (IMHO) of OCaml are bad compilation technology and a closed development model.
<jdh30>
What do you mean by "bad compilation technology"?
<jdh30>
None of the SML compilers come close to the performance of OCaml on numeric code.
<jdh30>
MLton has a relatively poor x64 code gen and SML/NJ is just generally slow (due to CPS?)
<jdh30>
SML also lacks array literals.
<jdh30>
and all the advanced features like polymorphic variants, structurally-typed objects and so on.
<jdh30>
labeled and optional arguments...
<jdh30>
structural hashing...
<Smerdyakov>
OCaml has no optimizing compiler.
<vixey>
what about ocamlopt?
<jdh30>
You mean whole program optimizing compiler?
<Smerdyakov>
Nope. OCaml has no compiler that performs non-local program analysis.
<Smerdyakov>
You have to write what you mean to have happen in machine code in OCaml, to get good performance.
<Smerdyakov>
Not so with SML and MLton
<vixey>
what is that?
<jdh30>
Then why do object files contain function definitions for inlining?
<Smerdyakov>
jdh30, you don't need analysis for inlining.
<jdh30>
And why would you want compilers that do more optimzations in theory when they are so much slower in practice?
<vixey>
Smerdyakov: is that everything bigger than tail calls?
<Smerdyakov>
vixey, I guess I mean dataflow analysis.
<Smerdyakov>
jdh30, what kind of evidence do you have that code written to be readable performs worse with MLton than ocamlopt?
<Smerdyakov>
jdh30, code using the kinds of abstraction and modularity that make so many people love ML
<jdh30>
I'd much rather have a CLR than wider program analysis.
<jdh30>
Everything from my Mathematica implementations to my numerical codes.
<vixey>
so dataflow analysis annotates the syntax with some information
jeddhaberstro has quit [Read error: 110 (Connection timed out)]
<jlouis>
CLR?
<vixey>
and then what do you do with it ?
<jdh30>
Common language run-time.
<jdh30>
Primarily, I'd like OCaml to support its own DLLs properly.
<Smerdyakov>
jdh30, can you point me to one example?
<vixey>
could you tell me an example of such a optimization?
<twobitwork>
jdh30: yes!
<Smerdyakov>
vixey, read a compiler textbook if you want to know.
<twobitwork>
dynamic linking would be very nice
<vixey>
I read one already :[
<jdh30>
Vixey: MLton can unbox data structures.
<jlouis>
vixey, constant propagation for instance.
<Smerdyakov>
vixey, Appel's?
<vixey>
yes
<vixey>
good guess
<jdh30>
For example, my OCaml implementation of the core of Mathematica used heavily nested variant types to represent the data structures in a programmer-friendly way. This is exactly what Smerdyakov was referring to.
<jlouis>
vixey, IIRC, Tiger book: Chapter 17 ;)
<vixey>
lol, no compiling with continuations
<jlouis>
oh!
<vixey>
I don't remember if it covers this ...
<jdh30>
However, MLton's code gen is so poor that despite these optimizations (which make compilation orders of magnitude slower), it still cannot match OCaml's performance unless the code is purely symbolic.
<jdh30>
I cannot provide examples: they were done under NDA.
<jdh30>
Or they represent our own code bases...
<jlouis>
jdh30, I agree that MLtons codegen does things which are very odd at times
<jdh30>
twobitwork: dynamic linking is exactly what I was referring to, yes.
<jdh30>
None of the compilers for any of those languages can exploit multicores properly anyway, so this is only of historical interest now.
<jdh30>
IMHO.
<vixey>
when can you not unbox a value?
<jdh30>
When it is already unboxed?
<jdh30>
What are you referring to?
<Smerdyakov>
jdh30, then forgive me for not believing you. :P
<wolgo>
What ml version is the standard? sml/nj?
<Smerdyakov>
jdh30, also, hardly any programmers care about floating point.
<vixey>
just wondering about this optimization
<Smerdyakov>
wolgo, there is no "standard" in the sense you probably mean.
<wolgo>
By standard I should say "implementation"
<wolgo>
like lisp has over 9000 different implementations
<vixey>
no it doesn't
<jdh30>
Wolgo: SML/NJ is the defacto-standard.
<wolgo>
I will just use this one
<wolgo>
Oh okay
<wolgo>
thanks
<jlouis>
vixey, suppose you have (x, y). You can represent that as a pointer to a 2-cell object in the GC heap. But if x, y has type int, it might be more clever to just represent them in registers if possible
<jdh30>
Smer: That is the problem I was referring to before: without testing your theories on real code you cannot draw any reliably conclusions.
<mbishop>
and OCaml is...well it's the only implementation for OCaml, that makes it easy :P
<jdh30>
Smer: For example, you just asserted that floats are rare in real code.
<vixey>
oh ok
<jlouis>
vixey, mlton has some really powerful representation analysis for figuring out when that can happen
<jdh30>
mbishop: yes.
ygrek_away has quit ["Leaving"]
<vixey>
do more expressive type systems let you unbox more things?
<jdh30>
It is also worth mentioning that the most practically-useful optimizations done by whole program optimizing compilers like MLton can also be done by JIT compilers, e.g. monomorphization.
<Smerdyakov>
jdh30, floats are rare in the code I write.
ygrek_away has joined #ocaml
<jlouis>
vixey, one advantage of having a full type-zoo is that you have a choice on representation of data. A 'bool array' has a fast representation for instance
<jdh30>
Smer: forgive me for not believing your generalization then. :P
<jdh30>
jlouis: for some definition of "fast".
<jlouis>
vixey, in general: the more you know about the type of a value, the more can you optimize its representation
<jlouis>
jdh30, ok, space efficient then ;)
<jdh30>
jlouis: that is the theory but it simply does not work in practice. These compilers end up wasting huge amounts of compilation time optimizing portions of a program that are not performance critical.
<jdh30>
You bool array is an excellent example. A bit vector is not necessary faster, so that extra type information is useless.
<jlouis>
jdh30, I am not a proponent of optimizing compilers ;)
<jdh30>
good. :-)
<jdh30>
at least for whole-program optimizing compilers. ;-)
<jdh30>
This is one of the things that I really like about OCaml: its performance is transparent and predictable so optimization is feasible. MLton makes optimization almost impossible and produces slow code to boot.
<Smerdyakov>
Symbolic computation is much more important in reality than numerical computation.
<jdh30>
Smer: You wouldn't happen to be an academic doing only symbolic computations for a living, would you?
<jdh30>
Do you consider drug design, civil engineering, aerospace etc. to be "unimportant"?
<Smerdyakov>
I'm talking only about volume of software written.
* Yoric[DT]
will carefully step far away from that conversation.
<Smerdyakov>
Also, I guarantee you, for any code generation problem you find in MLton, I can find you a dozen people who could fix it in a week.
<jlouis>
jdh30, I have this notion of 'scalability with respect to performance'. A good language lets you start with a correct implementation and allows you to layer more and more speed into it gradually. The ability to write 'assembly' when needed is crucial.
<Smerdyakov>
OCaml's problems run deeper. ocamlopt just isn't set up for pervasive program analysis.
Linktim has quit [Read error: 110 (Connection timed out)]
<jdh30>
Mathematica is an obvious counter example. It started off as a symbolic mathematics package that few people bought. Wolfram became a billionaire when he discovered that people want FFTs, NDSolve and graph plotting.
<jdh30>
Smer: Only if you consider that to be a problem. I think ocamlopt has problems but that is not it. Lack of JIT is far more important IMHO.
<vixey>
How do you implement a JIT?
<jdh30>
Smer: I don't doubt that people couldn't fix it, but the fact that it has never been fixed is more important. Not least because one of its lead developers is now a pro OCaml coder at Jane St. :-)
<jdh30>
Using LLVM. :-)
<Smerdyakov>
jdh30, which developer do you mean?
<jlouis>
Stephen ;)
<Smerdyakov>
jdh30, oh, you meant MLton.
<jdh30>
jlouis: I agree completely and this is one of the reasons I'm not advocating Haskell. It is a very cool language but unpredictable performance is a complete show stopper.
<jdh30>
Yes
<jdh30>
Yes
<Smerdyakov>
jdh30, your problem is that you are afraid to work on language implementation.
<Smerdyakov>
jdh30, people in that category are going to be run out of the business.
<jdh30>
Almost. My problem is that I cannot afford to work on language implementation.
<Smerdyakov>
jdh30, the firmament of development tools is not fixed, and people who think that way will sink.
<Smerdyakov>
jdh30, OK. You can't afford it, so people like me who can will put you out of business. :P
<jdh30>
Except that the people who can afford it lack the knowledge to do a good job of it, which is precisely why we are in the current situation.
<Smerdyakov>
I'm going to have to disagree.
<Smerdyakov>
If someone points me to an example of bad code being generated, I can fix it.
<Smerdyakov>
I don't have to understand all possible applications to do that.
<jdh30>
The problem is not one of bad code being generated. The problem is one of missing functionality.
<jdh30>
I am not saying that you have to understand all applications. I am saying that you need accurate market research about what people actually need. There is no point in developing more languages based on speculation from a very narrow perspective.
<jlouis>
vixey there are a couple of strategies, for implementing JITs
<jdh30>
For example, OCaml will hopefully get dynamic loading of native code in 3.11 and maybe even a top-level that leverages this to get decent performance (it is currently many times slower than Lisps and F#).
<Smerdyakov>
jdh30, if someone tells me what he needs, I can implement it.
<jdh30>
If OCaml went to a whole program optimizing compiler that would either prohibit such dynamic loading or it would make it incredibly slow.
<Smerdyakov>
jdh30, you're tripping. Just look at SML/NJ and MLton. You get your cake and eat it, too.
<jdh30>
Smer: I believe people need a really easy to use FFI to C and a
<jdh30>
No, you don't. Not by a million miles.
<Smerdyakov>
jdh30, why not?
<jdh30>
They introduce even more problems of their own.
<vixey>
yes?
<jdh30>
Look at easy to use hash tables, printing (printf), no array literals and all those problems. These stifle basic programs. They stifle learning and they make it significantly harder to use SML as a scripting language for technical computing.
<Smerdyakov>
jdh30, what does that have to do with being able to get both whole-program optimization and rapid development/REPLing? MLton and SML/NJ accomplish that as a team.
<jdh30>
OCaml fixed loads of problems with SML but it introduced its own. SML's equality types are better than OCaml's lack of safety but, objectively, it sucks compared to OOP or type classes.
<jlouis>
vixey, it is to hard to explain over IRC ;)
<jdh30>
Whole program optimization is a misguided desire.
<jdh30>
People want speed.
<jdh30>
SML compilers don't provide speed.
<Smerdyakov>
jdh30, you're just out of your mind. MLton works really well. Floating point is a niche.
<jdh30>
From the user's point of view, they want characteristics like ease of use, scalability and performance. They don't care if it does whole program optimization under the hood.
<jdh30>
Sure, Sudoku is popular and calculus is a niche.
<jdh30>
Just look at the hoop jumping you have to do using functors in these languages just to implement Set or Map. Then look at the hoop jumping you have to do for simple arithmetic over a variety of types.
filp has joined #ocaml
<jlouis>
jdh30, at least it doesn't involve IO in a Monad ;)
filp has quit [Client Quit]
<jdh30>
Users want to associate hash functions, equality functions, custom serialization functions and so on with the type. They don't want to scatter code around functors and introduce unnecessary complexity just because ML developers deem the mainstream solutions (already widely known to work better) as "un-ML".
<jdh30>
Haskell does this better. F# does this better.
<jdh30>
These are the features I believe people want. Far more than whole program optimization.
<jdh30>
People also want concurrent GCs as the JVM and .NET already provide.
<jdh30>
I'll wager the ML community cannot satisfy that need.
<jlouis>
I wouldn't like to have a concurrent GC
<Smerdyakov>
I won't argue against type classes, but MLton's optimizations are more important to me.
<jlouis>
that is *definitely* not the solution to the multicore problem
<jdh30>
jlouis: Why not?
<jdh30>
It already solved the problem AFAICT.
<vixey>
yeah pH looked really cool
<vixey>
it seems like they kind of gave up on the fundamental ideas of it though
<jdh30>
What is pH?
<jlouis>
jdh30, if you still work with the notion of one shared heap, we are dead at around 32 cores
<jlouis>
concurrent/parallel GC will perhaps scale to 8 cores I think
<vixey>
it was supposed to be an implicitly parrallel haskell like language but I think it ended up just inventing a few useful concurrency primitives for haskell
<jdh30>
jlouis: Not "dead". You just split your future manycore machines in clusters of 32 local cores that share heap.
<vixey>
anyway, it would be interesting to have implicitly parallel language
<vixey>
s
<jlouis>
jdh30, and indeed you will need something new there. Hence I am not too keen on concurrent GC which is hard to implement correctly
<jdh30>
jlouis: GHC's parallel GC showed worsening performance for one benchmark moving from 4 to 8 cores. Microsoft's .NET is already running well on 256 CPU shared memory machines.
<jlouis>
Does it run well on the Cell-BE with its 2 ring-buffers around the SPE's ?
<jlouis>
IMO it is much more interesting to look at how to fix that
<jdh30>
jlouis: No idea.
Linktim has joined #ocaml
<jdh30>
Vixey: I am not sure an implicitly parallel language will be very useful. The difficulty in parallelizing code is not exposing parallelism, it is working out when to exploit the parallelism because the overheads involved are small enough to make it beneficial.
<jdh30>
Implicit parallelism doesn't help with that.
<jdh30>
Why is that more interesting?
<vixey>
jdh30: yes I agree but my hope was that (like programming in a completly pure lazy language, or non-det evaluation model, or ..) programming in it would be lead to new understanding about concurrency
<vixey>
that's why I'm disappointed at the way it went anyway
<jdh30>
Vixey: For concurrency, yes. But concurrency and parallelism are not the same. Parallel programming is about maximizing throughput and you're not going to do that by starting with a slow language like Haskell. ;-)
<jdh30>
Concurrent programming is a whole other kettle of fish and something that I personally have very little experience of. I was interested in Gerd's advertisement of his concurrent work on Wink in OCaml.
<twobitwork>
is there a way to have a program run a main function when ran stand-alone, but not when #load'ed into the top-level?
<jdh30>
OCaml should excel at that as well, I'd imagine. No idea how it stacks up with Erlang though.
<twobitwork>
like in python its: "if __name__ == '__main__': main()"
<jlouis>
Erlang is currently king of concurrency imo
<jlouis>
but damn, that language is *slow*
<jdh30>
twobitwork: can you split it into two parts and load main for standalone and the rest for top-level use?
<jlouis>
(worse than sml/nj :)
<twobitwork>
jdh30: you mean, put the meat into a module and have a .ml file which just opens it and runs it?
<jdh30>
jlouis: Yes. I think Erlang has earned its hype regarding concurrent programming but I get furious when it spills over into parallel programming.
<jdh30>
Like Erlang is the new High Performance Fortran. :-)
<jlouis>
jdh30, erlang is *really bad* for any parallel work
<twobitwork>
vixey: lol... are all of those matched?
<twobitwork>
nope
<jdh30>
jlouis: Yet people keep writing articles about it and confusing the two. I have a lot of respect for Ulf Wigner but I thought his comments on the caml-list were so far from true... :-(
<jdh30>
Is that Lisp code? :-)
<hcarty>
twobitwork: There is a funciton in the stdlib which tells you if the code is running in the toplevel or not
<jlouis>
jdh30, erlang is dynamically typed and boxes all floats....
<hcarty>
function
<jdh30>
Does HiPE also do that?
<twobitwork>
hcarty: ahh, I'll look for it, thanks
<hcarty>
Sys.interactive, I believe
<jdh30>
val interactive : bool ref
<jdh30>
(** This reference is initially set to [false] in standalone
<jdh30>
programs and to [true] if the code is being executed under
<jdh30>
the interactive toplevel system [ocaml]. *)
<jdh30>
Well I never knew that.
<jdh30>
How do you evaluate OCaml code in here?
<jlouis>
jdh30, HiPE doesn't box floats, no. But HiPE incurs an overhead whenever you 'switch' back and forth to/from it. So unless all your code is HiPE'd your performance sucks
<jdh30>
Interesting.
<jdh30>
I've thought about writing Erlang and APL/K implementations in OCaml in the past.
<jlouis>
No mutability is a killer also
<jdh30>
I think there was some interest from the developers of K.
<jdh30>
Sure.
<jdh30>
That might slow a LAPACK translation down... ;-)
<jdh30>
Or an FFTW port. :-)
<jlouis>
ATLAS is god ;)
<jdh30>
MKL all the way.
<jdh30>
Anyway, those are all niches compared to MLton.
palomer has quit [Remote closed the connection]
<twobitwork>
the problem with nested comments is you can't do things like (* print_string "here"; (**) and just delete the openning (* to uncomment it.
<jlouis>
jdh30, anyway, one performance problem of erlang is that you have little control over cons'ing as everything mutates all the time in a persistent environment
<jdh30>
That's a problem?
<jdh30>
Yes, I had understood that to be the largest problem actually.
<jlouis>
You need a good long dance with the profiler and FP-datastructure-implementation-fu ;)
<jdh30>
So a midget clone of Okasaki then?
<jlouis>
something like that yes, though most of Okasakis things are mostly theoretically interesting
<jlouis>
their constant factors suck :)
<jeddhaberstro_>
Why the hell doesn't OCaml support single precision floating point numbers?
<jdh30>
jedd: Because they would have had to introduce a +.. operator and people might have noticed the flaw in their design? ;-)
<jdh30>
Seriously, you can put an array of float32s in a Bigarray but otherwise you're screwed.
<jdh30>
More types is on my wanted list. Except for 31- and 63-bit integers which I'd scrap.
<jeddhaberstro_>
Why couldn't the numbers just be written with an 'f' at the end, and +. (and ect..) would recognize that it's dealing with single precision
<jeddhaberstro_>
Are there any 3rd party libs to support single precision floating point nums?
<jlouis>
jeddhaberstro_, it *does* support single precision floating point numbers .... as long as you pack them in a one-element bigarray ;P
<jdh30>
That is exactly what F# does, except that it uses + for all additions including user defined ones (e.g. my 3D vector type).
<jeddhaberstro_>
mhmm
<jdh30>
OCaml cannot do this and no ML has any usable solution to this problem.
<jdh30>
Xavier's justification is that double precision arithmetic runs just as quickly on most modern CPUs. The only problem is twice the storage requirements and loss of cache coherence...
<vixey>
haskell is an ML
<vixey>
it has a solution
<Smerdyakov>
Haskell is not an ML.
<jlouis>
Haskell is indeed not an ML
<jdh30>
Vixey: Haskell is not an ML but you're right that it does have a solution.
<jlouis>
But type classes in ML would be nice
<jdh30>
Amen to that.
<jdh30>
F#'s solution works fine for me too.
<vixey>
type classes in Coq
<jeddhaberstro_>
But doubles do run slower
<jeddhaberstro_>
:P
<vixey>
how is it not an ML?
<hcarty>
jeddhaberstro_: What do you want to use single precision floats for?
<jdh30>
No functors.
<jlouis>
vixey, historically it is not on the some branch as the ML's either
<jdh30>
hcarty: anything where storage or performance are a concern.
<vixey>
oh ok
<jdh30>
jlouis: they are closely related though.
<jdh30>
In the grand scheme of things.
<mbishop>
so then F# isn't an ML?
<jdh30>
mbishop: yes.
<jeddhaberstro_>
Well, in games (eg rigidbody physics, vectors, matrices, quaternions, ect..), single precision is very beneficial
<jlouis>
jeddhaberstro_, and to my knowledge most GPU's run SP, right?
<jdh30>
Oh yes, single precision is extremely useful when interfacing to GPUs.
<jdh30>
Exactly.
<hcarty>
jdh30: Understandable. I haven't run in to a problem there, at least not one single precision floats would solve. That hardly means the problems don't exist :-)
<jdh30>
But graphics is probably another one of those "niches".
<jdh30>
hcarty: indeed.
<jdh30>
To be fair, float32s are about as useful as value types.
<jdh30>
And value types are most useful for complex numbers.
<mbishop>
The best thing I like about F# over OCaml is F# has access to all the .net types, and OCaml lacks a lot of types (unsigned int32s, unsigned int64s, etc)
<jlouis>
if I ever get around to write an ML, arbitrary sized integers will be the default 'int' type
<vixey>
jlouis: and constructive reals :)
<jdh30>
Argh, nooo! Arbitrary-precision ints are all but a useless PITA!! Nooo!!!
<hcarty>
mbishop: Have you tried the uint64 library on the forge?
<jlouis>
jdh30, see, that depends :)
<vixey>
jdh30: makes proofs easier
<mbishop>
cpst in #concatenative is writing a compiler for a new ML
<jdh30>
mbishop: Yes. OCaml desperately needs overloading as well.
<hcarty>
It only covers unsigned int32 and unsigned int64 types, but may be helpful if you need them
<mbishop>
hcarty: no, but last time I needed them it wasn't out (in fact, neither was the forge :P)
<vixey>
mbishop: What's a new ML for?
<jdh30>
Vixey: Sure. I'm not so sure about the "make it the default" bit. :-)
<vixey>
does it have any unique feature
<jdh30>
Who is writing a new ML?!
<mbishop>
vixey: no idea, but he's planing on fixing some of the problems of current MLs, or at least trying
<jdh30>
Tell me more?
<jdh30>
Does he have an interest in making a lot of money?
<mbishop>
jdh30: cpst (on this network), you can ask him about it...doesn't sound too far along right now though
<vixey>
jdh30: I do
<mbishop>
I think he called it "SSMLC", Sufficiently Smart ML Compiler
<vixey>
If I could earn money by writing a good ML I would do it
<jdh30>
Excellent. I have lots of advice for anyone who wants to make lots of money out of it.
<jlouis>
jdh30, there is a good logic to having bigints being the default. But it is useful to the symbolic programmers only :)
<jdh30>
There is a lot of work to be done before the earning lots of money part but I believe it is feasible.
<jdh30>
The trick is to do something mundane by research standards.
<mbishop>
cpst definitely seems qualified for the job, he and slava know a lot about languages and compilers
<jdh30>
Slava is a funny character.
<jdh30>
Pestov, right?
<mbishop>
yes
<jdh30>
He publically slates my work and then secretly plagiarizes it. :-)
<jlouis>
well I have no 'words' for him, nor for Factor :P
<jdh30>
:-)
<jdh30>
Anyone here going to CUFP?
<jdh30>
IIRC, Don has been invited to do the keynote?
<jlouis>
Syme?
<jdh30>
That's another funny thing in FPL circles.
<jdh30>
Yes.
<jdh30>
Of F# fame.
<vixey>
jdh30: I don't understand
<jdh30>
Vixey: which bit?
<vixey>
jdh30: why would implementing a new ML be of any value to anyone?
<Smerdyakov>
I considered going, but I decided I'm not into what most people who participate are into, which is trying to convince big corporations to let them use reasonable tools. :P
<jdh30>
That could be an enormous benefit to a huge number of people.
<Smerdyakov>
I'll be at ICFP, though.
<vixey>
jdh30: what exactly would though?
<vixey>
I mean what's wrong with current languages ?
<jdh30>
Smer: Yes. I'm not going because I am suspicious of conferences claiming to be about commercial use that make no mention of money, profits, market values and everything else of interest to commercial users like me. :-)
<jdh30>
Vixey: There are lots of things wrong with current languages. OCaml is currently the best solution for practitioners but it still leaves a lot to be desired.
<jeddhaberstro_>
jdh30, is OCaml your favorite language?
<Yoric[DT]>
Practitioners... of what?
<jdh30>
For solving general problems, yes.
<vixey>
I don't really get it
* Yoric[DT]
tends to believe that Haskell would be better for his own kind of problems.
<mbishop>
practitioners of programming!
<jeddhaberstro_>
More than F#?
<jdh30>
For making money, F# probably pips it to the post (although OCaml has taken the lead in our profits again).
<Smerdyakov>
jdh30, how many people does "our" encompass?
<Yoric[DT]>
Tim Sweeney seems to believe that a variant of Haskell with automatic concurrency and dependent types would be better for *his* problems.
<jdh30>
I mean people who have problems that they want to solve. OCaml is awesome for that for a wide range of problems.
<Smerdyakov>
I'm all for pure and total languages.
<jdh30>
F# is great if (like me) you want to make money by selling better tools to customers who are already locked into .NET.
<jdh30>
Smer: Two.
<Smerdyakov>
I'm sure such languages will be the best tools for most domains very soon.
<jdh30>
Yoric: Interesting.
<jdh30>
Dinner's ready. BRB.
lde has quit [Remote closed the connection]
<twobitwork>
Yoric[DT]: ghc has `par` and `pseq`
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<Yoric[DT]>
twobitwork: they solve a different issue, iirc.
<Yoric[DT]>
Dinner's ready, too, though.
<mbishop>
all the philosophers are dinning!
<jdh30>
Smer: Such languages could potentially make serious inroads but they still have many problems. Naff FFIs is a major one, which leaves real world developers libraryless.
<jdh30>
mbishop: very good. :-)
<Smerdyakov>
FFIs are easy to implement, compared to the technical challenges that have been overcome in PL research.
<Smerdyakov>
The DSL I'm developing now is pure, total, _and_ has a killer FFI. :)
<jdh30>
FFIs may be easy to implement but the fact that none of these research language put any effort into FFIs makes them undesirable for many applications.
<Smerdyakov>
Whine whine whine. If you can't implement your own FFI, you're just a big old whiiiiiner.
lde has joined #ocaml
<hcarty>
Smerdyakov: Where are these wonder-languages?
<Smerdyakov>
hcarty, old version at http://laconic.sf.net/ -- lacks 2 out of 3 magical properties I described. :P
<jdh30>
They don't exist because PL researchers publically state that all essential features are trivial and uninteresting in an attempt to hide the fact that they don't want their work to be tested in the real world because it might fail.
<Smerdyakov>
jdh30, you sound like a carpenter complaining that other carpenters don't build nice enough decks.
<Smerdyakov>
jdh30, this is an opportunity, not a problem.
<twobitwork>
Smerdyakov: I like the way you think :)
<mbishop>
build me a table so we may feast!
<hcarty>
Smerdyakov: It's only an appealing opportunity for those who have an interest in designing languages
<Smerdyakov>
hcarty, the profit opportunity exists independently of subjective interest.
<hcarty>
Hopefully someone with such interests will blow us all away soon :-)
<Smerdyakov>
hcarty, my basic viewpoint is that most problems in software development should be solved by designing and implementing new languages.
<Smerdyakov>
hcarty, from this perspective, people not interested in developing language technology are headed the way of the dinosaurs.
<hcarty>
Smerdyakov: So a world of all producers and no consumers?
<jdh30>
Smer: You sound like someone trying to sell a ruler where the user has to add their own markings for it to be of any use.
<Smerdyakov>
hcarty, I don't understand. Why are you classifying language design and implementation as fundamentally different from most programming that goes on today, in terms of what is "production" and what is "consumption"?
<mbishop>
producers are consumers :)
<hcarty>
Smerdyakov: I may not understand what you mean by "problems in software development"
<hcarty>
I'm not a PL researcher, so your ideas of problems in software development may be very different from mine
<jdh30>
Smer: The problem is not that we are not interested in developing language technology. The problem is that you are moving on to new projects before testing your previous ones.
<Smerdyakov>
hcarty, I mean anything that developers spend lots of time doing
<jdh30>
hcarty: That was a polite way of saying "you may have no practical knowledge of software development and, therefore, no idea what is really needed".
<Smerdyakov>
jdh30, I don't think you know enough about the projects I work on to come to that conclusion.
<jdh30>
Smer: I can infer it from your statements.
<jdh30>
Smer: You are an academic?
<Smerdyakov>
hcarty, another way of saying it is that most software development today should be avoidable.
<Smerdyakov>
jdev, half-time. I'm working on a start-up company the other half.
<Smerdyakov>
jdh30, "
<jdh30>
Smer: Have you ever shipped a product?
<Smerdyakov>
jdh30, yes. I write all the custom software for hcoop.net, which has about 130 members now.
<Smerdyakov>
jdh30, and I hacked on some stuff that is in production at Jane Street now.
<jdh30>
Smer: How much revenue have your products made?
<Smerdyakov>
Beats me. The first is a non-profit, and the second has too many moving parts.
<Smerdyakov>
You should wait to see how my start-up does. I haven't concentrated on making money before the last few months.
<Smerdyakov>
At the same time, I think you're picking a bad comparison point.
<jdh30>
Smer: This doesn't have to be about money. Have you ever shipped an open source project and garnered a user base for it?
<Smerdyakov>
From a previous conversation, it sounds like your personal business brings in less revenue than a Google engineer's salary.
<jdh30>
How much is a Google engineer's salary?
<Smerdyakov>
Starting around $150k for people with graduate degrees
<Smerdyakov>
(I think)
<jdh30>
FFC pulls in around $200k.
<jdh30>
Depending how hard we push it.
<Smerdyakov>
So you add up to someone who's been at Google or Microsoft for 5 years. Good work. :P
<Smerdyakov>
You just can't argue, at that level, that you're creating value like crazy and the market is proving it.
<jdh30>
Smer: Still trumps failing to give away software for free and not yet having succeeded with a startup.
<hcarty>
Smerdyakov: I agree (I think) -- When you say "should be avoidable," do you mean being able to avoid common boilerplate through better languages? Or something more?
<Smerdyakov>
hcarty, definitely "yes" to the first question, and maybe "yes" to the second.
<jdh30>
Objectively, your chances of getting to where I already am with your startup are <10%. Anyone can start a startup. My point was regarding finishing it (or anything else).
<Smerdyakov>
jdh30, I think my chances are better, given the additional information I have about my idea and my abilities, but I don't expect you to take my word for it.
<Smerdyakov>
I always get a chuckle over the bigoted attitudes towards "academics" that I see.
<Smerdyakov>
Almost all people with PhDs in CS are much better at practical things than almost anyone without one.
<Smerdyakov>
Math PhDs are probably a different matter.
* Smerdyakov
leaves.
<gildor>
Smerdyakov: some people here don't have a PhD, don't be too categorical
<jdh30>
Smer: Nonsense.
<jdh30>
Smer: People with PhDs (like me) are notoriously impractical and it only gets worse from there in.
<Smerdyakov>
gildor, jdh30, I think the facts back this up, especially restricting to the top PhD programs.
<Smerdyakov>
gildor, I really don't care if I offend people with the truth, sorry.
<Smerdyakov>
jdh30, do you have a PhD in computer science?
<jdh30>
Smer: No, physics.
<gildor>
Smerdyakov: your truth, is not THE truth
<Smerdyakov>
jdh30, I rest my case.
<Smerdyakov>
gildor, run some experiments of your own and I'm sure you'll come to the same conclusion.
<jdh30>
Smer: But many of my friends do and their companies all failed precisely because they were not practically minded.
<jdh30>
I rest my case.
<jdh30>
You see this all the time in CS.
<jdh30>
Not to mention that CS PhDs are virtually worthless compared to other subjects.
<gildor>
I have worked with PhD people (i don't have one FYI), and even if they got good idea, they fail implementing it most of the time
<gildor>
or selling it
<hcarty>
gildor: Thanks
<gildor>
because they maybe don't have a PhD in computer science and in marketing
<jdh30>
gildor: exactly.
<gildor>
we are in a world where success is related to being able to sell your idea
<gildor>
(either propagating it for free, or getting money from it)
<jdh30>
In the west, yes.
<hcarty>
gildor: Thanks re: ocamlp3l package, that is
<jdh30>
Sales is my main function now.
<gildor>
hcarty: i am looking for a place where you can upload the package
<gildor>
hcarty: i386 or amd64 ?
<jdh30>
I think it is worse than that though. Getting a PhD leads you to believe that making everything as difficult as state-of-the-art research is the way to go. Almost everyone makes that mistake and it leads them to say things exactly like "implement your own FFI, it is trivial" to potential customers.
<hcarty>
gildor: What package?
<jdh30>
That is why those startups fail so much. That and VCs throw money at them because a tiny minority make a killing.
<gildor>
hcarty: i can make you a .deb for amd64 or i386, if you want to use it right now
<gildor>
for ocamlp3l
<gildor>
hcarty: the package is in the NEW queue of debian, but you cannot yet download it
<jdh30>
Incidentally, the Haskell in Industry page is little more than a list of such companies.
<jdh30>
Fortunately, OCamlers seem to be much more successful in industry.
<jdh30>
Did you know that Jane St have ten times as many OCaml developers as Credit Suisse have Haskell developers?
<gildor>
how many OCaml dev at Janest ?
<jdh30>
~20
<gildor>
there is only 2 haskell guy at Credit Suisse ?
<jdh30>
XenSource probably have about the same now as well. They have really expanded since the $500M sale to Citrix.
<jdh30>
Ganesh and Lennart.
<jdh30>
Surprising?
<hcarty>
gildor: Oh, thanks. The source and .dsc would be useful as well, if possible. amd64
mfp has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]>
jdh30: a few months ago, you were talking about reimplementing OCaml.
<Yoric[DT]>
Do you still have plans to that extent?
<jdh30>
Dreams more like but, yes, I am extremely interested in the idea of an open source implementation for an OCaml-like language.
<jdh30>
Or an open source F#-like language.
<jdh30>
Why do you ask?
<Yoric[DT]>
Because, as many people in the field, I often make that kind of dreams.
<jdh30>
What path would you choose in order to maximise the chances of success? Write something simple but useful using LLVM as a backend or try to reuse as much existing technology transparently by building upon Mono?
<jdh30>
And do you agree with my basic assessment of what problems need to be addressed?
<Yoric[DT]>
Probably Mono, although both approaches look coherent to me.
<jdh30>
GC is a serious problem without reusing Mono but, then, you're gambling on Mono itself and my personal opinion of that project has been very low.
<Yoric[DT]>
Let me sum up: you want overloading, DLLs, multi-core and fast arithmetics, is that it?
<jdh30>
e.g. performance was awful two years ago and has not improved at all.
<Yoric[DT]>
Yeah, that's the big issue with Mono.
<jdh30>
Mono should provide DLLs and multicore.
<Yoric[DT]>
But once again, if you restart from scratch, you'd better do a damn fine job reinventing every wheel, even where other projects failed.
<Yoric[DT]>
Note that I'm not suggesting anything atm, or actually starting a project, just thinking aloud.
<jdh30>
Sure.
<mbishop>
jdh30: did you get that message I sent you on reddit a couple of weeks ago?
<jdh30>
We could also build upon OCaml itself, e.g. lex and parse with Camlp4
<jdh30>
gildor: I really want to get away from MS.
<gildor>
Mono has a very bad reputation
<jdh30>
Ah, that is exactly why I want to get away from MS.
<gildor>
after that you can build a LLVM backend for OCaml
<jdh30>
gildor: their implementation has been awful but perhaps they are serious about improving it. I spoke to one of their customers about this and he said they would throw a few million dollars at Mono to improve it if he asked. I advised him not to bother.
<jdh30>
but now I'm not so sure.
<jdh30>
gildor: good idea. I don't care for much of Mono but easy high-level type-safe interop to a major platform is alluring. However, Mono currently has fewer developers building upon it than OCaml.
<mbishop>
OCamIL looked fairly mature last I looked
<gildor>
I think there is more chance that MS try to create a ".NET" env for UNIX than that Mono beats ".NET"
<jdh30>
mbishop: was the question about what MS did to piss me off?
<jdh30>
mbishop: basically.
<jdh30>
gildor: perhaps but I would certainly not gamble on that. MS are very scared though.
<mbishop>
jdh30: no, more so about where you heard those things I guess, they said COM stuff had just come out, and quotations were still there and such
mfp has joined #ocaml
<jdh30>
mbishop: I was referring primarily to FSharp.Compiler.dll which was open and was advertised in Don's book Expert F# but when I mentioned the idea of us building a Mathematica-like notebook front-end for F# users they said they were going to close the compiler in order to prevent people like me from competing with Visual Studio.
jonafan_ is now known as jonafan
<jdh30>
mbishop: quotations are there but they are basically useless because you cannot do anything with them (e.g. compile them).
<mbishop>
that's a shame :/
<jdh30>
mbishop: LINQ treads in the same area with its "Expression Trees" but they are also useless because they do not support recursion (!).
<jdh30>
Yes.
<jdh30>
F# also had some support for module signatures, providing a little of ML's excellent encapsulation, but they ditched that. So almost all definitions are now globally visible, which is insane. This is also due to long standing bugs in their Visual Studio mode.
<mbishop>
Think any of this stuff will be fixed in the CTP release?
<jdh30>
mbishop: Also, F#'s quotations are insanely restrictive compared to OCaml's camlp4. With Camlp4 you can quote anything. With F#'s quotations you can quote a tiny sublanguage. Camlp4 also provides extensible grammars. F# has nothing comparable.
jeddhaberstro_ has left #ocaml []
<jdh30>
mbishop: A tiny amount will be fixed but I suspect most of their work will be in bug fixing and documentation.
<mbishop>
they claim quite a few major changes for the CTP release, so who knows
<mbishop>
also a "brand new feature"
jeddhaberstro has joined #ocaml
<jdh30>
They are basically going for lock-in with big customers like Morgan Stanley (who are migrating 100,000 machines from Linux+Java to Windows+.NET+F#). Their business model is sound though, i.e. monopolistic.
<jdh30>
mbishop: any idea what the brand new feature is?
<mbishop>
nope
<jdh30>
mbishop: IMHO, the biggest current problem with it is the awful development environment (partly an incredibly slow compiler that made me give up on developing a project as it grew: talk about not scaling). I believe that will be fixed in the CTP.
<jdh30>
We were supposed to be helping them with that but MS execs pulled the funding because MS are struggling in the US recession.
<jdh30>
Quite funny really. They wanted to place a lot of restrictions on what I was allowed to tell people (i.e. gag me about performance issues) but they couldn't afford to.
<jdh30>
Camlp4 would be an awesome tool if it was better documented, e.g. how to write your own lexer.
<jeddhaberstro>
why don't u guys like Mono?
<jdh30>
Yoric: Anyway, what do you think of the idea of implementing a production quality open source ML?
<jdh30>
jedd: Boehm, performance etc.
<jeddhaberstro>
mhmm
<jeddhaberstro>
I could understand the dislike of the GC, but performance isn't to bad in my experience
<jeddhaberstro>
and the "language shootout" seems to back that up as well
<jdh30>
On of my F#.NET Journal articles was about the SciMark2 benchmark. For fun, I ran it on .NET and Mono (same hardware). Mono was 3x slower!
<jdh30>
The language shootout fails to test the cost of basic abstractions (like closures) which are terribly slow on Mono.
<jeddhaberstro>
Yeah, that's what I was going to mention, many of the features that a functional language uses probably aren't focused upon much
<jdh30>
If Mono improves then it could gain serious traction but my impression is that the Mono developers are nowhere near talented enough to pull it off. For example, look at their discussions of LLVM and their "new" GC.
<jdh30>
Exactly.
lde has left #ocaml []
<jdh30>
Note that C# 3 is one of those languages./
<jdh30>
So should we gamble on it or not? It could save a huge amount of time...
<jeddhaberstro>
but, with Mono 2.0, supposedly they JIT has gotten a big overhaul
<jdh30>
They should just build on LLVM. It has serious industrial backing from several major companies and a lot of really talented developers (far more than Mono has).
<jeddhaberstro>
True
<jeddhaberstro>
But, Mono came before LLVM, so that's probably why they didn't/haven't
<jdh30>
I read a ridiculous discussion on some site (LtU?) where a Mono developer was dissing LLVM to its author. Just embarassing.
<jdh30>
Mono may have come before but they should still have recognised that LLVM shot past them in terms of capabilities, performance etc.
<jdh30>
Mono was left fumbling in the dust by the LLVM guys.
<jdh30>
The main problem with LLVM is that Apple seem to have no interest in modern languages at all.
<jdh30>
Real shame.
<jeddhaberstro>
What do mean by modern language though?
<jdh30>
I bought an Apple and was really disappointed with its stoneage developer tools... :-(
<jdh30>
Java, C#
<jeddhaberstro>
Oh, yes
<jdh30>
Not even Haskell. ;-)
<jdh30>
Apple don't seem to realise how important a CLR is.
<jeddhaberstro>
They're focusing on Objective-C and Cocoa, that's for sure
<jdh30>
Sun sort of vaguely realise but they are unwilling to look beyond what people bring to the JVM, so they have failed to recognise how serious their shortcomings are.
<jeddhaberstro>
I am very much looking forward to OpenCL though
<jdh30>
Exactly.
<jdh30>
Those are like BASIC. I haven't used languages like that for 20 years...
<jeddhaberstro>
Cocoa and Obj-c isn't a bad platform though. Cocoa with C# is my favorite though
<jdh30>
Even if Sun just implemented tail calls in the JVM it would completely change the playing field.
<jeddhaberstro>
(I'm an Apple user)
<jdh30>
Have you used F# under Windows?
<jeddhaberstro>
Nope
<Associat0r>
jdh30 : doesn't goto just solve that?
lde has joined #ocaml
<jeddhaberstro>
I don't know F# (or OCaml) well enough to actually use either of them on a large scale yet
<jdh30>
Assoc: Several core concepts in functional programming (combinators, continuations) rely upon the ability to "goto" other functions with incurring a stack frame.
<jeddhaberstro>
Windows as a whole is just a pain to use (to me)
<jdh30>
jedd: Both are cool but I'd only recommend F# if you want to see what commercial developers can have. I recommend OCaml if you want to solve problems unrelated to selling software.
<jeddhaberstro>
Unless you're comparing Xcode to VS :P
<jdh30>
I always hated Windows but MS threw money at me to use it so I did. Their .NET platform is absolutely incredible. Far better than anything else I have seen. I would love to have something like that under Linux.
<jeddhaberstro>
I'm building a hobby game engine upon .NET and Mono, and I'd definitely like to use F# as an alternative for scripting
<jdh30>
Go for it.
<jeddhaberstro>
I am :)
<Associat0r>
jdh30: so the JVM doesn't have something like a jmp like goto?
Asmadeus has quit ["nighters"]
<jeddhaberstro>
I just need to finish the engine in C# and C++ :P
<jdh30>
While you're there, check out how easy GUI programming and visualization are from F#. And threading, concurrency and parallelism...
<jeddhaberstro>
I bet F# + Cocoa would be amazing
<jdh30>
Assoc: Exactly. The JVM only allows "goto" within a function, not between functions. That means the JVM cannot support functional languages.
<jeddhaberstro>
I'm gonna try it
<jdh30>
jedd: Absolutely.
<jdh30>
jedd: Can you do something like that with Mono?
<jeddhaberstro>
yep
<jdh30>
wicked
<jeddhaberstro>
there are several obj-c <-> Mono bridges
<jdh30>
Assoc: This means that languages like Scala theoretically allow you to write elegant functional programs but, in practice, they will unpredictably stack overflow. In other words, Scala is a toy as far as functional languages are concerned. Same goes for OCamlJava.
<jdh30>
Assoc: This is really important stuff.
<jeddhaberstro>
but there's also Cocoa#, obj-c# obj-c# 2, dumbarton (or something like that)
<jdh30>
Assoc: Forget about closures, delegates, value types and all of the other problems with the JVM. This one is a complete show stopper.
<Associat0r>
yes I know about the importance of it
<jdh30>
jedd: Hopefully they use delegates so F# can use them transparently. That is another awesome feature of F# that I would borrow.
Axioplase_ is now known as Axioplase
<jdh30>
Assoc: If only Sun fixed tail calls we could build a new FPL on the JVM. That would be a lot less work than using LLVM and implementing your own concurrent GC and the result would be a lot faster than anything built upon Mono.
<Associat0r>
jdh30 : what is the reason they don't want to add it?
<Associat0r>
jeddhaberstro: why so many languages for your engine
<Associat0r>
?
<Associat0r>
if you use .NET why not go F# all the way?
<Associat0r>
or a C++ / F# mix
<jdh30>
Sun have been making noises about it for years. My guess is that they have massively prematurely optimized the JVM for Fortran-like code and the resulting nastiness makes it impossible to add tail calls (or many other features) without going back on that.
<jeddhaberstro>
jdh30: I think a few parts of the library uses delegates
<jdh30>
great.
<Associat0r>
jdh30 : what do you think of languages like bit-c and felix?
<jdh30>
you just give it a function from F# and it will just work.
<jeddhaberstro>
associat0r: C++ for speed + I have to use existing third party libraries that are C or C++, I love C#, and I won't make the engine in F#, but I since everything is just compiled down to IL, I could use the engine from F#
<jdh30>
Assoc: I don't know bit-c (link?). I think Felix is interesting if you have legacy C++ but I would rather start afresh and keep pushing the boundaries.
<jdh30>
jedd: Interop with F# should be really easy.
<jeddhaberstro>
Damn you guys, this channel is distracting me from my school work :P
<jeddhaberstro>
Now working through that O'Reilly OCaml book
<jeddhaberstro>
The sampler chapter from OFS is great btw!
<jeddhaberstro>
If .NET and Mono were fast enough, I would drop C and C++ altogether and use a mix of C# and F# probably.
<Associat0r>
jdh30: btw the creator said the surface syntax is will change to something else later on
<mbishop>
I can't stand C++, and want nothing to do with it
<jeddhaberstro>
I figure it's a good thing to know and use once in awhile since most game companies require experience in it.
<Associat0r>
jdh30: do you know if F# fixes eliminates temp copies when using operator overloading?
<jeddhaberstro>
Ok... back to some reading
<Associat0r>
I know C# op overloading is slow because of the temps
<jdh30>
Assoc: Yes. That is purely a static resolution and has no effect on the generated code. F# currently does not eliminate struct temporaries though, like complex numbers, but it is still many times faster than OCaml there.
<jdh30>
Assoc: bit-c looks really interesting.
<jdh30>
mbishop: Agreed about C++. I cannot believe I did my PhD using that rubbish.
<jdh30>
jedd: C++? Don't bother. It has been in serious decline across the software industry for years now and will barely exist by the time you finish your PhD.
<Associat0r>
jdh30: yeah as sys language bit-c looks really great, it also can be used without a GC
<jdh30>
A lot of C++ developers are now compiling their C++ into .NET IL and then using C#.
<jeddhaberstro>
I have no plan to get a PhD though
<jdh30>
Assoc: I certainly want a GC!
<Associat0r>
yes jdh30 me too but it is nice to know it can be disabled if you wanted
<jeddhaberstro>
in 2 years when i got to college, get a bachelors in comp sci, then maybe a masters in game programming, then I'll be off job huntinh
<jeddhaberstro>
But I do agree, C++ is seriously dying
<jdh30>
jedd: No, you'll found your own company. Working for other people sucks. They are all idiots. You can do much better.
<jeddhaberstro>
I am actualling joining this 6 man team (dsmedialabs.com) working on the internal development of there game department, and I'll have part ownership in that, so that might lead to something
<Associat0r>
jeddhaberstro : the game industry isn't that nice to work in from what I hear
<jeddhaberstro>
I know
<jeddhaberstro>
But hell, I probably put in 50 hour weeks doing my own stuff all ready ;)
<Associat0r>
jdh30: you will become a code monkey very soon in the industry
<jdh30>
Absolutely. I actually wrote an answer on the Hub and then didn't post it because it was too rude. This is another aspect of F# that is currently screwed. In short, I think we could have an ocamldep for F# and automated compilation but Microsoft haven't written it and they just closed the libraries we needed to build upon to do this ourselves.
<jdh30>
Assoc: I will?
<jdh30>
Assoc: F# code indentation is another missing feature. I don't like #light at all (it is not well defined, it is clearly ambiguous in many cases, there are no public tools to handle it, it screws up code pasted from most websites) but, again, I this is another problem that I am now unable to solve...
<jdh30>
Yoric: Note that our new language will have OCaml-like syntax and tooling and not F#-like!
<jeddhaberstro>
F# doesn't have the +. operators, right? Everything is overloaded
<jdh30>
jedd: Yes.
<jeddhaberstro>
Good :)
<jdh30>
jedd: Well, not quite everything.
<jdh30>
jedd: I think ** is not overloaded.
<jeddhaberstro>
** is the power operator, right?
<jeddhaberstro>
2 ** 3 == 2^3?
<jdh30>
Despite all the doom and gloom I think there are lots of interesting things going on. F# may well be a greater success in industry than OCaml. OCaml's parallel GC may reach new heights. The Real World Haskell book might make Haskell practically useful.
<jdh30>
jedd: Yes.
<jdh30>
jedd: You mean 2. ** 3. = 2^3
<jdh30>
;-)
<jdh30>
jedd: Maybe ^ too.
<jeddhaberstro>
yeah :P
<jdh30>
That is just such an obvious advantage of F# over OCaml...
<jeddhaberstro>
yep
<jeddhaberstro>
Are there any big syntax or semantic differences between the two?
<jdh30>
Not so bad for int vs float but when you have float32 and complexes over them and vectors over all of those and matrices and quaternions and ...
<Associat0r>
jdh30: I didn't like indent syntax before I saw it in F# at first
<Associat0r>
but I kinda like it now
<jdh30>
jedd: Yes, lots.
<jeddhaberstro>
Is there a page anywhere listing them?
<jdh30>
Assoc: Have you been using automatic code indentation in OCaml?
<Associat0r>
it is bad for pasting that is true but I don't paste that much anyway
<jdh30>
jedd: No. They keep changing as well.
<jeddhaberstro>
heh
<jdh30>
You cannot even do "module A : sig type t end = struct type t = int end" any more...
<Associat0r>
jdh30 : I never used ocaml in production
<jdh30>
jedd: Field resolution of records is now different.
<jeddhaberstro>
records are even different, heh
<jdh30>
lots of OCaml has been deprecated. The entire nomenclature may be revamped to be in line with other .NET languages (e.g. List.Assoc).
ctsprsrcl has quit [Connection timed out]
<jdh30>
Assoc: even if you're just playing with OCaml you desperately need an editor that does auto code indent and type throwback.
<jdh30>
I think setting it up is all described in the free first article from the OCaml Journal.
<jdh30>
Type throwback is invaluable... and better than F#'s. :-)
ygrek_away has quit [Remote closed the connection]
<jdh30>
and non-generalized type variables (e.g. '_a), rectypes, recursive modules, the Format module, IDE support for lex and yacc, Unix module, macros, named substrings in lexers...
crdlctelcj has quit [Read error: 110 (Connection timed out)]
<jdh30>
Oh!
<jdh30>
Yoric?
<Camarade_Tux>
before I go to bed I wanted to ask whether anyone is interested in an npocaml library
* Camarade_Tux
wishes nobody is
<Camarade_Tux>
oh, npocaml, tsss, I meant in an "npapi ocaml library", this would enable one to write a browser plug-in in ocaml
<Associat0r>
jdh30: yes it lacks a lot of stuff
<Associat0r>
but I can't live without op overloading
Camarade_Tux has quit [Remote closed the connection]
Camarade_Tux has joined #ocaml
seafood has joined #ocaml
seafood has quit [Connection reset by peer]
Linktim has quit ["Quitte"]
seafood has joined #ocaml
wolgo_ has joined #ocaml
<wolgo_>
holy smoke I got accepted !
<wolgo_>
I am going to college lol
<wolgo_>
I just found out. I also get to take an A.I. class that uses lisp and a class on programming paradigms that uses guess what! ocaml!
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
<jdh30>
Congratulations!
<wolgo_>
holy SHIT!
<wolgo_>
I cannot believe it
<wolgo_>
I never graduated high school
<wolgo_>
I cannot believe they accepted me
<wolgo_>
Thanks jdh30
<wolgo_>
Is ocaml used for AI? It says it is a general purpose programming language
<Yoric[DT]>
congratulations wolgo_
<Yoric[DT]>
jdh30: Yes?
<jdh30>
Yoric[DT]: Eh? Oh. Err. let me think...
<jdh30>
Yoric[DT]: I was going to list another feature for a new FPL but I forget what it was.
<jdh30>
Camarade_Tux: Writing browser plugins in OCaml would be cool.
<Yoric[DT]>
:)
<Yoric[DT]>
jdh30: well, that'll have to wait for tomorrow.
<Yoric[DT]>
Good night everyone.
<jdh30>
Night
Yoric[DT] has quit ["Ex-Chat"]
<Camarade_Tux>
jdh30: I'll have to finish my library then :P
<Camarade_Tux>
the problem is that even webkit developpers don't know npapi that much =P
<Camarade_Tux>
btw I also have a library to use webkit-gtk from ocaml, it's just not published because it's not complete yet (webkit-gtk's api is not complete atm), if anyone is interested I have a tarball though
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
seafood has quit [Client Quit]
<jdh30>
As long as there is a simple demo, I'm sure lots of people would be interested. Be sure to advertise on list.
<jdh30>
Ah, just remembered that feature I wanted: active patterns (views).
<wolgo_>
Hey this is pretty cool
<wolgo_>
let sumsquares x = let square = x * x in square + square;;
<wolgo_>
Is this like composing functions?
<jdh30>
No, that is just nesting functions.
<jdh30>
But it is extremely useful.
<wolgo_>
oh okay
<wolgo_>
It is still cool.
<jdh30>
Composing functions would be more like:
<jdh30>
let square x = x * x;;
<jdh30>
let sums f x = f x + f x;;
<jdh30>
sums square 3;;
<wolgo_>
oooo
<wolgo_>
Okay
<wolgo_>
I see
<jdh30>
Now that I look at your code, that wasn't actually a nested function, it was just a nested variable.
<wolgo_>
local expression
<jdh30>
There is very little difference in a functional language though: the whole point is that you can put functions into variables as well as ordinary values.
<jdh30>
A nested function version of your example might be:
<jdh30>
let sumsquares =
<jdh30>
let square x = x * x in
<jdh30>
square x + square x;;
<jdh30>
Oops, should have started "let sumsquares x ="...
<jdh30>
Now you have a nested definition of "square" and it is a function that squares its argument.
<jdh30>
That alone is something cool that you can do in OCaml and not in many other languages.
<wolgo_>
Yeah it seems cool. I am sure it will be the source of much confusion for me later though hahah
<jdh30>
You will probably really benefit from some simple examples to start with.
<wolgo_>
I think it is neat I can bind arbitrary values to a name
<jdh30>
Look at this "nest" combinator:
<jdh30>
let rec nest n f x = if n=0 then x else nest (n-1) f (f x);;
<jdh30>
What does it do?
<wolgo_>
The base case is n containing a zero
<jdh30>
I normally charge £1,000 per person per day to teach this but I'm feeling generous. ;-)
<jdh30>
Correct.
<wolgo_>
dont tell me let me copy it to a file so I can follow it
<jdh30>
What does nest 3 ((^) "foo") "bar" do?
<wolgo_>
It calls a function n times which has an argument of a function and a value
<wolgo_>
Jesus
<wolgo_>
this is cool
<jdh30>
Exactly.
<jdh30>
Well done.
<wolgo_>
and if n = 0 it quits
<wolgo_>
HOLY SHIT!
<wolgo_>
THIS IS AWEOSME
<wolgo_>
Hey wait
<wolgo_>
If I can do that.
<wolgo_>
This is a neat little item actually.
<wolgo_>
let rec means "You have permissions to be a recursive operation"?
<wolgo_>
nest 3 ((^) foo) bar
<jdh30>
Yes. When you define "foo" with a "rec" then using "foo" inside the body of the definition is referring to itself.
<wolgo_>
brb let me write it down
<jdh30>
Put quotes around the "foo" and "bar": they are strings.
<wolgo_>
oh okay
<jdh30>
And ^ is string concatenation.
<wolgo_>
let me test ^ real quick
<wolgo_>
oh okay
<wolgo_>
foobarfoobarfoobar?
<jdh30>
No.
<wolgo_>
let me try
<jdh30>
What does the function argument ((^) "foo") to the "nest" combinator do?
<wolgo_>
nest 1 ((^) "foo") would make foofoo right?
<wolgo_>
wait
<wolgo_>
no
<wolgo_>
nest 2
<wolgo_>
blaarghh
<jdh30>
You mean:
<jdh30>
nest 2 ((^) "foo") ""
<wolgo_>
wait nest 3 ((^) "foo") "" would make foofoofoo
<jdh30>
That prepends the string "foo" onto the empty string twice.
<jdh30>
Exactly, yes.
<wolgo_>
beacuse we recurse 3 times
<jdh30>
and the base case is the empty string, yes.
<wolgo_>
if we have a different pattern at the end though it would add a bar
<wolgo_>
so foofoofoobar
<jdh30>
nest 3 ((^) "foo") "bar"
<jdh30>
makes "foofoofoobar", yes.
<wolgo_>
okay
<wolgo_>
I need to follow this again
<jdh30>
You may find our example easier to read like this:
<jdh30>
nest 3 (fun str -> "foo" ^ str) "bar";;
<wolgo_>
Is this some type of pattern? f x
<wolgo_>
Why does this work: f (f x)
<jdh30>
f (f x) means f(f(x))
<wolgo_>
wait, because f is a function and x is an argument of an arbitrary value
<wolgo_>
okay
<jdh30>
You also need to know that a^b can be written (^) a b
<jdh30>
Try evaluating just: (^);;
<wolgo_>
it takes a string to string
<jdh30>
Not quite. The -> in a type is right associative so that type means string -> (string -> string)
<jdh30>
So it takes a string and returns a function that takes another string and returns a string.
<wolgo_>
Oh okay, it takes two arguemtns.
<jdh30>
Exactly.
<jdh30>
This means you can write:
<jdh30>
(^) "foo"
<jdh30>
meaning: prepend the string "foo".
<wolgo_>
Is this partial application?
<jdh30>
Yes, exactly.
<wolgo_>
Okay I read about it on wikipedia
<wolgo_>
It is confusing but again it sounds cool.
<jdh30>
Be wary of Wikipedia.
<wolgo_>
I am
<jdh30>
Very cool.
<wolgo_>
I hate them
<wolgo_>
well that is a bit strong
<wolgo_>
I dislike them
<wolgo_>
Okay I wrote this down.
<wolgo_>
So, ((^) "foo") returns a function of one argument "foo"
<jdh30>
I have another example for you.
<wolgo_>
Okay
<wolgo_>
There should be a book of these puzzles
<wolgo_>
What does this do __code__. Why?
<jdh30>
That returns string concat with its first argument (the left hand string) partially applied with "foo". So it is now waiting for its second argument (the right hand string) whereupon it will return "foo"^something
<jdh30>
It is just shorthand. A more concise way of writing something that comes up a lot.
<wolgo_>
It is pretty useful
<wolgo_>
I want to do this N times.
<wolgo_>
That is awesome.
<wolgo_>
Thanks jdh30
<wolgo_>
You teach ocaml?
<jdh30>
No problem. Consultancy is partly teaching, yes. Also writing customized reports (i.e. salami slicing existing books).
<jdh30>
Can you drop me an e-mail?
<wolgo_>
sure
<wolgo_>
why though?
<jdh30>
You'll see...
<wolgo_>
lol
<wolgo_>
okay
<wolgo_>
msg me your email addy
<jdh30>
how do i do that?
<wolgo_>
err wolgo_
<wolgo_>
not wolgo, that is my other comp
* wolgo_
jdh30 just so you are aware I will be starting this blog today, with the sole purpose of working on ocaml stuff.
<wolgo_>
oops meanst to msg lol
gildor has quit ["leaving"]
<wolgo_>
Is lincity really written in ocaml?
<wolgo_>
Wow that is insane.
<wolgo_>
That is so cool
<wolgo_>
Oh nm.
<wolgo_>
c++
<mbishop>
there are a some "big-time" programs written in OCaml
<mbishop>
in fact, jdh30 made a blog post about the top 10