<jemfinch>
whee: yeah, the shootout isn't really a valid comparison.
<jemfinch>
they put a lot of useless boilerplate code in the SML programs that isn't really necessary. Aside from that, the SML coders used a much more verbose (read: readable) coding style.
jemfinch has quit ["Client Exiting"]
jemfinch has joined #ocaml
<jemfinch>
they put a lot of useless boilerplate code in the SML programs that isn't really necessary. Aside from that, the SML coders used a much more verbose (read: readable) coding style.
<Yurik>
lament: :)))))))
<whee>
I'm not finding lazy lists or some equiv in sml/nj :|
<jemfinch>
in fact, if you look at the O'Caml code, it's coded specifically to be compact, to inflate its "lines of code" ranking.
<Yurik>
in fact, i strongly believe that sml is more an educational language
<whee>
sml and ocaml are largely the same anyway, feature wise
<whee>
in which case I'll take the faster one, which is ocaml :D
<jemfinch>
O'Caml definitely has the edge in features.
<Yurik>
but actually they're different
<jemfinch>
polymorphic variants, classes, polymorphic recursion, camlp4, etc.
<jemfinch>
I just don't really want any of that, and I think it makes the code uglier.
<jemfinch>
(I wouldn't mind polymorphic variants, but I'd much prefer the equivalent of Haskell's Dynamic type in SML)
<Yurik>
basing on common ML, ocaml is more close to industry and provdides with good features
<Yurik>
including w/ that that jemfinch have listed
<jemfinch>
Yurik: I don't think you have much basis to say that, though -- for instance, when it came around to doing Y2K testing, it was SML and its Ckit that did it, not O'Caml.
<jemfinch>
whee: I'll show you how to do lazy lists in SML in just a sec.
<Yurik>
jemfinch: i don't have such an info
<Yurik>
for the purpose of comparison I'd like to look at apps made in ocaml and sml
<Yurik>
ocaml ones seems to be more practical
<jemfinch>
I don't necessarily agree, I think both languages are really in the "we don't have very many libraries" period.
Yurik_ has joined #ocaml
<Yurik_>
re
<Yurik_>
got disconnected again :( sorry
<jemfinch>
I like that SML doesn't rely on exceptions and returns option types a lot; I like that its strings are immutable.
<Yurik_>
for the purpose of comparison I'd like to look at apps made in ocaml and sml
<Yurik_>
ocaml ones seems to be more practical
<Yurik_>
and ocaml wins ICFP ;)))
<jemfinch>
yeah, I saw that :)
<whee>
heh
<jemfinch>
there was only one SML entry, and it was in the top ten, even though it was made by mere students :)
<jemfinch>
O'Caml is definitely "cooler" than SML in the popular opinion.
<Yurik_>
as i know, ocaml has practical appliance
<Yurik_>
sml hasn't suhc
<Yurik_>
sml hasn't such
<lament>
hm, this begins to remind me of scheme/cl wars
<Yurik_>
flame wars rules? ;)))
<whee>
how can there be a war versus those
<jemfinch>
Yurik: SML doesn't have practical application? What do you call the CKit? It's tested million-line codebases for Y2K bugs. It's an entire parser/lexer/typechecker for C.
<whee>
I always see a clear distinction between those :|
<whee>
jemfinch: right, but that's one application
<jemfinch>
It's used for ml-nlffigen, which *automatically* generates FFI modules for C code.
<whee>
I could go and point at that version of doom or quake that was written in ocaml and say the same thing
<Yurik_>
actually SML and ocaml are both ML languages, but as for practice ocaml succeed
<jemfinch>
whee: and where has O'Caml been used in the industry to do tasks on the level of parsing million line codebases?
<Yurik_>
jemfinch: ocaml has more applications
<jemfinch>
Yurik: Does it? I really don't think so.
<jemfinch>
not more significant applications.
<whee>
jemfinch: and where has SML been used in simulation of circuits? (not that ocaml has, but still)
<Yurik_>
jemfinch: even including some apps, not libs
<whee>
you can't base it on one thing
<Yurik_>
jemfinch: CIL?
<Yurik_>
jemfinch: ActiveDVI?
<jemfinch>
whee: but what are you basing the argument that O'Caml is used industrially on?
<jemfinch>
Yurik: what's CIL?
<whee>
I'm not saying that it is being used, I'm saying that it's as least as capable of it as SML
<Yurik_>
jemfinch: and so on. I produce as many ocaml apps now as i can
<Yurik_>
jemfinch: soon ocaml community will get \muWEV
<jemfinch>
whee: I'm not claiming that O'Caml is *less* capable than SML.
<Yurik_>
jemfinch: soon ocaml community will get \muWEB
<jemfinch>
whee: only that SML is just as capable.
<Yurik_>
jemfinch: C parser, structure lib
<jemfinch>
and certainly not "academic"
<jemfinch>
Yurik: it'll only be 3-4 years after SML's had it :)
<Yurik_>
SML *is* an academic language
<whee>
right, but its range of application is a a bit more restricted than ocaml
<jemfinch>
Yurik: you have absolutely *NO* basis for saying that.
<whee>
ocaml easily expresses imperative things, where SML may have problems
<whee>
and we all know the industry is imperative at the moment
<Yurik_>
jemfinch: haha
<jemfinch>
O'Caml is *far* more an academic language than SML. SML is focused on staying stable for industrial users; O'Caml adds a new theoretical feature every other minor release!
<Yurik_>
jemfinch: in term of the year or so you'll hear about big industrial application of an ocaml
<jemfinch>
whee: how could SML have any trouble expressing imperative things?
<whee>
I don't know
<jemfinch>
Yurik: I've already heard of big industrial applications in SML.
<whee>
heh
<Yurik_>
jemfinch: which one?
<lament>
actually
<lament>
ocaml is less academic
<lament>
i have proof
<lament>
my father has heard of it :)
<whee>
haha
<Yurik_>
lament: :))))))
<jemfinch>
whee: there *are* places where SML is more capable than O'Caml -- for instance, it offers first-class continuations, and thus a fully preemptive threading system.
<whee>
but how important is that in the industry?
<jemfinch>
Yurik: several applications based on CKit. FoxNet, an entire operating system and webserver written in SML.
<whee>
first class continuations are an academic feature atm
<lament>
jemfinch: hm, tell that to dash
<whee>
they aren't exactly something everyone's familar with
<jemfinch>
whee: first-class continuations? Well, the fact that SML has threading that's the same anywhere is a nice little benefit.
<Yurik_>
jemfinch: and where it is used. i haven't heard of it
<Yurik_>
jemfinch: ?
<jemfinch>
lament: dash is a CLer. He'll automatically hate continuations. Continuations don't mix well with macros that CLers have grown used to.
<jemfinch>
Yurik: what were you doing in 1999 when all the banks and software companies were worrying about Y2K and trying to fix their software?
<whee>
you can take any language and find an application done in industry for which it was used, jemfinch
<lament>
jemfinch: he does point out some practical issues concerning them
<lament>
they complicate things tremendously
<jemfinch>
You guys don't have to convince me that software has been written in O'Caml. I used O'Caml *before* I learned SML. I *know* what's available for it. I keep up with it. I just don't like it as much as SML.
<Yurik_>
jemfinch: i was doing my job ;)) but actually. even in this godforsaken Ukraine even bank specialists looks at caml
<jemfinch>
lament: as far as I've seen, the practical issues have to do with continuations escaping from macros like with-open-file and such.
<jemfinch>
lament: that doesn't apply to SML, obviously.
<Yurik_>
and afaik some bank systems in france uses ocaml
<lament>
jemfinch: continuations also complicate tail recursion
<jemfinch>
SML seems to have gotten around that.
<lament>
I don't remember the exact reasoning, dash would have a link
<jemfinch>
lament: I've read a bit about it.
<lament>
and of course complications in the implementation == slowdown
<jemfinch>
lament: there are several papers explaining why heap-based continuations don't necessitate slowdown, I'm sure you can find some on citeseer.
<asqui>
Yurik: Hi there (scuse the delay :)
<Yurik_>
asqui: hi!
<asqui>
Hows it going?
<Yurik_>
asqui: not very good, but goes
<Yurik_>
anyway
<Yurik_>
in term of year, I'll repeat, you'll see ocaml app that isn't sml :))) so it will be a proof
<Yurik_>
it will be a quite serious app
<Yurik_>
btw. does sml has something close to Ensemble
<Yurik_>
?
<lament>
there's a serious app written in elisp
<lament>
but that doesn't mean elisp is a good language :)
<Yurik_>
lament: cos
<Yurik_>
lament: but anyway our app will show what caml can do for the business, believe me
<whee>
is it a time machine?
<whee>
please let it be a time machine :)
<Yurik_>
unfortunately it is not a time machine :))
<Yurik_>
but it is a new generation business automation platform
<Yurik_>
unfortunately, most of you can't come to the seminar at Moscow. it will be about our platform and in particular usage of caml
jemfinch has quit [Read error: 104 (Connection reset by peer)]
Yurik__ has joined #ocaml
<whee>
heh
Yurik has quit [Read error: 110 (Connection timed out)]
Yurik__ has quit [Client Quit]
Yurik__ has joined #ocaml
jao has joined #ocaml
<Yurik__>
re
<Yurik__>
got disconnected again :))
<Yurik__>
jao: hi
<jao>
hi
ChoJin has joined #ocaml
<ChoJin>
hi
<ChoJin>
anyone here ?
<Yurik__>
ChoJin: hi
<ChoJin>
I am profiling a prog
<Yurik__>
ChoJin: yes
<ChoJin>
Each sample counts as 0.01 seconds.
<ChoJin>
% cumulative self self total
<ChoJin>
time seconds seconds calls s/call s/call name
Yurik_ has quit [Read error: 104 (Connection reset by peer)]
mattam has quit ["zzzzZZZZZZzzzzzz"]
<whee>
I think modify is some sort of C call for doing the obvious and modifying values
<whee>
CAMLextern void modify (value *, value);
<ChoJin>
k; thx
jao is now known as jao_away
docelic has joined #ocaml
Yurik__ has quit [Read error: 110 (Connection timed out)]
<asqui>
shit a brick
<asqui>
this thing keels over
<asqui>
and dies....
<whee>
dying is good
<asqui>
anyone want to have a look at some code for me :)
<docelic>
heh, I thought you were typing in your one time password ;-)
ElCritter has quit ["Client Exiting"]
<asqui>
okay, a function takes a list of int, it ten works out the number of routes to get from the currect position vector, to the zero verctor, in esscence.
<asqui>
(Making only unit moves in one dimension at a time)
<asqui>
heres the code *cough*
<asqui>
let rec routesNd1 l = let l = filter (fun 0 -> false | _ -> true) l in
<asqui>
if length (l) = 1 then 1 else
<asqui>
it_list (fun a b -> a + b) 0(* Sum the results *)
<asqui>
(
<asqui>
map routesNd1(* Apply recursive call on each tweaked input *)
<asqui>
(
<asqui>
map (* Making a list of all these tweaked inputs *)
<asqui>
(apply (fun x -> x-1) (l)) (* Decrement the 1st, 2nd... element of input *)
<asqui>
(range(1,length(l)))(* Generate a list of counting numbers *)
<asqui>
)(* ^ READ THE COMMMENTS UPWARD FROM HERE ^ *)
<asqui>
);;
<asqui>
the filter will kill any zeroes in the input list (destination has been reached in that dimension)
<whee>
so what's the problem
<asqui>
if the length of the list is 1 we are down to 1 dimension, hence only one route.
<asqui>
the problem is that i call it with a 3 dimensional vector and it tells me Out of Memory 5 seconds later ):
<whee>
heh
<asqui>
#routesNd1 [1;2];;
<asqui>
Uncaught exception: Out_of_memory
<asqui>
and its a bitch casue i cant trace though!
<whee>
erm
<asqui>
its possible, for eample, that the stripping of zeroes isnt working therefore causing an infinite loop
<asqui>
son of a bitch... thats exactly it
<whee>
haha
<whee>
try using (<>) 0 instead of that fun thing
<asqui>
lol good point
<whee>
or maybe it's the negation of that
<whee>
err
<whee>
yes that appears to work :D
<asqui>
let filter f = fun [] -> [] |
<asqui>
(h::t) -> if f h then h::t else t;;
<asqui>
why is this only filtering the first occurence!!!
<whee>
hrm?
<whee>
you aren't doing any recursion in there
<whee>
so it eats the first and stops
<asqui>
hhahaahahhahaha
<asqui>
okay, if i give you my address will you come over with a bat?
<whee>
wood or aluminium?
<whee>
:)
<asqui>
So what would eb the correct way to implement the filter funtion?
<asqui>
have 2 lists, in and out, where you call it with in = [...] out = []
<whee>
it should already be included with caml light
<asqui>
its not
<asqui>
or if it is its not vry well documented and not called "filter"
<asqui>
>filter;;
<asqui>
>^^^^^^
<asqui>
The value identifier filter is unbound.
<whee>
hmm well how about using something like subtract
<whee>
subtract l1 l2 returns the list l1 where all elements structurally equal to one of the elements of l2 have been removed.
<asqui>
so anyway, 2 lists and we pop off the top one and call ourself with the tail as 'in' and either 'out' passed directly down, or out @ [the_head] ..... bring the bat, quickly.
<whee>
it really should have something like filter, gah
<whee>
heh
<whee>
I would just use subtract here if you don't want to write filter
<asqui>
yeah, im implementing it now.
<whee>
or check the ocaml source to see how they do it (stdlib/list.ml)
<whee>
likely a tail recursive solution there
<asqui>
its easy.
<asqui>
let filter f l = filter_aux f l;;
<asqui>
let filter_aux out = [] -> out | (h::t) -> if f(h) then filter_aux (out @ [h]) t else filter_aux h t;;
<asqui>
Is that on the right track?
<whee>
I have no idea :)
<asqui>
oh cmon man!
<asqui>
filter_aux takes 2 lists, in and out, initially out is empty, we add stuff to out if it complies, else we discard it.
<asqui>
that wat one by one the elements get flicked from 'in' to 'out' (or into the trash) and in the end 'in' is empty and we return 'out' boselector mmkay thanks
<asqui>
I can believe that i used that implementation of filter and then wondered why it ran out of memory
<asqui>
that was the only function i didnt actually test
<asqui>
"why doesnt this work" "lets see, YOU LEFT OUT THE RECURSION, little omission there mate!!!"
<SoreEel>
I just finished writing a non-tail recursive version of filter... interesting language.
<asqui>
In caml?
<SoreEel>
Yes.
<asqui>
Was it anything like what I had?
<SoreEel>
let rec filter f = function [] -> [] | h::t -> if f h then h::filter f t else filter f t;;
<asqui>
Why was it non-tail recursive?
<SoreEel>
Simply because instead of using multiple lists, it utilizes the stack.
<asqui>
rofl, thats exactly what i said!
<SoreEel>
Did yours work?
<asqui>
didnt test it, im using "subtract" now :)
<whee>
heh
<asqui>
oh right, yeah thats not tail recursive.
<SoreEel>
I said it wasn't :P
<asqui>
yeah
<whee>
hey did you know it's not tail recursive
<whee>
:)
<asqui>
mine was because i wrappered it and passed around lists :p
<SoreEel>
Functional languages are fascinating in the fact that complex data structures are implicitly defined by the relations of functions and recursion ( via the stack ).
<asqui>
and my first-attempt implementation was *completely* non-recursive, lol
<SoreEel>
Probably why they're good at logical stuffs.
<whee>
SoreEel: you should learn haskell at some point too
<whee>
I've been doing that lately
<asqui>
SoreEel: Do you mean to say that "wow, given :: and recursion I can do everything with lists, shit thats cool" ?
<whee>
a lot of haskell is over my head but I'm starting to get the hang of it
<SoreEel>
asqui: Well, that's a shallow approximation.
<SoreEel>
What I meant was far more profound.
<SoreEel>
Ahem.
<asqui>
whee: Ill make a node to avoid haskell :)
<whee>
heh
ChoJin has quit ["bye !!!"]
<SoreEel>
It's almost as if chains of functions operate on some formless ethereal structure of information.
<whee>
being able to pass functions around and create anonymous functions helps a lot in terms of reusability
<SoreEel>
Does O'Caml support first-class continuations?
<whee>
I don't believe so
<SoreEel>
Shame, really.
j_bravo has joined #ocaml
<j_bravo>
hello anyone still up?
<j_bravo>
anyone by chance???
<j_bravo>
plz
<asqui>
NEGATIONIVE
<asqui>
we are all down
<asqui>
ALL OF US
j_bravo has left #ocaml []
<SoreEel>
The snow here in Canada obscures any view of the Sun, thus we do not operate on any celestial based time system. I have no reason not to be up..
<SoreEel>
Hey, he/she missed my clever comment.
graydon has joined #ocaml
j_bravo has joined #ocaml
<j_bravo>
too bad...
<j_bravo>
no really..
<j_bravo>
all i have is one little q about pattern_matching...
<SoreEel>
If you go ahead and ask the question, perhaps at some undetermined point in the future one may reflect on your situation and provide an answer..
<j_bravo>
let me send u my script so it will be easier to understand for u ...
Ymrryr has quit ["Leaving"]
<asqui>
Regardless of wether you do pose your question at any point be informed that I will be sitting in the corner hitting my head on hard objects. Please dont let it disturb you.
<j_bravo>
LOL
* asqui
sees hope for a lost cause more lost then himself
<j_bravo>
when u start the script u will read the problem...
<SoreEel>
j_bravo, I would be happy to help answer any _specific_ questions you have.
<j_bravo>
i tried to start another function within pattern matching---
<j_bravo>
why wont this work
<asqui>
Hang on, i having trouble sticking this up my nose, do I have to print it first or soemthing
<j_bravo>
no its an .ml file
<j_bravo>
open it with ocaml
<SoreEel>
If the situation is extremely abstract, metaphors may be required for an explanation.
<j_bravo>
mmmm....
* j_bravo
*kind of desperated @ 3:43 in the morning
<asqui>
'desperated'?
<SoreEel>
I think all questions should be in the form of a Haiku.
<j_bravo>
*desperate*
<j_bravo>
Haiku?
<j_bravo>
well i get an Ubound Value f2
<asqui>
All nice and succinct,The grandfather of our time, Haiku pwns your face.
<j_bravo>
the intension of my script is the LZW Algorithm
<j_bravo>
...trying not to use any refs and while...do
<asqui>
j_bravo: This exression has type sentence but is used with type Haiku.
<j_bravo>
i see...so what is the solution...i cant start any other functions within pattern matching?
<asqui>
j_bravo: This exression has type sentence -> sentence but is used with type Haiku.
<j_bravo>
"The primary purpose of reading and writing haiku is sharing moments of our lives that have moved us, pieces of experience and perception that we offer or receive as gifts. At the deepest level, this is the one great purpose of all art, and especially of literature."
<j_bravo>
oh well
<asqui>
Is Caml doesn't inspire and sexually arouse you, we will not help you.
<asqui>
So like... whats the actually problem dude?
<j_bravo>
before OCAML can inspire and sexually arouse me I need to get to know it's syntax...
<whee>
hooray back
<j_bravo>
have u looked at the script @asqui?
<asqui>
Who the hell is @asqui? Yes ive looked at the code you sent me.