monotonom has quit ["Don't talk to those who talk to themselves."]
kinners has joined #ocaml
cDlm has quit [Remote closed the connection]
cDlm has joined #ocaml
wolfman8k is now known as wolf|zZ
GreyLensman has joined #ocaml
sundeep has quit ["Client exiting"]
yauz has joined #ocaml
GreyLensman has quit ["Leaving"]
vezenchio has quit ["According to [a processor for game design], you statistically have a better chance of becoming a rock star than you do of suc]
gini has quit [Read error: 110 (Connection timed out)]
monotonom has joined #ocaml
cjohnson has quit [Read error: 54 (Connection reset by peer)]
Nutssh has joined #ocaml
Nutssh has quit [Client Quit]
Nutssh has joined #ocaml
slashvar1lri] has joined #ocaml
slashvar[lri] has quit [Read error: 104 (Connection reset by peer)]
kinners has quit [Read error: 60 (Operation timed out)]
monotonom has quit ["Don't talk to those who talk to themselves."]
kosmikus|away is now known as kosmikus
mrsolo has joined #ocaml
slashvar1lri] has quit [Read error: 104 (Connection reset by peer)]
Lemmih has quit [Read error: 60 (Operation timed out)]
Petruchio has quit ["Fare thee well."]
eigenspace has joined #ocaml
mrsolo_ has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
wmg has joined #ocaml
wmg has left #ocaml []
karryall has joined #ocaml
slashvar has joined #ocaml
<slashvar>
Hi there !
<Nutssh>
slashvar, hi.
<vincenz>
Anyone know a good book on denotational semantics for defining proglanguages? (Or perhaps a pdf)
<slashvar>
hum ... I think there's a book from Dave Smith (I think it's the rigth spelling) and it's available online
<slashvar>
but I don't have the url at hand
<vincenz>
Ah, yes I had heard of that name
<vincenz>
Didn't know it was online though, thnx
<slashvar>
I meet him 2 weeks ago (in a spring school for phd student) and he told us about it, but I forgot to write down the url
* vincenz
nods
<vincenz>
What are you doing your PhD on?
<mayhem>
slashvar: are you s.peyronnet
<slashvar>
non
<slashvar>
But I know him
<mayhem>
he was my algo teacher this year
<vincenz>
Tu parles francais, j'assumes. J'ai vu que tu viens de .fr
<slashvar>
oui
<slashvar>
mais c'est un channel anglophone ;)
<vincenz>
Yup
<vincenz>
So what is your PhD on?
<slashvar>
Secure Information flow analysis in the CDuce language
* vincenz
nods
<vincenz>
So I assume CDuce is used to model it? I have to admit I never heard of that language
<slashvar>
no, CDuce is an XML-oriented language
<vincenz>
So you're studying the security in CDuce? Or you're using CDuce (aka modelling in CDuce) the security analysis?
<slashvar>
I working on static/dynamic analysis to infer information flow (mainly for security purpose)
* vincenz
nods
<slashvar>
so CDuce is my target language (and I'm using an extension of its type system, with semantic subtyping, to infer flows)
<vincenz>
ah I see
<slashvar>
(If you're interested in CDuce, just take a look at www.cduce.org ;)
<vincenz>
Far off from my PhD domain :P
<slashvar>
what is yours about ?
<vincenz>
Well the topic isn't fixed yet as I started in april and I've been juggled around a bit
<vincenz>
But generally memory management for multimedia applications on low power embedded systems
<slashvar>
oki
<vincenz>
BAsically how to use the memory-hierarchy as optimally as possible
<vincenz>
And with the new very small technologies when to migrate when the chip starts to overheat
<karryall>
vincenz: and are you using ocaml for this ?
slashvar has quit [Read error: 104 (Connection reset by peer)]
<vincenz>
Nope
<vincenz>
I used Ocaml for the ICFP
<vincenz>
Most of the code I work on necessarily is C++
<vincenz>
Seeing most multimedia apps are in c++
<vincenz>
However I just started and maybe I can integrate Ocaml ;)
wolf|zZ is now known as wolfman8k
<vincenz>
Anyone know how to do subtitution on filenames in bash?
<vincenz>
for i in '*.ps'; do ps2pdf $i ($i - ps +pdf); done
<vincenz>
got it
gim has joined #ocaml
slashvar[lri] has joined #ocaml
buggs^z has joined #ocaml
<Nutssh>
I try to code in ocaml whenever I can get away with it.
<Nutssh>
Oh, and thanks for switching back to english for the discussion above.
buggs has quit [Read error: 60 (Operation timed out)]
wolfman8k has quit ["Leaving"]
Herrchen has joined #ocaml
bk_ has joined #ocaml
<vincenz>
Me too
<Nutssh>
:)
buggs^z is now known as buggs
<vincenz>
In fact our ICFP team was c++
<vincenz>
But the simulator was being built so slowly I quickly hacked one together in ocaml
<vincenz>
It's quite funny, most people claimed like 22mins in forth, or 5 minutes in haskell for runtime of their simulator
<vincenz>
my ocaml one took 4 seconds
<vincenz>
And after I moved one list ot an array
<vincenz>
2 seconds
* vincenz
taps his head
<Nutssh>
:)
<Nutssh>
And how much faster was it to code?
<vincenz>
Ooh....I don't know...hmm....MUCH!
<vincenz>
Took me a while to get a gui coded
<Nutssh>
:)
<vincenz>
Seeing I had never used Graphics
<vincenz>
And a bit of time for the parsing of the inputfiles
<vincenz>
cause I did it manually
<vincenz>
(not that comfortable with ocamllex and ocamlyacc yet)
<Nutssh>
I was tempted to do it, but I want to do it with a group, and nobody here has any great love of such languages.
<vincenz>
Next year you're on my team then :)
<vincenz>
#abstractoasis is the channel
<Nutssh>
We're a java place here. :(
<Nutssh>
:)
<vincenz>
I did it with only people from irc
<Nutssh>
What is/was that? Who'd you do it with?
<Nutssh>
Neat.
<vincenz>
From freenode
<vincenz>
My box is linux so I had a cvs installed
<Nutssh>
I mentioned it then, someone here said that a team existed.
<vincenz>
Everyone got an account
<vincenz>
and communication through irc
<vincenz>
Shouldn't it be Putty?
<Herrchen>
moin
<vincenz>
Moin?
<Herrchen>
slang here in germany for hello - just a bad habit to use it on irc ...
<Nutssh>
Cool.
<Nutssh>
Ich spreche Deutsch nicht sehr gut.
<Herrchen>
I compete with a friend using the same setup: talk over irc and cvs for code sharing
<Nutssh>
Nice.
<vincenz>
AH moin
<vincenz>
from MoinMoin
<Herrchen>
at least this sentence is correct :)
<vincenz>
Ich sprece night Deutsch.
mellum has joined #ocaml
<mellum>
hi
<vincenz>
spreche even
<Nutssh>
I sorta like telephone because its higher bandwidth, but CVS and IRC work OK.
<vincenz>
Perhaps but that's not possible in group
<Herrchen>
well in fact it is from nothern germany (Friesland) and sometimes moin moin is used.
<vincenz>
And it doesn't give you an overview of what is being spoken
<Nutssh>
Yeah.
<vincenz>
Herrchen: lookup MoinMoin it's a python implementation of a wiki
<Herrchen>
(and sometimes confused with good morging/guten morgen - because it sounds similiar)
<Herrchen>
vincenz: ah - i didn't know
<vincenz>
Maar ik spreek wel nederlands en dat trekt heel veel op duits
<Herrchen>
hmm what is your feeling about your contest entry? I think ours sucks - after having to choose C because it was the only language we both knew I got really trouble with missing some features I am used to
<vincenz>
That's why I participate with people off the net
<vincenz>
I mean from irc
<Herrchen>
vincenz: sorry I didn't understand your last sentence
<Nutssh>
:)
<Nutssh>
Ocaml is just too advanced.
<Herrchen>
anyway, I had fun
<Herrchen>
and thats what counts imho
<Nutssh>
:)
<Nutssh>
I would have been happy to have done it with others in lisp.
<vincenz>
I did it last yaer in scheme
cjohnson has joined #ocaml
<Herrchen>
we hoped to have something what we could do in prolog - and the one of this year would have been to slow :)
<vincenz>
does prolog have good IO/Gui capabilities?
<Herrchen>
vincenz: depends on the prolog system
<Herrchen>
I thought it could be something which would be good solveable in prolog, but then it wasn't :)
<Herrchen>
but in fact most prolog systems are slow
<Herrchen>
the fastest I know is the ciao prolog system (GPLed) - which compiles to machine code, but don't know how good it handles dynamic predicates
<Nutssh>
common lisp with compilation at runtime would be pretty sweet for this years ICFP, at least for the simulation bits.
<Herrchen>
ah sigfood received - bbl
cjohnson has quit [Read error: 110 (Connection timed out)]
cjohnson has joined #ocaml
<buggs>
how does one detect eof without raising an exception ?
<buggs>
Herrchen, is ciao faster than yap ?
<Nutssh>
Whats wrong with detecting the exception?
<vincenz>
buggs: What's wrong with
<vincenz>
exceptions?
<buggs>
try let c = get_char in foobar c with Eof -> print last_c
<buggs>
i want sth like that
<buggs>
in case of eof i need the last char before the eof
<vincenz>
let rec read_file() =
<vincenz>
try
<vincenz>
let data = Instruction.parse(input_line channel) in
<vincenz>
data :: (read_file ())
<vincenz>
with End_of_file -> close_in channel; []
<vincenz>
buggs: easy
<vincenz>
let last_c = ref ' ' in
<vincenz>
try let c = get_char in last_c :=c; foobar c with Eof -> print !last_c
<buggs>
ya but that sucks when the channel has 0 chars
<vincenz>
Duh
<vincenz>
Anything will suck if you have 0 chars
<vincenz>
Cause conceptually speaking the notion of last char doesn't make sense in a channel of 0 chars
<vincenz>
No matter what system you use...
<vincenz>
or
<buggs>
well if there is 0 chars i should print '' and not your ' '
<vincenz>
let last_c = ref None in
<buggs>
ya opetions ...
<Nutssh>
There is no ''. There is the empty string "", but no empty char.
<buggs>
this complicates stuff and i need performance
<vincenz>
buggs: You HAVE to use one of those systems
<vincenz>
Conceptually speaking
<vincenz>
Yiu have no notion of a last_char
<vincenz>
So either use an option
<vincenz>
or use a default character
<buggs>
there should be something to detect eof
<vincenz>
There is no alternative
<vincenz>
Even if the language provided it
<vincenz>
If it's a file
<vincenz>
val in_channel_length : in_channel -> int
<vincenz>
and then use seek
<buggs>
no it's stdin or a file
<vincenz>
..
<vincenz>
Yet you need performance
<vincenz>
I doubt the system I proposed is slow
<buggs>
c := get_char
<buggs>
maybe
<vincenz>
Or any slower than the ideal system
<vincenz>
A ref is not that slow it's just an if
<vincenz>
And you only need to check it's value at the end
<vincenz>
once
<vincenz>
I mean an option
<buggs>
isn't a match rather expensive ?
<buggs>
i'll benchmark
<Nutssh>
Don't worry, just do it.
<Herrchen>
re
<Herrchen>
buggs: yes
<Herrchen>
buggs: yap just compiles to some sort of WAM
<vincenz>
match is not expensive, it's just a switch
<Herrchen>
buggs: but there should be some performance improvements in yap 4.5.x so I don't really know, I don't use development versions if I don't have to
<buggs>
interesting never new about ciao
<buggs>
*knew
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
<Herrchen>
anyway gotta go - bye
<Nutssh>
buggs, don't bother micromanaging it. Implement first, then profile.
<Banana>
ls
<Banana>
sorry.
<Nutssh>
:) Thats always been my rule and its incredibly well.
<buggs>
ya, but i probably just fall to doing it in an impreative way
<Nutssh>
For something like that, I'd do it imperatively.. I believe ocaml has a while construct?
<buggs>
ya while true i used
<Nutssh>
The last two programs I wrote were bottlenecked by Random.int and Array.sort. Each accounting for about 30% of the processing time.
<buggs>
but the fallacy is to use input_char at all cause reading bigger chunks and coverting to a list is probably faster anyways
<Nutssh>
Better question. What is it you really want to do?
<buggs>
i'm doing an LZW compression programm
<buggs>
using a Trie as data structure
<Nutssh>
How about using Unix.read into a nice fat 16kb buffer?
<Banana>
buggs: i think input_* and output_* are buffered anyway so you actually read (from disk) a chunk of data and not a single char.
<Nutssh>
And, if you have to do a trie lookup on every character, the overhead of a function call to input_char is going to be lost in the noise.
<vincenz>
Banana: I suggested that, the problem is that he doesn't know the size of the channel as it's stdin
<Banana>
hum ?
<vincenz>
I suggested he does a seek fr the end of file (he needed that for some reason)
<vincenz>
But then he told me he's reading from stdin so channel_length is not an option
<vincenz>
And hence reading by buffer is not an option either
<Banana>
what i said is that the in_channel and out_channel data structures are already buffered (if i remember correctly) so he actually doesn't read on char at a time from disk.
<Banana>
he does'nt have to implement buffer himself.
<vincenz>
oh yes, that's truee
<buggs>
the trie lookup is no so bad
<vincenz>
but programmatically he still has to use input_char seeing he doesn't know the lenght of the channel
<vincenz>
neither is input_char
<Banana>
and i don't see the need for an Option type here...
<buggs>
gprof shows alloc_shr costing a lot
<buggs>
waht does it do ?
<vincenz>
I assume that's the GC
<Nutssh>
buggs, how much of it is done?
<buggs>
compare_val and compare_resize_stack next and .mcount
<buggs>
Nutssh, what do you mean ?
<Nutssh>
How much of the program is done?
<Banana>
buggs: these are 3 ocaml internals : alloc_shr is responsible for allocating bloc in the heap and regeistering them in the gc.
<Banana>
compare_val is the polymorphic comparision function.
<Banana>
it recursiveley traverse 2 ocaml value to test for equality.
<buggs>
Nutssh, it works (beside that i loose some bytes at the end because of my eof problem)
<Nutssh>
Ah.
<Banana>
it uses a stack, hence compare_resize_stack is a auxiliary function.
<Nutssh>
What are the major callers to alloc_shr at the end of the profile?
<vincenz>
Banana: you said 3 but mentioned 2
<Banana>
compare_val alloc_shr and compare_resize_stack ?
* Nutssh
counted 3
<Nutssh>
Suspicious.. Are you accidently using a generalized type \forall_A ... in your arrays instead of a specific type 'int array'. That hurt me a few times.
bk_ has joined #ocaml
<vincenz>
ah ok
<buggs>
i don't use arrays on encoding only when decoding
<buggs>
currently i messure encoding
<Nutssh>
ok.
<buggs>
another problem i have is that i output_binary_int always uses 4 bytes
<buggs>
Banana, so i guess the options aren't that cheap ?
<Nutssh>
ouput_char (Char.chr x)
<karryall>
output_byte
<buggs>
x := x / 256 go to 10?
<Banana>
buggs: i don't see why you need an options.
<Banana>
why not just a char ref ?
<Nutssh>
karryall, thanks.. Don't do much binary IO in ocaml.
<Banana>
buggs: you are using a while or a recursive function ?
<buggs>
Banana, if the channel is empty i should output nothing
<buggs>
while
<Banana>
why not just counting the number of byte read ?
<buggs>
it could be stdin
<Banana>
?
<buggs>
oh
<buggs>
i c
<Banana>
count = ref 0 ... try while blah do blah .... done with End_of_file -> if !count = 0 then ...
<buggs>
the programm gets uglier and uglier that way :(
<buggs>
don't you think if i read 1024 bytes explode them and recurse the list i can be as fast ?
<Banana>
you will spend time allocating cells for the list...
<Nutssh>
It shouldn't be as hard as you are making it out to be.
<buggs>
Nutssh, hard is one thing beauty is another
cjohnson has quit [Connection timed out]
<buggs>
look at my ruby version
<Banana>
buggs: what is the algorithm ? read chars, put them in a data structure and when End_of_file then work on the data structure ?
<vincenz>
I was going that way except for a small reasoning error
<vincenz>
otherwise I would've ended there as well
<vincenz>
But then again
<vincenz>
I'm new to ski
<Banana>
there is a missing parenthesis ....
<Banana>
hold on.
<Banana>
there.
<Banana>
you can reload.
<vincenz>
Woot I got W :)
<mayhem>
Banana: hum ok, I didnt know S was prioritary than K even when K is in (), and I didnt know that K scope could be extended to multiple nested ()
<Banana>
hum...
<Banana>
there is non priority...
<mayhem>
really strange cause when I do the exercise about combinator B, I found F G F G X, and the web interface says that it is a good result, can you try it ?
<mayhem>
ahhh I know why
<mayhem>
because the function there is FoG
<mayhem>
so its indeed (FoG) o (Fo G) (X)
<mayhem>
(F o G) (F o G) (X)
<mayhem>
not sure if I'm clear
<mayhem>
maybe it should be : (F o G) o (F o G) (X)
<mayhem>
B F G X =def (F o G) o (F o G) (X) okkkkkkkkk
<mayhem>
I think I got it ;)
<mayhem>
so B G X =def G G X probably
<mayhem>
what do you think ?
<vincenz>
B takes three params, you can't just drop one
<vincenz>
then you're left with a closure taking something
<Banana>
vincenz: quite.
<Banana>
you can still reduce (these are not function ;) but you get stuck at some point.
<Banana>
for B G X you can't go further than S (K G) X
<mayhem>
Banana: have you done the exercise ?
<Banana>
what ?
<Banana>
B G X ?
<Banana>
either way, you have got the Church Rosser property for the combinators.
<mayhem>
Banana: B F G X
<Banana>
it's F G X.
<mayhem>
Banana: see there is a form on the webpage for it
<Banana>
buggs: or why not instead of having let c = ref ' ' do : let try let c = input_char ... in try while true do ... done with End_of_file -> output with End_of_file exit 0
<vincenz>
quintiple I mean
<vincenz>
quadruple
<vincenz>
ruby/ocaml/java/c
<vincenz>
it's curious the java version is smaller in code than the ruby and ocaml one, or on par
<vincenz>
by the way your c-version is wrong
<vincenz>
for multiple reasons
<buggs>
they are not all up to date
<buggs>
i'm a bit bored at uni sometimes
<buggs>
we had to choose between c++ and SML
<vincenz>
the c version, first of all you need to do #ifndef INCLUDE_TRIE_H
<vincenz>
...
<vincenz>
secondly
<vincenz>
you can't define functions inside a .h file
<vincenz>
if you include it in multiple .c you'll have multiple definitions of that function
<buggs>
vincenz, yes i can
<vincenz>
the .h file should only declare the function
<vincenz>
buggs try linking two .o files from two .c files each with that .h inclusion
<buggs>
C is brocken in respective to how they encapsulate their modules
<Nutssh>
Also, why are you using a class for the trie instead of a module?
<buggs>
i wanted to test the OO features of ocaml
<Banana>
buggs: the classic way here to avoid counting and Option is to try to read one char first, then only enter the while loop where you update c at the end instead of the begining.
<buggs>
i find them less than great :(
<vincenz>
what's wrong with the OO features of ocaml?
<Nutssh>
Generally I reserve OO for times when I genuinely want subtyping and/or dynamic dispatch. So far, none of my ocaml code has actually needed that.
<vincenz>
ME neither
<karryall>
ugh objects :/
<vincenz>
And if you consider I come from an OO background...(C++/Java...)
<vincenz>
I program in an OO-style with modules
<buggs>
vincenz, see the foldl method
<vincenz>
(I even program in an OO way with c)
<Nutssh>
vincenz, you use modules..
<vincenz>
Nutssh: that doesn't stop me from using a clean oo paradigm
<Smerdyakov>
vincenz, what is "an OO style with modules"?
<vincenz>
a module defines one type t
<vincenz>
and all funcs take as first param that type t
<buggs>
c++ does not count as OO
<Smerdyakov>
vincenz, if you don't use dynamic dispatch, it's not OO.
<vincenz>
Smerdyakov: encapsulation...
<Smerdyakov>
vincenz, so call it that.
<vincenz>
Yes SyntaxPolice
<Smerdyakov>
vincenz, this technique existed long before it was used in an "OO" context.
<Nutssh>
C and java style 'objects' IMHO combine distinct concepts including subtyping, inheritence, modularity/namespace management and dynamic dispatch.
<vincenz>
I tend to use terms loosely
<Smerdyakov>
vincenz, don't use PL terms loosely in a channel with many PL researchers. :P
<vincenz>
Alright
* vincenz
is from an EE background...so doesn't even know half of the terminology
<vincenz>
You're lucky I remembered the term 'encapsulation' from some webpage and used it in this context appropriately
<Nutssh>
I do my code very heavily on the modules too, but I have yet to even be tempted, except once, to want to use the OO features. That was where I wanted buffer management with several backends.
<Smerdyakov>
I would prefer the term "data abstraction," myself.
<vincenz>
Meh
* vincenz
returns to reading papers on memory hierarchies
<buggs>
<vincenz> you should only place what's actually inside the struct in the module file
<buggs>
what do you mean ?
* vincenz
blinks
<Nutssh>
vincenz, what papers are you reading?
<vincenz>
When did I say that?
sanxiyn has joined #ocaml
<buggs>
after the ;; comment
<vincenz>
oh!
<vincenz>
yes
<vincenz>
module LZW struct xxxx end
<vincenz>
only place Xxxx in file lzw.ml
<vincenz>
and then you can refer to it as Lzw
<vincenz>
as long as you make an mli file as well
<buggs>
ah
<vincenz>
They should really put that more obviously in the o'reilly book
<karryall>
vincenz: no need for a .mli
<buggs>
what module LZW then good for ?
<vincenz>
karryall: not in this case no, but should he ever want to refer to module Lzw...
<Nutssh>
buggs, its for whan you want to encapsulate modules in other modules.
<buggs>
oh and it gets it implicitly uses the filename ?
<Nutssh>
For instance, in module Unix in the standard library, they should define several modules instead of a flat namespace.
<Nutssh>
Yes. module 'Foo' is implicitly defined in files 'foo.ml' 'foo.mli'
<Nutssh>
IN effect, it does at the top level '' module Foo = (struct <contents of foo.ml> end) : (sig <contents of foo.mli> end) ''
<Smerdyakov>
vincenz, you never need .mli files for anything but enforcing abstractions.
<buggs>
Nutssh, but when i have LZW and LZ78 and both have decode and encode ?
Barrett has joined #ocaml
<karryall>
buggs: you refer to them as LZW.encode and LZ78.encode
<buggs>
without opening LZW then ?
<Nutssh>
opening a module means that the namespace is exported. Like 'using namespace ...' in C++.
<karryall>
right
<buggs>
ah i got that very wrong indeed
Zaius has joined #ocaml
<Nutssh>
For the trie, I'd probably define it as type 'a trie = Node of 'a trie array | Leaf of 'a instead of going into the OO.
<vincenz>
'exported' by the mli was private to the module
<Nutssh>
Nice.
<buggs>
hmm so everyone is against OO in ocaml :)
<Banana>
no.
<Smerdyakov>
vincenz, if there is no mli file, everything is exported with its principal type.
<vincenz>
ocamlweb looks pretty fly
<vincenz>
Smerdyakov: I did not know that detail, thnx
Smerdyakov has quit ["Fly on plane!"]
<Nutssh>
buggs, no. I've just not had something that needed it yet. When I want dynamic dispatch and subtyping and inheritance, I'll use it, or perhaps more accurately learn how to use it.
<buggs>
i really would like someone comment on the foldl method of the trie
<buggs>
not the function
<karryall>
the method ? the problem is with #node I think
<Nutssh>
Sorry, Can't help you there.
<buggs>
karryall, "This method has type ('a -> node -> 'a) -> 'a -> 'a -> 'a
<buggs>
which is less general than 'b. ('b -> node -> 'b) -> 'b -> 'b -> 'b"
<buggs>
???
<vincenz>
buggs: link?
<karryall>
the first one is not polymorphic
<Nutssh>
Its alpha-renaming the 'a in your definition.