Meta has quit [Read error: 60 (Operation timed out)]
<mfurr>
anyone done any "declarative gui programming" in ml ala franTK of haskell?
Meta has joined #ocaml
Meta_ has quit [Read error: 110 (Connection timed out)]
JPL-Justin_ has joined #ocaml
<JPL-Justin_>
Greetings everyone!
<JPL-Justin_>
I had no idea this channel was on freenode, or I'd have been here a long time ago :)
<JPL-Justin_>
Is anyone actually present?
<mfurr>
yep
<JPL-Justin_>
hey
<mfurr>
hello
<JPL-Justin_>
What's up?
<mfurr>
not much, you?
<JPL-Justin_>
So I'm working on a little ocaml project here... hopefully I'll have something worth demonstrating to the community soon :)
<JPL-Justin_>
It's something done when I'm not on the job, it's a nice escape from Java.
<mfurr>
I bet :)
<mfurr>
what's the project?
<JPL-Justin_>
yeah
<JPL-Justin_>
well
<JPL-Justin_>
basicaly it's a dataflow scripting language
<JPL-Justin_>
it's an ML clone, interpreted
<JPL-Justin_>
it's designed to speed up pipeline data analysis etc
<mfurr>
sounds neat
<JPL-Justin_>
it's purely functional but may use monads to achieve side effects if necessary
<JPL-Justin_>
well the idea came from my job at NASA Jet Proplusion Lab
<JPL-Justin_>
We process a ton of imagery and telemetry data... and the process is heavily parallel.
<JPL-Justin_>
I'm working on something that's inherently parallel, and utilizes iterative simplification as an execution paradigm... it's totally nonlinear and allows for lowest possible latency.
<JPL-Justin_>
It's going to be coupled with an external batch scheduler (of which there are many available, no sense trying to make one myself)
<mfurr>
good luck :)
<mfurr>
every done any declarative programming?
<JPL-Justin_>
no I'm thinking about it
<mfurr>
I'm just reading about it now, sounds pretty interesting
<JPL-Justin_>
I've had some reason to believe it was kinda cool however... I'm not sure how useful it is for the kinds of problems I solve
<JPL-Justin_>
I am going to go into computational physics most likely, and it seems to be rather orthogonal to number crunching etc
<JPL-Justin_>
it does seem dcool
<JPL-Justin_>
I'm interested in dataflow based systems at the moment
<JPL-Justin_>
but you know how that changes
<mfurr>
yup. I came across FranTk which is a declarative gui library for haskell and have been mucking with it for a couple of hours now
<JPL-Justin_>
I'm trying to figure out this with type = business once and for all
<JPL-Justin_>
hmmm
<JPL-Justin_>
I've never really done haskell
<JPL-Justin_>
But the language seems simple enough to learn
<mfurr>
neither have I, which makes it interesting
<JPL-Justin_>
Just not enough hours in the day
<mfurr>
type = business?
<JPL-Justin_>
declarative guis... my friend Dan Maas is thinking about making one of those
<JPL-Justin_>
"with type ="
<JPL-Justin_>
it's used to unify types accross signatures etc
<JPL-Justin_>
structures
<JPL-Justin_>
I was never really a big fan of modules but I'm using them now anc
<JPL-Justin_>
two years ago I had a nasty problem with this that I never figured out
<mfurr>
oh right, isn't that basically shorthand for a certain kind of functor def?
* mfurr
tries to remember
<JPL-Justin_>
it's just saying two types are equal
<JPL-Justin_>
What are YOU working on?
<JPL-Justin_>
Just those crazy declarative languages?
<JPL-Justin_>
(I tried hard to get Mercury to run on my OS X box but... no dice)
<mfurr>
well, I spend some time volunteering with Debian linux, so I've been working on packagin some stuff for debian lately
<mfurr>
I use ocaml for lots of little projects that are usually 1-shot deals
<JPL-Justin_>
funny
<JPL-Justin_>
I use things like perl for one-shot stuff
<JPL-Justin_>
ocaml for serious long projects
<JPL-Justin_>
or for just doing cool CS problems
<JPL-Justin_>
cool
<mfurr>
well, if its really short and text heavy, perl is definately the way to go imho
<mfurr>
I'm also working on a static analysis tool for ocaml
<mfurr>
its supposed to check for bugs when you use the external interface to C
<JPL-Justin_>
I"m trying to learn python instead
<mfurr>
it actually works really well right now, but I'm working to improve it from a theoretical stand point to try and get a little bit closer to soundness(though I don't think I'll get it completely)
<JPL-Justin_>
because I'm about ready to kill perl
<mfurr>
lol, yeah I've wanted to want to learn python
<JPL-Justin_>
mfurr: do you have a web page with this stuff?
<mfurr>
not yet, it still changes way too often for me to release anything
<mfurr>
for instance, on sunday and I comletely ripped one section apart
<JPL-Justin_>
mfurr: do you have anything to demonstrate or just play around with, useless even as is?
<mfurr>
not at the moment, its really in pieces right now... but if you want to drop me an email, I'll let you know when I do
<mfurr>
I should definately have something more together by the summer
<mfurr>
since I'd like to get a paper out of it
<JPL-Justin_>
sure
<JPL-Justin_>
great
<JPL-Justin_>
I'm thinking about making my dataflow scripting language my masters project
<mfurr>
my addr is furr {at} cs.umd.edu
* mfurr
looks around for spam bots
<mfurr>
where are you in school?
<JPL-Justin_>
well
<JPL-Justin_>
I have a semester left before I have a bachelors in Applied Physics from Cornell University
<JPL-Justin_>
I took this semester off to work on the Mars Exploration Rovers mission on the operations staff.
<JPL-Justin_>
I've been working on it since I was a freshman.
<mfurr>
wow, cool
<JPL-Justin_>
yeah
<mfurr>
are you thinking of staying at cornell for your masters or applyin elsewhere?
<JPL-Justin_>
masters of engineering in CS there
<JPL-Justin_>
and then possibly working at JPL for a few years before I get my PhD somewhere
<JPL-Justin_>
I might just be a JPLer for the rest of my life
<JPL-Justin_>
it's looking better every day
<JPL-Justin_>
I don't think I could deal with corporate stupidity
<JPL-Justin_>
or the interesting ethics in a lot of companies
<mfurr>
well, it sounds like you're enjoying it there
<JPL-Justin_>
oh yeah
<JPL-Justin_>
however I am getting a little tired of homework
<JPL-Justin_>
well none this semester but... sometimes it's just too much stuff
<JPL-Justin_>
OCaml has gotten me interested in category theory
<JPL-Justin_>
I have a category theory book and made it through some basics but once it gets to the heavily structural stuff... I'm left to wonder what any of it means
<JPL-Justin_>
combine that with the fact that I can't do mathematical proofs :(
<JPL-Justin_>
well, not anything complex
<JPL-Justin_>
I can do somewhat obvious inductive proofs of course
<JPL-Justin_>
just not anyhthing involving crazy set theory stuff etc
<mfurr>
I'm not familiar with category theory, can you give a brief explanation?
<JPL-Justin_>
ha!
<JPL-Justin_>
let me see
<JPL-Justin_>
Basically it's a non-set theoretic theory of functions
<JPL-Justin_>
its' very cool
<JPL-Justin_>
it's purer than set-theoretic theories of functions in the sense that
<JPL-Justin_>
it's not element-centric, it's structure-centric
<JPL-Justin_>
it's got all sorts of crazy dualisms, and set theory is a subset of category theory (I believe)
<JPL-Justin_>
it's incredibly useful for a ton of different fields
<JPL-Justin_>
OCAML is based on ideas from it
<JPL-Justin_>
that's why the C is "Catagorical"
<JPL-Justin_>
:-D
<JPL-Justin_>
And I can see from category theory why strongly typed functional languages are so elegant
<JPL-Justin_>
you can do all kinds of catagorically derived transofmrations on them without altering runtime behavior!
<mfurr>
are you familiar at all with the lambda calculus?
<JPL-Justin_>
of course :)
<JPL-Justin_>
I took a course on that stuff two years ago... remember a lot of it.
<JPL-Justin_>
I'm not, how should I say, an expert with it... I remember combinators etc vaguely..
<JPL-Justin_>
and the universaility of S&K...
<mfurr>
then would you say that the l-c is an instance of category theory?
<JPL-Justin_>
well it's true that
<JPL-Justin_>
typed lamda calculus is actually isomorphic to a closed cartesian category
<JPL-Justin_>
IIRC.
<JPL-Justin_>
I need to dig up that book this weekend and kick some ass doing some of the problems
<JPL-Justin_>
I'm planning on learning a lot of it by the end of the summer so I can be 1337 :)
<mfurr>
thanks for the links, I'll have to take a better look at them at an earlier hour of the day
<JPL-Justin_>
sure
<JPL-Justin_>
sounds like a plan
<JPL-Justin_>
to me
<JPL-Justin_>
the second link is a good month's read :-D
<JPL-Justin_>
so where are you in school?
<JPL-Justin_>
have a PhD yet?
<mfurr>
I'm in my first year of a masters/phd program at maryland
<JPL-Justin_>
great great
<JPL-Justin_>
I thought I recognized that domain
<JPL-Justin_>
One of my friend's friends goes there
<JPL-Justin_>
probably CS I don't know
<JPL-Justin_>
he's one of those hacker wannabe guys... hopefully he'll grow out of it
<mfurr>
actually, one of my professors just came from cornell where he was a post-doc
<JPL-Justin_>
what's his name?
<mfurr>
Mike Hicks
<JPL-Justin_>
not that I'd know him or anything
<JPL-Justin_>
no
<JPL-Justin_>
don't know him
<mfurr>
wouldn't think so
<JPL-Justin_>
yeah
<JPL-Justin_>
hmm I think i'm going to call it quits on my interpreter tonight... I have to make a structural decision which looks like it's going to suck
<JPL-Justin_>
well maybe I'll spend a few minutes on wrapping the standard library or something
<mfurr>
:)
<JPL-Justin_>
mfurr: is modifying the ocaml compiler difficult?
<mfurr>
I've never mucked with the insides... using camlp4 to alter the grammar isn't too bad
<JPL-Justin_>
no
<JPL-Justin_>
I don't want to change the grammar much
<JPL-Justin_>
I want to change the evaluation semantics. That might just be a complete rewrite.
<JPL-Justin_>
I'll probably just stick to interpreting things intead of thinking about compilation
<mfurr>
yeah, that's probably a bit of work
smklsmkl has joined #ocaml
<JPL-Justin_>
hmmm
<JPL-Justin_>
I'm going to think hard about whether or not I can do this simply by restricting the grammar and
<JPL-Justin_>
some sort of... maybe exceptions?
<JPL-Justin_>
the problem is that... exceptions won't do everything I want
m[kel[ has quit [Read error: 110 (Connection timed out)]
<JPL-Justin_>
hmmmmm
<JPL-Justin_>
wow I have a great idea
<JPL-Justin_>
I can do this with compiled ocaml code
<JPL-Justin_>
and some syntactic sugarl
<JPL-Justin_>
wow
<mfurr>
great!
<JPL-Justin_>
well
<JPL-Justin_>
I don't know how much I'm giving up by doing that though
<JPL-Justin_>
hmm... I'll have to give this some thought.
<JPL-Justin_>
If so, I don't have to deal with making the interpreter awesome.
<JPL-Justin_>
hmm no... I think this would not work
<JPL-Justin_>
maybe there's something else I coudl do, but it'd be hideously inefficient
<pattern>
hey, jpl-justin
<JPL-Justin_>
hey pattern
<JPL-Justin_>
what's up?
<pattern>
good to see a member of the jpl here
<JPL-Justin_>
yeah
<JPL-Justin_>
:)
<gl>
what does jpl mean ?
<JPL-Justin_>
I'm an intern but... this is my 4th year so
<JPL-Justin_>
Jet Propulsion Lab
<pattern>
the mars rover guys
<gl>
ok
<JPL-Justin_>
yeah
<JPL-Justin_>
I'm on that
<pattern>
so the next version of the rover software's going to be written in ocaml, right? :)
Vekza has joined #ocaml
<mfurr>
well, I'm outta here. Good luck on your interpreter justin
mfurr has quit ["zzZZzz"]
<pattern>
there're a bunch of category theory tutorials on lambda the ultimate
bk_ has quit ["I'll be back"]
Vekza has quit ["Leaving"]
Vekza has joined #ocaml
Vekza has quit ["Leaving"]
bk_ has joined #ocaml
phj has joined #ocaml
m[kel[ has joined #ocaml
bk_ has quit ["I'll be back"]
bk_ has joined #ocaml
smklsmkl has quit [Read error: 110 (Connection timed out)]
Shadoko has joined #ocaml
Riastrad1 has joined #ocaml
Riastradh has quit [Read error: 60 (Operation timed out)]
SpookRijder has joined #ocaml
noss has joined #ocaml
mattam_ has joined #ocaml
Alain_ has joined #ocaml
Alain__ has joined #ocaml
Alain_ has left #ocaml []
mattam has quit [Read error: 110 (Connection timed out)]
mattam_ is now known as mattam
cjohnson has joined #ocaml
smklsmkl has joined #ocaml
m[kel[ has quit [Read error: 110 (Connection timed out)]
kinners has joined #ocaml
phj has quit [Read error: 110 (Connection timed out)]
__DL__ has joined #ocaml
bk_ has quit ["I'll be back"]
bk_ has joined #ocaml
kinners has quit ["leaving"]
__DL__ has quit ["Bye Bye"]
The-Fixer has joined #ocaml
andrewb has quit [Read error: 104 (Connection reset by peer)]
andrewb has joined #ocaml
slashvar has joined #ocaml
slashvar is now known as slashvar[lri]
phj has joined #ocaml
SpookRijder has quit ["Client Exiting"]
m[kel[ has joined #ocaml
smklsmkl has quit [Read error: 110 (Connection timed out)]
vegai has quit ["Terminated with extreme prejudice - dircproxy 1.1.0"]
bk_ has quit ["I'll be back"]
smklsmkl has joined #ocaml
m[kel[ has quit [Read error: 110 (Connection timed out)]
slashvar[lri] is now known as slashvar[proof]
phj has quit [Read error: 104 (Connection reset by peer)]
LordBrain has joined #ocaml
wazze has joined #ocaml
miach has joined #ocaml
<Dybbuk>
So...what's up with the IRC spam stuff?
<Dybbuk>
That sucks.
<Smerdyakov>
Hm?
<Maddas>
Didn't get anything today.
Tachyon76 has joined #ocaml
Tachyon76 has quit ["Leaving"]
mfurr has joined #ocaml
m[kel[ has joined #ocaml
smklsmkl has quit [Read error: 110 (Connection timed out)]
<JPL-Justin_>
hello
<Maddas>
Hello
<JPL-Justin_>
Hey
<JPL-Justin_>
what's up?
<Maddas>
"A preposition," but you probably already know that ;-)
<Maddas>
(Nothing interesting going on here, usually)
<JPL-Justin_>
Oh gosh.
<Maddas>
heh
<JPL-Justin_>
Back in junior high...
<Maddas>
What about you? :-)
<JPL-Justin_>
I though tthat was a silly question
<JPL-Justin_>
I'ds ay "up is the direction directly opposite that of the gravitational pull of the earth, relative to your position on the earth."
<JPL-Justin_>
No wonder no one liked me :)
<Maddas>
haha
<JPL-Justin_>
So what do YOU use ocaml for?
<Maddas>
I stick to "The sky" and "A preposition"
<Maddas>
Nothing, really
* Dybbuk
uses OCaml for everything he can. :)
<Maddas>
Dybbuk: Well, I do use O'Caml for everything I can, which is nothing!
<Maddas>
Since I hardly code anything at all nowadays ;-)
<JPL-Justin_>
Dybbuk: anything specific?
<Maddas>
(I should start coding something interesting, I guess)
<Dybbuk>
JPL-Justin_: Right now I'm writing some math libraries to handle a protocol I'll be implementing.
<Dybbuk>
and...I'm getting paid for it. :)
<Maddas>
Heh, that's nice.
<JPL-Justin_>
Dybbuk: wow, but that means you cannot show us, right?
<JPL-Justin_>
Dybbuk: any chance you will tell us about hte protocol? It could be interesting.
<Dybbuk>
JPL-Justin_: It's a gossip protocol for maintaining identical databases on multiple hosts.
<JPL-Justin_>
Oh okay
<JPL-Justin_>
I've worked with those!
<JPL-Justin_>
In fact...
<JPL-Justin_>
That's what I did summer 2002 at my NASA job
<Maddas>
:-)
<JPL-Justin_>
It's a powerful paradigm because it allows all kinds of decentralization, and the server doesn't have to keep client state at all
<Dybbuk>
Yup, I really like it.
<Dybbuk>
We're using a really simple protocol, I think...I am actually doing something a bit beefier with database reconciliation...it is hairy.
* Dybbuk
has found out that he shouldn't have skipped so many math classes in school.
<JPL-Justin_>
Dybbuk: syncrhonization is never an easy task... that's waht I'm doing, I'm synchronizing, oh, several terrabytes of data from the mars mission accross the planet
<JPL-Justin_>
in near real-time
<Dybbuk>
But OCaml is perfect for it. It lets me struggle with the math and not worry so much about the code.
<Dybbuk>
Ah, we just have about 2-300MB of data to synchronize. :)
<Dybbuk>
But it changes frequently.
<JPL-Justin_>
Dybbuk: yeah that's what I like about OCaml. I'm kinda wishing there was something that would allow you to put OCaml code inline with C to easily do a few crazy things.
smklsmkl has joined #ocaml
<Dybbuk>
JPL-Justin_: Hmmm...I tend to take the opposite approach. I write everything in OCaml, and when speed is crucial I just write /that/ part in C.
<JPL-Justin_>
Dybbuk: yes tha tmakes sense for a lot of things, however when maintaining legacy code, or whatnot
m[kel[ has quit [Connection timed out]
<Dybbuk>
JPL-Justin_: Oh yeah...well, our legacy code here is all in COBOL. :)
* Dybbuk
never touches it.
* Maddas
snickers
<JPL-Justin_>
Dybbuk: also sometimes it's just plain easier to do things in C than in OCaml
<JPL-Justin_>
To be honest, I absolutely hate OCaml's syntax for imperative stuff
<Dybbuk>
JPL-Justin_: Me too.
<JPL-Justin_>
I *LOVE* the functional syntax...
<Dybbuk>
Actually, 'for' loops don't look that bad.
<JPL-Justin_>
I'd *KILL* to have pattern matching in C
<JPL-Justin_>
yeah the for loops aren't bad compared to, say, mathematica code!
<Dybbuk>
I thought I'd seen something that did pattern matching in a very C-like language. Maybe it was Pike?
<Dybbuk>
Or C#?
* Dybbuk
has been writing a lot of imperative code in OCaml on this project.
<JPL-Justin_>
hmm
<JPL-Justin_>
I'll look
<Dybbuk>
Modifying arrays in-place and such.
<mfurr>
Dybbuk: cyclone?
<JPL-Justin_>
So I'm still trying to figure out some crazy stuff with OCaml modules so I can get on with my interpreter
<Dybbuk>
mfurr: That's it!!
<JPL-Justin_>
oh wow
<JPL-Justin_>
one of my professors worked on that
<Dybbuk>
Cyclone does look really neat.
<JPL-Justin_>
yeah I'll have to look at Cyclone C
<drWorm>
yes, i was just thinking -- pattern matching isn't inherently functional, why don't more languages have that :)
<JPL-Justin_>
if it's easy to integrate with non-cyclone C, I think i'll have to start using it
<Maddas>
And what did my professors work on? Oberon, great :-)
<JPL-Justin_>
drWorm: cause they suck ;)
<Dybbuk>
JPL-Justin_: What kind of interpreter?
<drWorm>
they do
<JPL-Justin_>
oberon... wtf do people use that for anyways?
* Maddas
shrugs helplessly
<Maddas>
torturing students :-)
<Maddas>
(Luckily I'm not one of those students)
<JPL-Justin_>
Dude you can do that fine with a combinatin of LISP and X86 machine language
<Dybbuk>
Or lisp that compiles to x86.
<Maddas>
haha
<Maddas>
Lisp that compiles to x86?
<JPL-Justin_>
How about a dialect of LISP that uses HTML comment markers instead of parenthesies
<JPL-Justin_>
I think I'd basically shoot someone if they made me use that
<Maddas>
JPL-Justin_: Too easy to evade, just don't write any comments :-)
<Maddas>
oops, never mind, I misread.
<JPL-Justin_>
hahaha I understand man
<Maddas>
JPL-Justin_: Actually, XML could be cool!
<Maddas>
(Yes, lots of crappily named, useless tags!)
<Maddas>
And force students to use an editor that is not powerful enough to automate creating those tags (and has no copy/paste, of course) :-)
<Dybbuk>
Heck, force them to use edlin.
<Maddas>
(Yay, I scared everybody away again)
<Dybbuk>
on an 8088.
<Maddas>
haha
<JPL-Justin_>
uhhh
<JPL-Justin_>
dude
<JPL-Justin_>
unless your putting your program in via toggle switches and punchcards
<JPL-Justin_>
it's too easy
<drWorm>
bring back the PDPs :)
<Maddas>
haha
<JPL-Justin_>
you know I still use fortran 77?
<Maddas>
Numerical computing?
<Maddas>
Or just for fun :P
* Dybbuk
has a great f77 book.
<Dybbuk>
But I've never opened it.
<Dybbuk>
I just know it's great because it's old and the pages are yellowing.
<Maddas>
haha
<Dybbuk>
Heheh. :)
<JPL-Justin_>
Maddas: parallelizing magnetohydrodynamics simulations for astrophysics research
<Maddas>
JPL-Justin_: Oh, *that*
<Maddas>
;-)
<Dybbuk>
JPL-Justin_: Magnetohydrodynamics?
<drWorm>
jpl as in nasa? :)
<JPL-Justin_>
Yes.
<JPL-Justin_>
But that work is for Cornell University.
<Dybbuk>
One of these days, JPL-Justin_! To the moon!
<drWorm>
bang, boom! :)
<Maddas>
"It's not a bird! It's not a plane! It's... Justin!"
<Dybbuk>
Now you've switched TV shows on us. :)
<Maddas>
I think I'm just not good at placing quotes correctly.
<JPL-Justin_>
Oh gosh
<JPL-Justin_>
I look away for one moment and THIS happens
<Dybbuk>
Your F77 upgraded itself to F95?
<JPL-Justin_>
hahaha
<JPL-Justin_>
I wish!
<JPL-Justin_>
I didn't write the original code
<JPL-Justin_>
russian astrophysicists did
<JPL-Justin_>
damn
<Maddas>
Oh, them Russians.
<JPL-Justin_>
hey have any of you guys tried out NASA's Maestro software?
<Maddas>
Yes, but only for a few seconds :-)
<Dybbuk>
Hmmm...sounds familiar.
<Dybbuk>
JPL-Justin_: What is it?
<JPL-Justin_>
It's a public outreach program, it's basically a slightly converted version of a mission tool that's used on the mars exploration rovers
<drWorm>
the java app? i tried it
<JPL-Justin_>
it guides you through data you download and allows you to explore it yourself, and play with the simulation capabilities of the software, the same stuff the scientists used to test it
<JPL-Justin_>
yes
<JPL-Justin_>
I happen to be one of the developers
<drWorm>
cool
<JPL-Justin_>
but of course I spent more of my time on the scientist version
Riastrad1 is now known as Riastradh
smklsmkl has quit [Read error: 110 (Connection timed out)]
m[kel[ has joined #ocaml
<Dybbuk>
I love ocamldoc.
JPL-Justin_ is now known as JPL-Justin
<JPL-Justin>
I love your mother
<JPL-Justin>
wait did I just say tha tout loud
<JPL-Justin>
I'll use ocamldoc sometime here... for now just normal comments
<Dybbuk>
It's virtually normal comments. :)
<JPL-Justin>
yeah
mfurr has quit ["Leaving"]
gl has left #ocaml []
gl has joined #ocaml
malte has joined #ocaml
m[kel[ is now known as smkl
smkl has quit [Read error: 110 (Connection timed out)]
smkl has joined #ocaml
LittleDan has joined #ocaml
<LittleDan>
Are there any datastructures in ocaml whose size can be changed at runtime, or do you need to make new datastructures every time the size needs to be changed?
<Smerdyakov>
What is the "size" of a data structure?
<Smerdyakov>
And what would it mean to change it?
<LittleDan>
I'm making a table of strings to integers to store variables in a simple programming language I'm making. Sometimes, new variables will be made. Other times, variables will be deleted
<Banana>
LittleDan: use a list ?
<Banana>
(but this is not efficient).
<LittleDan>
but the I need to make a new list each time variables are chaged
<LittleDan>
I was wondering if I could avoid that
<Smerdyakov>
Why do you want to avoid that?
<LittleDan>
for efficiency
<Banana>
LittleDan: you also have the Hashtbl module.
<Smerdyakov>
You can't get much faster than adding an item to a list.
<Banana>
and the Map module.
<Shadoko>
there are more complex data structures
<Smerdyakov>
LittleDan, do you understand that :: takes constant time?
<Shadoko>
hum well Banana said it already :)
<Banana>
hello, by the way.
<LittleDan>
I know that :: takes constant time, but if I have to keep making new lists, it adds up
<Smerdyakov>
It adds up to the _same_ time it would take to do updates in place....
<LittleDan>
really?
<Smerdyakov>
It's not possible to do better than constant time.
<LittleDan>
Don't you have new memory allocated?
<LittleDan>
but it takes linear time to traverse a list
<Smerdyakov>
So?
<LittleDan>
Do you have to allocate new memory each time?
<Smerdyakov>
Yes.
<LittleDan>
Does OCaml perform deforestation?
<Smerdyakov>
I'm not sure what you mean by that.
<LittleDan>
if you had a mutable datastructure, you wouldn't have to allocate new memory each time
<Smerdyakov>
So? You are assuming that allocating memory is bad.
<mattam>
you allocate only the cons cell LittleDan
<LittleDan>
it makes things less efficient than if you were using the same memory, doesn't it?
<Smerdyakov>
There is no significant difference.
<Smerdyakov>
Asymptotic time is the same.
<LittleDan>
What's asymptotic time?
<Smerdyakov>
O(), Omega(), etc.
<LittleDan>
I know that the complexity is the same, but the real-world performance might be different because of the overhead of allocating memory, isn't it?
<Banana>
LittleDan: i don't think so.
<Smerdyakov>
The cost of allocating memory is the cost of incrementing one pointer.
<LittleDan>
but don't you also have to copy data?
<Smerdyakov>
No.
<Banana>
no.
<Banana>
it's the oposite i would say.
<LittleDan>
oh
<Banana>
with functionnal data structures you have data sharing.
<Smerdyakov>
You copy during garbage collection.
<Banana>
that you don't have with mutables one.
<Banana>
eg : if you have a list l1 = [1;2;3;4;5] and you do l2 = 0::l1 you only have one copy of [1;2;3;4;5] in memory, yet you have 2 lists.
<LittleDan>
So if I just passed around lists and made new ones every time a variable was set, it would be no less efficient than if I used a mutable datastructure?
<Banana>
you can't do that with arrays without copying.
<Smerdyakov>
LittleDan, it depends on what operations you want on the lists. If the only operation is iterating through every element of the list or array in order, then you will not find a significant difference, except that you use less memory with lists!
<Banana>
LittleDan: it depends on the way you write that. if you keep doing lists traversal and random acces then you will lose the benefit of lists.
<Smerdyakov>
(Less memory if you want access to all intermediate results, that is)
<Banana>
LittleDan: you are writing a compiler or an interpreter for a language, aren't you ?
<LittleDan>
interpreter going directly from the AST, no bytecode
<Alain__>
why don't you use hashtables ?
<Banana>
yes you can use either Hashtbl or Map.
<LittleDan>
I was just wondering about the fixed vs. variable size of datastructures in general
<Banana>
well it depends on what you use them for...
<Smerdyakov>
LittleDan, you still have yet to describe what the "size of a datastructure" is, and what it means for it to be "variable."
<LittleDan>
You have to make a new Hashtbl or Array if you want to append something
<Banana>
LittleDan: God no.
<Banana>
:)
<LittleDan>
you don't?
<Banana>
not with Hashtbl.
<Banana>
they grow as you insert elements.
<Banana>
(with Array yes, you have to reallocate a new array).
<LittleDan>
oh, then this is all because I can't read the docs :) Sorry
<LittleDan>
I must have been looking at Map
<Banana>
hum...
<Banana>
map also grows when you add an element...
<LittleDan>
I guess then I just can't read
<Banana>
maps are balanced binary trees.
<LittleDan>
So would it be inefficient if you had to make a new hashtable if you had to make a new one every time you needed to add an element?
<Smerdyakov>
That would be horribly inefficient, yes.
<Banana>
but you don't have to.
<LittleDan>
So I was almost right
LittleDan has left #ocaml []
Shadoko has quit ["++`+"]
Alain__ has left #ocaml []
smklsmkl has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]