vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]
cjohnson has quit [""We live like penguins in the desert...""]
Smerdyakov has joined #ocaml
xcar has quit [Read error: 60 (Operation timed out)]
tautologico has joined #ocaml
Sonarman has joined #ocaml
CosmicRay has joined #ocaml
<araujo>
Hello cognominal
<araujo>
Hello CosmicRay
<araujo>
:-)
<Smerdyakov>
Hello araujo
<araujo>
Hello Smerdyakov
<araujo>
What's up?
<Smerdyakov>
I'm sitting here chatting on IRC. How about you?
<araujo>
Same here, nothing much really :-)
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
* araujo
will probably take a look at an O'caml code and then goes to bed
<CosmicRay>
hello araujo
<tautologico>
nobody asked
<tautologico>
but I just finished rewriting a nightmarish C program in OCaml
<tautologico>
still a bit pesky though, it's a fairly imperative program
<araujo>
tautologico, what is it?
<araujo>
CosmicRay, heya buddy, you also an ocaml guru? :-)
<tautologico>
a simple implementation of a Turner machine for graph reduction
<tautologico>
it's actually to test garbage collecting schemes
<CosmicRay>
araujo: more haskell these days :-)
<araujo>
CosmicRay, :-)
<Smerdyakov>
tautologico, is it for your thesis?
<tautologico>
Smerdyakov, it's very possible that it will end on my thesis
<tautologico>
part of it at least
<tautologico>
I've got to find a way to include dependent types on my thesis though :)
<araujo>
Hey guys, one question
<araujo>
Im writting a small socket appli, just more an example than a real program,
<araujo>
Is it good to use the high level network connection functions?
<Smerdyakov>
It's always good to use high-level abstractions! Duh! :D
<tautologico>
well, what could be bad about it ?
<araujo>
Or should i go using the old-school-fashion , Unix.socket , Unix.accept ... functions?
<tautologico>
once I didn't use the high level functions because they were broken on windows and I was testing on that... but otherwise just use the high level
<araujo>
Good.
<araujo>
I just ask, because it's my first socket program in ocaml, and they seem pretty easy to use, and im usually afraid of easy things :-)
<araujo>
tautologico, not bad, but to know if it lacks some important feature , they have looked pretty smart to me so far...
<Smerdyakov>
The SML Basis has much nicer networking support. :P
* araujo
imagines this is one of the advantage of O'Caml
<araujo>
Smerdyakov, nicer then O'caml?...
<Smerdyakov>
Oooooh yes.
<Smerdyakov>
Phantom types, man.
<araujo>
I like O'caml networking support more than C
<araujo>
No idea what you talk about :-/
<tautologico>
the OCaml standard library could be better
<araujo>
really?..
<araujo>
seems nioce to me
<tautologico>
there's a lot of things I miss
<tautologico>
especially when I switch from sml
* araujo
doesn't know sml
<tautologico>
it's similar
<dan2>
ocaml networking library is just a wrapper around Cs
<dan2>
but it works nicely imho
<Smerdyakov>
The SML Basis stuff mostly is, as well, but it uses types to do more compile-time checking than C does.
<Smerdyakov>
(And more than OCaml Unix does.)
<dan2>
Smerdyakov: which do you prefer, ocaml or sml
<Smerdyakov>
SML
<araujo>
So sml has better type checking than ocaml?
<dan2>
araujo: no, just better compile time checking
<Smerdyakov>
araujo, no. We're talking about the "standard libraries."
<araujo>
Ah ok.
<dan2>
Smerdyakov: Where does anybody use SML?
<araujo>
That was my next question :-)
<Smerdyakov>
Can't say I care.
<tautologico>
mostly research
<Smerdyakov>
There are quite enough swell tools for it.
<tautologico>
theorem provers
<Smerdyakov>
I use it for all the dynamic web sites I run.
<araujo>
nice
<Smerdyakov>
And all of the system administration tools I write.
<araujo>
Smerdyakov, what do you use, new jersey sml?
<dan2>
Smerdyakov: mod_ocaml work nicely?
<tautologico>
I just don't think it has a well-rounded set of tools like OCaml... sure mlton is great, but it's whole-program only, no incremental development
<araujo>
O'caml seems to me it has a very good stdlib
<dan2>
tautologico: I think compiling for a vm makes more sense than static compiling
<Smerdyakov>
tautologico, only for a few years more.
<tautologico>
there was talk some time ago about making an ocaml front-end for mlton... that would be great
<Smerdyakov>
I think we're about due for a new MLton release. I wonder what Big New Things it will bring.
<araujo>
dan2, i think the choice between dynamic or static compiling is more a matter of need
<tautologico>
dan2, the great thing is to be able to choose :)
<dan2>
SML.NET looks really interesting
<araujo>
tautologico, that's one reason i like so much o'caml :-)
ulfdoz_ has joined #ocaml
<dan2>
.NET<->ML is a good link
<araujo>
Of course, i think that using a language like O'caml brings new questions to answer in comparison with other language
<araujo>
But it's worthy in the long term
<araujo>
dan2, why?
<tautologico>
I used sml.net only for small tests, it's a good integration but it brings performance penalties, of course...
<dan2>
araujo: because .NET is like SDL, its very portable
<dan2>
tautologico: as expected
<dan2>
tautologico: but it can be optimized in time
<dan2>
tautologico: ML offers much better type checking
ulfdoz has quit [Read error: 60 (Operation timed out)]
<tautologico>
dan2, yes but it's a problem of the model imposed by the CLR
<tautologico>
MS likes to say the CLR is language agnostic
<tautologico>
but in truth it's language agnostic as long as your language is a different syntax for C# :)
<Smerdyakov>
Fellas, don't tell anyone, but I'm working on .NET stuff at Microsoft Research starting in a week.
<araujo>
hah
<dan2>
hehe
<araujo>
Smerdyakov, what did you do to deserve that!!?
<tautologico>
Smerdyakov, the F# stuff with Don Syme, by any chance ?
<araujo>
haha
<araujo>
Is it true ms C# uses the java vm? :-)
<Smerdyakov>
tautologico, nope. Protocol checking for Singularity, and maybe some larger scale thing than that.... I'm not entirely clear from my interview with my mentor-to-be.
<smimou>
yes but yours is specific to the type of TL_Pair
<smimou>
caml's type system is not powerful enough to type the first projection of any "pair type"
<della>
smimou: oh, I see
<mflux_>
della, let Foo (a, b) = f x in a is marginally shorter?-)
<slashvar[lri]>
mflux_: you even can do a let Foo (a,_) = f x in a
<mflux_>
but, maybe the guy who wrote the 'deriving'-language extension could extend it a little bit further?-)
<mflux_>
fst'Foo could be a proper name for such generated function
<mflux_>
let fst'Foo, snd'Foo = let enpair (Foo (a, b)) = a, b in (fun x -> fst (enpair x)), (fun x -> snd (enpair x)) maybe
smimram has joined #ocaml
<mflux_>
btw, some people like to use haskellish function composition operators, and some use $ and some (maybe) ++..
<mflux_>
however I think @@ and @. are better, because they are right-associative
<mflux_>
so that could be written as .. a, b in (fst @. enpair), (snd @. enpair)
<mflux_>
(that particular example would ofcourse work with left-associative operators too ;))
<della>
mflux_: great, thanks :)
<della>
mflux_: just got a small insight on the powerfulness of pattern-matching :)
<mflux_>
happy to be of guidance to teh secrets of ml ;)
<della>
mflux_: is it possible to make the "not exhaustive" warning disappear?
<mflux_>
I think not, if not with a compiler switch
<della>
mflux_: I see, thanks
<mrvn>
| _ -> raise Not_Exhausitve
<della>
mrvn: how do I pack it in a let construct?
<mflux_>
mrvn, but doesn't quite work with let?
<mrvn>
as in?
<mflux_>
type foo = Bar | Baz let foo Foo = 42
<mflux_>
uh
<mflux_>
let bar Bar = 42 ;)
<mrvn>
let bar = function Bar -> 42 | _ -> raise foo
<mrvn>
Or better don't even devise such code and datatypes.
<mflux_>
which is three times as long expression
<mrvn>
you could make a preprocessor makro for it like the ocamlp4 thing
<mrvn>
I tend to not have not exhausitve matches in the first place. The few times I do I suffer the extra typing.
<mrvn>
and comment why this can't happen.
<mflux_>
obviously very few people do non-exhaustive matches as the compiler keeps on whining. this is of course doesn't need to be a bad thing.
<mflux_>
people maybe give the non-matching cases more thought when the compiler warns about them
<mrvn>
most people just ignore them after checking they are correct.
<mflux_>
just leaving them there could 'hide' new such cases
smimou has quit [Read error: 110 (Connection timed out)]
<della>
I see. You know, I'm used to python and thus used to think that run-time errors aren't a bad thing :)
<della>
of course in caml you just have to have a different mental state :)
<mrvn>
della: better to think about it before it happens and add comments and raise statements.
<mrvn>
The raise statement to make it not show up anymore.
angagon has joined #ocaml
CosmicRay has joined #ocaml
angagon has left #ocaml []
vezenchio has joined #ocaml
<della>
other stupid question: how to concatenate two lists? List.concat [a, b] ?
<mauke>
wasn't it @?
<della>
mauke: thanks
<della>
mauke: I've taken a theoretical course on caml's type system and those things weren't of course included :)
humasect has quit [Read error: 104 (Connection reset by peer)]
<mauke>
heh, yeah
<slashvar[lri]>
della: l1@l2, List.concat could also work. But list concatenation maybe seen as a bad idea in most time
<slashvar[lri]>
using append (at the begining) is far better when possible
<slashvar[lri]>
(elem::l)
CosmicRay has quit ["Client exiting"]
<slashvar[lri]>
(concat is a flatten operator ...)
<slashvar[lri]>
(and append wasn't a good name for :: since List.append is a concat ... )
b00t has quit [Remote closed the connection]
Smerdyakov has joined #ocaml
Smerdyakov has quit [Client Quit]
qvisitor_ has joined #ocaml
Smerdyakov has joined #ocaml
della has left #ocaml []
eydaimon has joined #ocaml
Gueben has joined #ocaml
Smerdyakov has quit ["The world is at the door."]
eydaimon has quit [Remote closed the connection]
eydaimon has joined #ocaml
pango has joined #ocaml
cjohnson has joined #ocaml
pango_ has joined #ocaml
pango has quit [Read error: 60 (Operation timed out)]
<vincenz>
This is very strange
<vincenz>
Anyone here that nkows the innards of ocaml?
Snark has quit [Read error: 110 (Connection timed out)]
<vincenz>
Basically I have
<vincenz>
type t = Alloc of ... | Free of ... | Write of ... | Read of ... | Scope of ...
<vincenz>
and then I do
<vincenz>
type t = Alloc of ... | Free of ... | Access of Memory.Type.t * .. | Scope of ...
<vincenz>
where Memory.Type.t = Read | Wriet
<vincenz>
I have soem code that does a LOT of comparations
<vincenz>
yet oddly the second version is faster (even though you'd assume you need more dereferences)
Snark has joined #ocaml
cjohnson is now known as cj|work
<mrvn>
vincenz: if Memory.Type.t already differs the compare can stop.
<vincenz>
mrvn: it's just the Raed/Wriet
<vincenz>
In the first it's directly on the main type t...
<vincenz>
in the second case you first have to go to Access and then to Memory.Type.t
<mrvn>
but if you compare a read with write it doesn't have to dereference the rest.
* vincenz
shrusg
<mrvn>
hmm, right.
<vincenz>
I dont' get it, but the second version is faster (though that might be expalined that I get the R|W in and I either have to stick it into Access or switch on it and then add a Read| Write of this type)
<mrvn>
How many cases do you have? I assume it is still a small enumeration type?
<vincenz>
Also...what's faster..maps or hasheS?
<vincenz>
mrvn: those are the exact enumerations
<mrvn>
maybe it gives better cache alignment that way.
<vincenz>
ugh....they should really change the Map module...it's the only module that dos not have its own type as first param to its functions
<vincenz>
s/dos/does
<mflux_>
well, changing something, I don't think that's nice
<vincenz>
true
<vincenz>
but it's a bitch
<mflux_>
but maybe they could have a new hierarchy for 'collections' with similar apis
<mflux_>
with functional/nonfunctional variants, and finally get the functional hashtable there..
<mflux_>
oh yeah, and with stream-support
vodka-goo has joined #ocaml
<vincenz>
yip
<mrvn>
Doesn't that make Hashtable O(log n) for insert?
<vodka-goo>
not really, it can be worse if many items go in the same cell
<vincenz>
like O(n)
TeXitoi_ has joined #ocaml
Zaius has joined #ocaml
<Zaius>
hi, its me
<Zaius>
how do i resolve cyclic dependencies when compiling interfaces?
<mrvn>
Zaius: put them in one file
<mrvn>
vincenz: The right question is how do you make functional arrays?
<Zaius>
can i do better than putting them in one file?
<mrvn>
Copying them each time is O(n) insert and O(1) lookup. A tree would be O(log n) both times.
<mrvn>
Zaius: no
<vodka-goo>
you can also break them among more files
<vodka-goo>
sometimes it helps
<mrvn>
Only if it is an artifical cycle.
<Zaius>
hmm, right now i inserted abstract types in every module that requires them
<Zaius>
but i dont like it
<vodka-goo>
I had to do that once
TeXitoi has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
Zaius has quit []
_JusSx_ has quit ["leaving"]
rcv has joined #ocaml
TeXitoi_ has quit [Read error: 54 (Connection reset by peer)]
TeXitoi has joined #ocaml
bk_ has joined #ocaml
Gueben has quit ["plouf"]
<mflux_>
yeah, I have no idea what I was thinking when hoping for functional hashes, must've read and thought something without completely following through ;)
cj|work has quit [Connection timed out]
cj|work has joined #ocaml
jussx has joined #ocaml
jussx has quit [Client Quit]
jussx has joined #ocaml
Purice has joined #ocaml
Purice has quit ["Leaving"]
<Snark>
good night
Snark has left #ocaml []
Herrchen has quit ["good night"]
Skal has quit ["Client exiting"]
Aradorn has joined #ocaml
<vincenz>
mrvn: ropes
<Aradorn>
ok this is stupid, i do ocamlc hello.ml -o hello and get the error telling me it cant open the pervasives.cmi
<Aradorn>
so duh, not telling it where the lib folder is
<Aradorn>
but i cant remember how to do that, without specifying -L<DIR> each time i goto compile a file
<Aradorn>
I have the OCAMLLIB system variable, but for some reason cant remember how i need to use it when i goto compile the file so it recognizes the directory
cj|work has quit [Connection timed out]
cj|work has joined #ocaml
jussx has quit [Read error: 110 (Connection timed out)]
<Aradorn>
is the ocaml site down?
cj|work is now known as cjohnson
vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]
vezenchio has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
cjohnson has quit [Client Quit]
mrsolo has joined #ocaml
rcv has quit ["Abandonando"]
<ulfdoz_>
cya
eydaimon has quit [Remote closed the connection]
eydaimon has joined #ocaml
<Aradorn>
ok im converting one of my early CS course programs to ocaml and i need to know when an input is a number or not
<Aradorn>
is there a built in function like isNum or something?
<Aradorn>
or am I going to need to write my own
<smimram>
to see if a string is a number ?
<smimram>
if it's the case, there is the Scanf module
<Aradorn>
er well actually cant i do read_int ?
<Aradorn>
think i remember seeing something like that on a tutorial
<smimram>
Scanf again :)
<Aradorn>
ok so thats part of the Scanf module?
<Aradorn>
what hapepns when a user inputs a char or string then?
<mauke>
you could also read a line and use int_of_string
<smimram>
you get an exception
<Aradorn>
know what type off hand? so i can catch it and ask them again for input
vezenchio has quit ["Ayn Rand encapsulates the rage that every teenager feels on finding that his first paycheque has had taxes taken out of it"]
<Aradorn>
building a decimal to hex converter to help me learn the different functions in ocaml
<Aradorn>
but trying to it as close to the functional style as possible... but darn imperative programming has killed me =p
Shammah has joined #ocaml
mlh_ has joined #ocaml
smimram has quit ["↓"]
<Aradorn>
there isnt anyway to initialize a string as empty? where I can concat itself with another string later.
<Aradorn>
let a = ();; let b = "adf";; let a = b^a;; dosnt work...