dark_light changed the topic of #ocaml to: OCaml 3.09.2 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
<dan2> Ballin_105: read the documentation
<Ballin_105> dan2: yes im trying grrrrrrrr
<Ballin_105> i cant seem to figure this out hmmmmmm
mak1 has joined #ocaml
<Ballin_105> if anyone could help that would be great ........i have trtied like everythign
_fab has quit [Remote closed the connection]
<jeremy_c> Ballin_105: that's not an answer, but it's a simple logging library and the code is easy to read. In the logger.ml, he creates a function called printf that uses the syntax your talking about.
<dan2> dibblego: I've got something to show ya
<dan2> dibblego: recursive data structures! the sweet spot of ocaml
<dibblego> I am not familiar with ocaml
<dibblego> is ocaml lazily evaluated?
<dan2> no
<dan2> strict
<dan2> very strict
mak1 has quit ["Download Gaim: http://gaim.sourceforge.net/"]
<dan2> dibblego: this sucker worked the first time it compiled properly
<dibblego> you don't see lazy evaluation as a solution to infinitely recursive data structures?
<dan2> not really
<dan2> lazy evaluation is just plain irritating
<dan2> as a programmer, I want the program to do what I want when I tell it, not when it wants to
<dibblego> not if it is pure FP you don't, since you don't care
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC has never been so good"]
<dan2> while that's true, it's fair enough to say that I want my program to execute when I run ./fobar...
<dan2> dibblego: does that make sense?
dbueno_ has joined #ocaml
<dan2> dibblego: second, laziness doesn't allow for proper appropriation of time
<dibblego> possibly, but I don't see myself as even half-educated on the pros and cons of lazy evaluation, so there is a lot of ?
<dan2> dibblego: I don't believe you need a lazy eval for operation of infinitely recursive data structures
<dibblego> probably not, but is there a way that is better?
<dibblego> I really don't see how there can be since I see no problems with laziness
<dan2> dibblego: laziness probably will always be rejected by the programming community for a simple reason
<Mr_Awesome> thats one reason why i prefer ocaml over haskell
<dan2> dibblego: which is more useful? A person who preemptively schedules his time into the future, or someone who does something when someone else puts the squeeze on them
<dibblego> either I don't understand the problem that others see, or others don't understand laziness - I'll remain neutral until I can make a more informed decision
<Mr_Awesome> but the main reason is that haskell forces the use of meaningful whitespace, which i absolutely despise
<dan2> Mr_Awesome: heh
<dibblego> dan2, I honestly don't see how that holds
<dibblego> as a plausible metaphor that is
<dan2> they're exactly the same
<dibblego> is ocaml pure FP?
<Mr_Awesome> no
<dan2> not totally, no
<dibblego> then I think that might be a problem in this discussion
<Mr_Awesome> it can be totally imperative if you like, but the syntax is FP-oriented
<dan2> dibblego: the problem is pure FP isn't exactly practical
<Mr_Awesome> FP means functional programming, right?
<dan2> Mr_Awesome: yes
<dibblego> dan2, I disagree - it is entirely practical - it is the outside world that is impractical
<dibblego> dan2, in fact, it is exactly reflective of reality
<Mr_Awesome> chalk that up as another reason why i dont like haskell
<dibblego> the world is immutable given mutable time as the frame of reference
<dan2> dibblego: you have to remember that the hardware you are running FP on is instruction based
<Mr_Awesome> but the very definition of mutable is able to change over a period of time
<dibblego> certainly, I am neutral on most these issues because I don't feel qualified to refute what you are saying, but definitely pure FP has a meaning in software
<dan2> oh sure it does
<dan2> Ocaml using only functional constructs can be pretty damn close to purely functional
<Mr_Awesome> pure FP is very useful, but you need to be able to go impure in certain situations realistically
<dibblego> Mr_Awesome, yes, in fact you can enumerate those situations
<dibblego> a revision control system is just passing the file system as an argument to a pure function
<dibblego> FileSystem commit(FileSystem, FileSystemDelta)
<Mr_Awesome> but how do you define input/output as a pure function?
<dibblego> why not do the same for relational databases?
<dibblego> that *is* input/output as a pure function
<dibblego> the problem is something like network protocols
<dan2> dibblego: because memory isn't that cheap
<dibblego> dan2, then should we not keep history in our RCS?
<dan2> if memory -> $0, we'd all be doing it
<dan2> dibblego: no, RCS is a filesystem on top of a filesystem
<Mr_Awesome> a function like "get_input" that takes no arg and yet returns any number of possible values, how can that be functional?
<dibblego> well, we'd all be doing it more, but not to the extreme - you cannot after all pass the universe as a function argument
<dan2> as far as creating an rdbms in memory that's immutable will just plainly use up too much memory
<dibblego> dan2, not necessarily - just that most of them are because of the deficiencies of existing file systems - the latest Mac and Windows has it built-in
<dan2> Mr_Awesome: it can't because arbitrariness != functional
<Mr_Awesome> exactly
<dibblego> it will use up disk space perhaps
<dibblego> just like a RCS does
<dan2> dibblego: just remember that after all, we're programming to fill human needs, not the universe's
<Mr_Awesome> dibblego: the universe passes itself to the time function recursively every instant ;)
<dibblego> Mr_Awesome, i don't propose that as a function - there is actually a problem with it since it is not a function - in that it does not reflect reality - of course, reflecting reality is not always feasible since software is not tangible and the universe it
<dibblego> *is
<dibblego> idealistically, everything is a function; practically, we must back off somewhere
<Mr_Awesome> pure fp is essentially deterministic, no?
<dibblego> yes
<dan2> could you define deterministic?
<dibblego> given some input i a function f from inception to collapse of space/time returns output o by proof
<Mr_Awesome> given the same input it will always produce the same output
<dibblego> o f(i)
<Mr_Awesome> i like my definition better :P
<dibblego> your IRC client is immutable - the only thing that makes it "appear to change" is time - I challenge you to observe "change" without a linear time frame of reference
<Mr_Awesome> well, if you consider the program as a whole as a pure function, the input is like an argument
<dan2> dibblego: ok, so explain how intraprocess communication is functional
<dibblego> I actually read once that there is some kind of religious or philosophical following behind that
<Mr_Awesome> well change cant happen without time, thats rather obvious
<dibblego> dan2, better, explain how it is not - if you think it is not, it is likely, you've forgotten one of the function arguments
<dan2> dibblego: the answer is simple, it can't be
<dibblego> I contest that assertion - it can be
<dibblego> there are people who believe this entire world is immutable
<dibblego> they have a valid point
<dibblego> that making a decision creates a whole new world
<dibblego> it seems wacky and abstract and all that
<dan2> dibblego: communication is by definition a want
<dibblego> I don't understand what you mean
<dibblego> I don't think anyway
<dan2> wants are as far away from defined or deterministic as possible
<dan2> wants are individualism
<dibblego> can an external observer observe this world "change" if they have no time?
<dibblego> including everything it encapsulates - "wants" to use that erm
<dibblego> *term
<dan2> time is the ultimate and utter reference point
<Mr_Awesome> dan2: arguably, a want can be determined based on the current state of the wanting entity
<dan2> dibblego: but what does 1 second in outer space mean?
<dan2> dibblego: how do you calculate time in outer space?
<dibblego> back to the original point, it is clear that I have a strong tendency toward pure FP and you have the opposite, which is likely the reason that we also have differing views on laziness
<Mr_Awesome> but if the universe is inherently random, then thats not possible
<dibblego> you need a frame of reference
<dan2> Mr_Awesome: the universe is cyclical
<dan2> it repeats itself
<Mr_Awesome> dan2: not quite sure what you mean by that
<dan2> events repeat themselves
<dibblego> it is exactly the reason I fight against the speed law enforcement in our country, and had a court appearance a few weeks ago for holding a sign that reads "Police Speed Trap Ahead" :)
<dan2> dibblego: can they fine you for that?
<dibblego> a speed limit with a frame of reference that is the road ignores too many other factors resulting in increased danger for those who consider it
<dibblego> dan2, I entered a plea of not guilty and they chickened out
<dan2> heh
<dibblego> others have pled guilty straight up
<dibblego> they tried to milk information from me, then realised I'd been busy mounting a solid defence
<dibblego> then chickened out the day before the hearing
<dan2> dibblego: is it possible to visualize something and be dumb deaf and blind your entire life?
<dibblego> dan2, yes, using spatial ability
<dan2> dibblego: just remember that programming is to satisfy human wants and need
<dan2> dibblego: humans have the natural desire to control (imperative0
<dibblego> yes, the human being the client - not the developer
<dibblego> if you give to the developer and take from the client, then this is not satisfactory
<dibblego> let's call that OO
<dibblego> if you give to the developer and give to the client, then so be it
<Mr_Awesome> dibblego: what ignored factors cause increased danger?
<dibblego> if you neither give nor take from the developer, and give to the client, then so be it too
<dibblego> Mr_Awesome, when I ride my motorcycle down a street, I am very much aware of my speed relative to the road, but also other frames of reference
<Mr_Awesome> like what, other cars?
<dibblego> sure, that's one thing - they are less predictable
<dibblego> even at an extreme, the leaves of a tree
<Mr_Awesome> i mean, are you saying that speed limits are bad?
<dibblego> no
<Mr_Awesome> what are the dangers that you mentioned?
<dibblego> selective law enforcement is bad
<dbueno_> dibblego: Amen.
<Mr_Awesome> oh ok
<dibblego> I have a friend who just left hospital - she was doing 0kph - if she was doing 59kph, she would be fine
<dan2> and so are useless congress men
<Mr_Awesome> well yeah
<dibblego> there is a propaganda machine that makes speed and safety seem directly proportional
<dibblego> but this is not true
<dibblego> it is not even "almost always true"
<Mr_Awesome> my friend almost got himself killed when he ran into a culver going 115 mph
<dan2> how fast is 59 kph?
<dibblego> and especially for light vehicles, it is very rarely true
<dibblego> about 32mph (off the top of my head)
<dan2> that's slow
<dibblego> Mr_Awesome, you mean he decelerated relative to a frame of reference over time from 115mph to 0
<dibblego> that he was doing 115mph relative to the road is irrelevant
<dibblego> we on earth are going much faster around the sun for example
cmeme has quit [Remote closed the connection]
<dan2> dibblego: what do you think of Ayn Rand?
<Mr_Awesome> how is that irrelevant? if he were going slower the impulse would have been far less?
<dibblego> dan2, never heard of him/her
<Mr_Awesome> scratch that last question mark
<dan2> hmm
<dibblego> Mr_Awesome, what is relevant is the speed relative to the frame of reference and the ability to calculate risk mitigation given this
cmeme has joined #ocaml
<dibblego> Mr_Awesome, when I overtake large vehicles (such as 50 ton trucks), I often go quite fast - this is a risk mitigation tactic
<Mr_Awesome> how so?
<dibblego> I do not use the speed relative to the road as the only factor to calculate a risk factor
<dan2> Mr_Awesome: the large vehicles can't see him otherwise
<Mr_Awesome> oh ok
<dibblego> Mr_Awesome, that's a long conversation, but it is taught in Motorcycling 101 class
<Mr_Awesome> read that wrong, sry
<Mr_Awesome> i thought you said when driving them lol
<dibblego> there are things to calculate like, "what is the probability of this occurring and what is the magnitude of the consuquence?"
<dibblego> I don't hold a truck licence - only bus
chessguy has joined #ocaml
<dibblego> *consequence
<Mr_Awesome> but there is definitely a point where driving too fast results in much higher chance of death
<Mr_Awesome> not only to the driver but pedestrians
<dibblego> I might say "the probability of a retread breaking from the truck right now is high (since we are at high speed and the temperature is high), and the magnitude of the consequence is high (probable injury, probable death)"
<dibblego> you'll note that *even* the temperature entered as a factor to the calculation of risk
<Mr_Awesome> selective law enforcement helps enforce that
<dibblego> it is not always directly proportional
<Mr_Awesome> for the most part it is
<dan2> dibblego: btw satisfying the purely functional problem isn't necessary until you're on a purely functional designed machine
<dibblego> no it isn't - that's the trick
<dibblego> very rarely it is
<dibblego> especially for light vehicles
<dan2> dibblego: otherwise it's just emulation
<dan2> dibblego: functional programming can be used very valuably however in emulation
<Mr_Awesome> why is that? do you mean because with light vehicles after a certain speed getting in an accident gives you about the same (slim) chances of living?
<dibblego> dan2, what about minimising the non-pure parts to satisfy some "practical" needs, then allowing a reentry into pure FP?
<dan2> the defeats the purpose
<dibblego> Mr_Awesome, in general, the risk calculation changes, for example, overtaking a 50 ton truck with a 50 ton truck is very different, and I will generally not increase speed so much
<dan2> dibblego: why would you ever want to emulate a machine, you always want the real thing
<dibblego> Mr_Awesome, quite often I am tailgated by a large car which weighs 10x my motorcycle, the correction is to accelerate since that car driver has not been educated on how to calculate risk in terms of a light vehicle's stopping ability - instead they've been miseducated (they follow the speed limit therefore, they think they are safe)
<Mr_Awesome> i understand your reasoning, but a cop wont likely ticket you for speeding while passing
<dibblego> Mr_Awesome, the Us is not as bad as UK/Australia
<dibblego> *US
<Mr_Awesome> ah
<Mr_Awesome> out of curiosity, in which do you live?
<dibblego> and most police officers have very poor risk calculation skills (despite claiming to be above average) - this is a product of society
<dibblego> Australia
<dibblego> down the road from the croc. hunter :)
<Mr_Awesome> all people claim to have above average risk calculation skills
<dibblego> or his family anyway
<Mr_Awesome> oh really
<dibblego> Mr_Awesome, I know, that is a problem
<Mr_Awesome> i am at least humble enough to realize that i dont
<dibblego> that's exactly why we have a speed limit - to standardise on what the correct risk calculation is
<Mr_Awesome> in a way that is easy for simpletons to understand
<dibblego> I don't even think that those skills relative to others is relevant
<dibblego> yes, so drivers remain uneducated, people die and I am at risk as a result
<dibblego> I don't fight many things, but the risk to my life is so high, that I must fight this
<dibblego> I don't have a genuine interest in road safety in general
<Mr_Awesome> i wonder if, in driver education classes, they werent so strict to always advocate SLOWER IS BETTER, there would actually be even fewer speeders
<dibblego> if there was a gun pointing at my head, I'd do my best to make sure it doesn't fire - it is as simple as that
<Mr_Awesome> heh, basic survival instinct
<dibblego> if everyone had a gun pointing to their head, I'd wish them luck, but generally I wouldn't care - I won't pretend to
<Mr_Awesome> thats human nature
<dibblego> I find it disturbing that people can show fear of something that is highly unlikely to occur and if it does, has low magnitude of consequences, then they get in their car and drive down the street
<dibblego> for example, people are scared of snakes
<Mr_Awesome> though its also apparently human nature to hypocritically make yourself look good by feigning empathy for those in worse situtations than you
<dibblego> they rarely bite, and if they do, the consequences are minimal
<dibblego> yet they'll get in a car and drive down a street full of poorly educated drivers
<Mr_Awesome> well, people dont try to say their fears are rational
<Mr_Awesome> your will to live isnt necessarily rational, yet you cant easily fight it
<dan2> Mr_Awesome: sure you can, put a bullet through your head
<dibblego> people are not scared of crocodiles anymore since Irwin
<dibblego> but they should be, of all creatures
<dan2> dibblego: are you suggesting we should all become wussies and become vegitarians
<Mr_Awesome> dan2: you just proved my point, i cringe at even the thought of holding a loaded gun to my head
<dibblego> sitting next to a river in northern Australia, the chances of a crocodile attack are relatively high, and the consequences are extremely high (low chance of anything but death)
<dibblego> yet people still do it
<dan2> dibblego: people live in New Orleans, the only city other than Amsterdam that's below sea level
<dan2> they're just plain morons
<dibblego> sure, but how informed on weather patterns is everyone?
<Mr_Awesome> did you know that hippos are one of the deadliest (if not the deadliest) species besides humans?
<dibblego> I don't blame the people for their lack of knowledge - I have lack of knowledge in many areas
<dibblego> Mr_Awesome, yes
<dibblego> Mr_Awesome, did you know that flies are the most deadliest?
<Mr_Awesome> most people think they are benign creatures
<Mr_Awesome> in transmitting disease maybe
<dibblego> they are disease carrying killers
<dibblego> a hippo will proactively defend territory and things like that, so will a crocodile - a snake won't
<Mr_Awesome> so dibblego, what do you do? you seem like a perfect fit to be an actuary
<dibblego> what do I do about what?
<Mr_Awesome> as a career, job, work
<dibblego> I minimise the risk to myself wherever possible, by fighting the miseducation that is propagated by our government
<dibblego> software developer and university lecturer
m3ga has joined #ocaml
<Mr_Awesome> as long as you dont waste your life calcuating risks ;)
<dibblego> :)
<Mr_Awesome> you can make a lot of money calculating risks for an insurance company
<dibblego> money is not everything
<Mr_Awesome> i know, im just saying you mightve liked that
<dibblego> lots of people say things like that to me :)
m3ga has left #ocaml []
<dibblego> that I should have been a lawyer
<Mr_Awesome> we got pretty off-topic right there...
<dibblego> someone's gotta do it, or it's not IRC
batdog|gone is now known as batdog
<dbueno_> Anybody an ocamlyacc expert here?
<Ballin_105> jeremy_c: you still up ?
<jeremy_c> y
<Ballin_105> back..........but still cant figure out how to use my sprint stinf in my unix.send
batdog is now known as batdog|gone
batdog|gone is now known as batdog
<Ballin_105> jeremy_c: and you have went in a plane style glider ?
<jeremy_c> Ballin_105: you looked at the logger lib I sent the URL for?
<jeremy_c> Ballin_105: I have never been in a motorized glider. that would be fun. I have flown in glider, gliders.
<Ballin_105> yea but i think its doing it a little different then what i am trying to do
batdog is now known as batdog|gone
<Ballin_105> like the kite on your back ?
<Ballin_105> that kind ?
<jeremy_c> Ballin_105: you mean a powered paraplane? Like a Buckeye?
<Ballin_105> what kind of glider did you fly in ?
<Ballin_105> those are ultra lights
<jeremy_c> Powered Paraglider
<Ballin_105> whats what you flew in ?
<Ballin_105> is that *
<jeremy_c> I have piloted/soloed in: Trikes, Fixed wing ultralights, Powered paraglider (what I fly now), Cessna 152/172, and sailplanes (Schweizer 232)
<Ballin_105> you have flown a cessna ?
<jeremy_c> I have about 30 hours of solo time in a cessna.
<Ballin_105> you take lessons ?
<jeremy_c> I did a while ago, I got board. My student ticket is expired.
<jeremy_c> http://www.litetouchfilms.com/video_clips.htm ... that's what I fly now.
<jeremy_c> I will finish my private license, but not now.
<Ballin_105> thats what i am tlkaing about
<jeremy_c> Yes, that would be fun. I enjoyed flying sailplanes. It just wasn't practical for me. The nearest glider port is about an hour away and when you go to the field you commit a whole day to flying.
<jeremy_c> motorized gliders would be a good comprimize, but too expensive for me to purchase, hangar, keep up.
<Ballin_105> my family owns alot of land in new york
<jeremy_c> wife is calling, we are going to watch a movie. gotta go.
<Ballin_105> i could store it there
seafood_ has joined #ocaml
<Ballin_105> motoreized glider are kinda a small plane plus a glider and go alot slower
batdog|gone is now known as batdog
<Ballin_105> pango: you up ?
jeremy_c has quit [Client Quit]
<Mr_Awesome> why does the type of "self" in a class have to be 'a?
jeremy_c has joined #ocaml
<Ballin_105> flux__: you up either ?
jeremy_c has quit [Client Quit]
jeremy_c has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
jeremy_c has quit [Client Quit]
<dan2> wb pango
chessguy has quit [" Like VS.net's GUI? Then try HydraIRC -> http://www.hydrairc.com <-"]
<Ballin_105> omg dammit
<Ballin_105> like 4 hours on this grrrrrrrrrrrrrrrr.........
heh has left #ocaml []
Godeke has quit [Remote closed the connection]
chessguy has joined #ocaml
Godeke has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
<Ballin_105> 6 hours :P
<Mr_Awesome> good luck Ballin_105
Mr_Awesome has quit ["...and the Awesome level drops"]
chessguy has quit [" Want to be different? HydraIRC -> http://www.hydrairc.com <-"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
dibblego has quit ["Leaving"]
ktne has joined #ocaml
jewel has joined #ocaml
<Ballin_105> grrrrrrr........i am going to figure this out tongiht
jcreigh has joined #ocaml
jewel has quit [Read error: 104 (Connection reset by peer)]
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
jewel has joined #ocaml
chs_ has joined #ocaml
pattern has quit [Read error: 110 (Connection timed out)]
descender has quit [Remote closed the connection]
descender has joined #ocaml
batdog is now known as batdog|gone
pattern has joined #ocaml
_velco has joined #ocaml
pattern- has joined #ocaml
pattern has quit [Read error: 110 (Connection timed out)]
pattern- is now known as pattern
smimou has joined #ocaml
danly is now known as Stevely
Stevely is now known as Richardian
Richardian is now known as Harry
Harry is now known as ONCE
ONCE is now known as danly
pattern has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
velco has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
pango has joined #ocaml
ktne has left #ocaml []
shawn has joined #ocaml
smimou has quit ["bli"]
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
meng has joined #ocaml
meng has quit [Remote closed the connection]
chs_ has quit []
ramkrsna has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
Snark has joined #ocaml
ramkrsna has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
jave has joined #ocaml
<jave> how do I profile an ocaml program?
<pango> the oreilly book has a chapter on both bytecode and native profiling (that provide different kinds of informations)
<jave> tnx
batdog|gone is now known as batdog
<dan2> pango: have you used the camlidl?
<pango> nope
<dan2> hmm
ramkrsna_ has joined #ocaml
chs_ has joined #ocaml
jewel has quit [Read error: 110 (Connection timed out)]
cjeris has joined #ocaml
pattern has joined #ocaml
jeremy_c has joined #ocaml
<flux__> this is wayyy off-topic, but has anyone seen a tool that would, from a postgresql-database and a schema-description tell, what fields/tables may be missing from the running database?
<flux__> it wouldn't be that difficult to write I suppose, basically a simplistic parser for the CREATE TABLE-commands..
<jeremy_c> flux__: that would be nice for migrations. If it can tell what's different (added fields/tables or removed fields/tables) it could then create the necessary SQL to migrate.
Ballin_105 has quit [Read error: 104 (Connection reset by peer)]
Ballin_105 has joined #ocaml
velco has quit ["Ex-Chat"]
ramkrsna_ has quit [Remote closed the connection]
jeremy_c has quit [Client Quit]
jeremy_c has joined #ocaml
postalchris has joined #ocaml
cjeris has left #ocaml []
jeremy_c has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
smimou has joined #ocaml
batdog is now known as batdog|gone
batdog|gone is now known as batdog
ruben17 has joined #ocaml
_JusSx_ has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
ruben17 has quit ["Leaving"]
dkoontz has joined #ocaml
jeremy_c has joined #ocaml
<jeremy_c> What is the most efficient way of copying a file?
jeremy_c has quit [Client Quit]
jeremy_c has joined #ocaml
chessguy has joined #ocaml
dkoontz has quit [Remote closed the connection]
Snark has quit ["Leaving"]
david_koontz has joined #ocaml
<pango> jeremy_c: Unix.create_process "/bin/cp" [|"-a";src;tgt|] Unix.stdin Unix.stdout Unix.stderr :)
<jeremy_c> pango: not cross platform.
<pango> you did not specify that ;)
<pango> then open both files, and copy data using an intermediary buffer...
<pango> buffer doesn't need to be very large, OCaml breaks reads and writes in 16kB blocks...
* jeremy_c still thinks that copyfile should be in stdlib
<dan2> how hard is it to copy a file?
<dan2> copyfile isn't part of c standard library afaik
<dan2> jeremy_c: splice() function provided by linux kernel is an incredibly fast way of copying files iirc
ijoshua has joined #ocaml
<flux__> imho copyfile is not something you need to do very often from a program..
<flux__> actually, I referred to /bin/cp, not the system call
danly is now known as gDanly
<ijoshua> is there a way to have an object which responds to arbitrary messages that aren't explicitly defined in the object definition? e.g. a decorator which can forward messages to an underlying instance?
<flux__> atleast not as such
<flux__> if you considdr messages to be method calls
<ijoshua> flux__: yes "message" = "method call" in this case
<flux__> I doubt any statically typed language provides that, although I suppose it could be implemented.. I'm just not sure it fits the static type system mindset ;)
<dan2> does anybody know of some ocaml code that's already written that just recurses through directories and adds all the files to a list?
<dan2> filenames and path to a list that is
<dan2> I guess this isn't really all that complex
<flux__> hmm.. didn't someone just recently paste code that did just that..
<dan2> flux__: I pasted code earlier that recursed through xml
<dan2> I can only imagine that directories are much simpler instruments
<flux__> anyway, should be quite easy. only complication being exception hanlding - wish it were possible to handle exception-throwing functions more easily with pattern matching (of course, a simple Value 'a | Exception 'b -datatype plus a wrapper function will do that for you)
<dan2> flux__: well, readdir will throw an exception when it's finished with entire structure of that directory
<dan2> flux__: isn't that inefficient?
<pango> but doesn't mix well with tail rec
_fab has quit [Read error: 104 (Connection reset by peer)]
<pango> because of this, the most efficient way to read directories (or text files to string list of lines, for example) is to go imperative
<dan2> pango: that sucks
<pango> correct
<dan2> pango: I was hoping that the directory read function would provide a list of all files in a given directory
<dan2> pango: then I'd have some function to tell me if it's a directory or not
<dan2> pango: if it was a directory, recurse into this directory add all the files to the list and recurse again
<dan2> repeat until there are no files left
<pango> that's a different thing
<dan2> it would realistically be very fast
<pango> you just need to go imperative to efficiently read a single directory
<dan2> oh I see
<pango> but scanning the whole tree is better implemented as a recursive function, naturally
<dan2> right
<pango> someone benchmarked the read of a text file line by line using imperative way, and functional way using the usual string option conversion...
<pango> speed was something like 1.5s against 7s
<dan2> ouch
<dan2> pango: well, the interface on the Unix.read_dir is bogus
<dan2> I mean why would anybody implement a function that raised an exception on end of directory
<dan2> a much better idea would have been a tuple, name and number of bytes in name
<dan2> if number of bytes was zero, then the directory is over
<dan2> recurse backwards
<pango> mmh ? if the name is a string, returning name length gives no additionnal info
<pango> better return a string option
<pango> that's probably what SML does
<dan2> most filesystems I've used don't allow for names that have no content
<dan2> think realistic here
<dan2> you must have a name to index it
<pango> ah, not even. It just returns an empty string
<pango> probably slightly faster, but I don't like magic values :)
<pango> I liked the string option better
<pango> oh well, such code will have to deal with magic values anyway (".", "..", ...)
<pango> oooh "readDir filters out the names corresponding to the current and parent arcs."
<pango> neato
_fab has joined #ocaml
<jeremy_c> anyone use omake? How would I take PACKS=one two three and convert it to one,two,three?
_velco has quit ["I'm outta here ..."]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC for those that like to be different"]
<dan2> will ocaml automatically garbage collect file descriptors or do they need to be closed?
<pango> at best you would have no guarantee about how fast they'll be, so it's better to explicitly close them
<dan2> yeah ok
<pango> a useful trick is to write a hof to open/close resources around a function
<dan2> damn, my head is spinning
<dan2> I just want a preexisting find function in ocaml
<pango> what should it do ?
<dan2> find all files (note not directories or pipes or any of that other garbage) under dir
<dan2> and recurse until it's finished
<pango> and return them as a string list ?
<dan2> yup
ijoshua has quit ["Quitting!"]
newbcoder has quit [Connection timed out]
<dan2> it does not need to be platform independant
<dan2> symlinks only exist on unix
<dbueno> dan2, I have something similar.
<dan2> dbueno: paste it somewhere, would ya
<dbueno> You give it a path and function and it will run the function on each path, and return the results of those function calls as a list.
<dbueno> One moment.
<dbueno> dan2, Got a paster recommendation?
alcojol has joined #ocaml
<pango> (slightly tested)
<dan2> dbueno: umm
<dan2> ok, looking
delamarche has joined #ocaml
chessguy has joined #ocaml
<dan2> pango: works great!
chessguy has left #ocaml []
<dan2> pango: I'm not sure I can understand your code tho
<dan2> heh
<dan2> but it works right
<pango> it can be shortened to use a single fold_left instead of three
<pango> by handling files and directories directly instead of building their lists and handling them separately
<dan2> pango: heh, well, it does what I want, and I'll never modify what it does in the code
<dbueno> dan2, I should have mentioned mine also does filtering via the predicate it takes in.
<dan2> dbueno: what do you mean?
<dbueno> It only runs the function given as an argument on those files for which the predicate passes.
<pango> dbueno's code has the benefit of not building the whole list either, working as a hof
<dbueno> This way you could implement a "do this to every .c file, recursively" easily.
<alcojol> hi, someone knows an ocaml standard library funtion that its similar to Unix.system but returns the output of the command executed? I think that I've seen it but I don't remeber where
<pango> alcojol: Unix.open_process_out ?
<dan2> oh damn, that is exactly what I want
<dan2> dbueno: I'm matching regular expressions to the filenames etc, yours probably does what I want easier
<dbueno> pango, how expensive is Unix.stat? Do you think it's more or less expensive than letting readdir throw an exception?
<dbueno> dan2, Ah, so you can just put your matching in a function and pass it as the predicate.
<dan2> dbueno: bullseye
<dbueno> And whatever you're doing to the file pass as f.
<alcojol> pango: no no, a string -> string function
<alcojol> I want to know if anyone knows it, otherwise I will use open_process
<dan2> dbueno: so if I apply a function that returns things that match the regular expression or return None, will it bring back those files?
<pango> open_process_in, even
<pango> dbueno: on some filesystems, files have both file and directory behaviors (reiserfs4 ?), so it's not safe to assume you can't open files with readdir
<pango> opendir even
<dan2> this is true
<dbueno> dan2, it's a predicate, so your matcher should return true whenever you want to include that file; false otherwise
<dan2> I take it the function pointer f manipulates the underlying data correct?
<dbueno> f is the function that gets a filename, and whatever it returns is put into a list of results.
<pango> alcojol: I know of no standard function that does that
<pango> dan2: adding a predicate is quite simple
<dan2> dbueno: ok, that works
<dan2> pango: I'm not sure I want a predicate tho
<pango> when you don't, just use a predicate that always return true
<dan2> pango: there are some cases where I'll want to run multiple regular expressions that's data shouldn't be in the same list
<dan2> pango: it doesn't make sense to recurse directories for each regular expression
<dan2> pango: the only reason I'm leaning towards dbueno's implementation is because your's looks hideous
<pango> sure
<pango> well, it uses Sys.readdir, that simplifies things a little
<dan2> this ought to be interesting
<dan2> it's searching for all mp3s in my homedir
<dan2> it's taking a while
<dan2> I wonder how much crap I've got in my homedir
cmeme has quit [sterling.freenode.net irc.freenode.net]
jave has quit [sterling.freenode.net irc.freenode.net]
DRMacIver has quit [sterling.freenode.net irc.freenode.net]
eradman has quit [sterling.freenode.net irc.freenode.net]
mattam has quit [sterling.freenode.net irc.freenode.net]
Norgg has quit [sterling.freenode.net irc.freenode.net]
jave has joined #ocaml
cmeme has joined #ocaml
DRMacIver has joined #ocaml
eradman has joined #ocaml
mattam has joined #ocaml
Norgg has joined #ocaml
<dan2> oh, damn
<dan2> it's going to search through all the . directories
<dan2> that'll take a while
<dan2> dbueno, yours doesn't work
<dan2> either that or my mp3test is too strict
<Ballin_105> yo
<Ballin_105> yo
<dan2> ok
<dan2> that answered that
<dan2> my mp3test is too strict
<pango> maybe it follows symlinks, and gets caught in a loop somewhere
<dan2> nah
<dbueno> It might.
<dan2> I didn't escape .mp3
<dan2> the .
<dbueno> But it didn't seem like you got looping behavior. Did you, dan2?
<dan2> oh, I got looping behavior for sure
<dbueno> Infinite looping?
<dbueno> Or do you mean recursive.
<dbueno> ... I must go home. I'll be back later.
dbueno has quit ["these are the only ones of which the news has come to harvard; there may be many others but they haven't been discoooovered"]
<dan2> umm
<dan2> something's wrong
<dan2> how do you properly escape a .?
<pango> in a Str regexp, you mean ?
<dan2> yes
<dan2> Str.regexp_case_fold ".*\.mp3";;
<dan2> that's what I did
<dan2> the ocaml compiler bags me with this
<dan2> Warning X: illegal backslash escape in string.
<mellum> \\
<dan2> ahh, ok
<pango> in the string, it must be \.
<pango> but since you're writing OCaml code, you must double the \
<dan2> wow, this works great
<dan2> pango: I'm going to be reading the regular expression from an xml file
<Ballin_105> could someone tell me wqhy my sock_send function will not work
<dan2> pango: will I need the double slash in the xml file, or is that only because I'm using the interpreter
<Ballin_105> This function is applied to too many arguments,maybe you forgot a `;'
<Ballin_105> that is the error i get
<pango> dan2: because you're using the interpreter (or the compiler, for that matter)
<dan2> ok
<dan2> works well, and it's fast
<pango> slightly shortened, as explained previously: http://nopaste.tshw.de/11588750562d23c/
<Ballin_105> could someone give me thing a quick look
<dan2> pango: well I want to use dbueno's code and switch it to use stat instead of readdir with exception for identificaiton
<Ballin_105> pango: coukd you take a look at my problem
<Ballin_105> im going on 10 hours and still cant figure this out
<Ballin_105> have read alot of documentation
<pango> for one, your IP number is incorrect
<pango> but I don't get the error you mention
delamarche has left #ocaml []
delamarche has joined #ocaml
<Ballin_105> pango: i changed ip for identification reasons
<Ballin_105> what is there not to understand the sock_send function will not work
<Ballin_105> it says to many arguments or i got a ;;
<Ballin_105> and i have tried everything
<pango> transformed your stuff in something compilable, and don't get any error: ftp://ftp.berlios.de/pub/mldonkey/pango/goodies/im.tgz
<Ballin_105> pango: this mght sound stupid but i cant connect
<pango> where is berlios.de when you need it ;)
<luca83> hmm another really stupid thing...
<pango> damn servers
<Ballin_105> pango: is it not working ofr you either ?
<Ballin_105> for*
<luca83> I attempted to use Str.length... compilation succeed, but on execution I got a fatal error (undefined global `Str')
<luca83> what should I do? :(
<pango> their availability was around 90% when we left this berlios.de hosting
<Ballin_105> isnt berlios.de very popular ?
<pango> luca83: Str is a regexp library
<pango> totally unreliable
<dan2> luca83: one the compile line, use str.cma (if ocamlc) or str.cmxa (if ocamlopt)
<Ballin_105> pango: did it even upload ?
<dan2> luca83: if in the interpreter use #load "str.cma";; before inserting your code
<pango> luca83: you probably mean String.length
<luca83> ah ok... without "-I"! It isn't a dir!
<pango> Ballin_105: no pb, or I wouldn't have posted the link
<luca83> mmm something like that... however I think it will run
<luca83> thanks!
pevare has joined #ocaml
<pango> where could I upload this ?
pevare has quit [Client Quit]
<luca83> I meant Str.first_char... anyway nothing to do
<luca83> what I'm trying to compile is a (bytecode) module to be run by Ocsigen... it does indeed compile, but it can't run
<luca83> if I add to the compile line "/path/to/str.cma", nothing does change
<pango> 0 byte... wtf
delamarche has quit []
<Ballin_105> pango: :P
<Ballin_105> how is it 0 byte ?
<Ballin_105> you ever heard of rapishare :P
<Ballin_105> rapid
<pango> seems it expects me to have javascript enabled...
delamarche has joined #ocaml
<Ballin_105> pango: could you just send through IRC :P
<luca83> any suggestion?
<pango> http://rapidshare.de/files/33974718/im.tgz.html 1 byte, it's improving ;)
<luca83> ;)
<Ballin_105> pango: dude lol
<Ballin_105> pango: are you messing with me lol ?
<Ballin_105> 1 byte lol
<pango> oh well, hopefully berlios.de will work again tomorrow...
mak1 has joined #ocaml
smimou has quit ["bli"]
<Ballin_105> lol
<luca83> I hate linking libraries...
julien has quit ["leaving"]
bebui has joined #ocaml
<pango> Ballin_105: http://pastebin.co.uk/1656 (don't forget to indent Makefile with TABs)
<delamarche> So how are we with dumb newbie questions?
<delamarche> because i've got one
<luca83> I had one too... but it seems to be too complicated
<luca83> delamarche: tell us
<delamarche> say i have a list of ints: let x = [1; 2; 3]
<Ballin_105> pango: just out of curiocity ..........why do you use open dsfds ;; and not #use "ddsf.ml" ;;
<delamarche> when i do print_int(List.hd(x)), the toplevel complains that i'm supplying too many arguments to print_int
<delamarche> so what obscenely simple thing am i missing here?
<pango> Ballin_105: because I'm using separate compilation
<pango> delamarche: works here
<delamarche> guh
<pango> # let x = [1;2;3] ;;
<pango> val x : int list = [1; 2; 3]
<pango> # print_int (List.hd(x)) ;;
<pango> 1- : unit = ()
<delamarche> oh wait it does work in the toplevel. Wow i'm a tool
<delamarche> it's just not working in my function definition
<pango> Ballin_105: #use is the interpreter pragma to read a file as if it was included at that place
<delamarche> sorry for that
<dan2> pango: will mkdir send an exception if the directory already exists?
<pango> Ballin_105: so each time you use #use, the file is interpreted again
<pango> dan2: # Unix.mkdir "/tmp" 0700 ;;
<pango> Exception: Unix.Unix_error (Unix.EEXIST, "mkdir", "/tmp").
<dan2> pango: ok, am thinking about how i will extract mp3 tags and place symlinks
<dan2> pango: I have an mp3id3 library which essentially spits out crap like [ (ARTIST:FOOBAR),....
<pango> dan2: guess you mean ; not , (= it returns a classical association list)
<pango> ah mmh nevermind, even then it's not a correct ocaml value
<delamarche> embarassing lesson #1.... learning what BEGIN and END are for
bzzbzz has joined #ocaml
<pango> dan2: (btw I forgot the 'o' in 0o700)
<Ballin_105> pango: what you mean each time i use #use its interpreted agai
<pango> yes
<Ballin_105> what if i fo a ocamlopt and i am using #use ?
<pango> no idea
<pango> I only use pragmas in the toplevel
<Ballin_105> i dont get it .........everytime i use #use the file gets interporeted
<Ballin_105> isnt use for including files in your program
<pango> sure, but that's not separate compilation
<dan2> pango: actually it spits in a form ( (artist,foobar); ...
<dan2> list of tuples
<pango> ok, association list then
<dan2> pango: what's the best way to search for the data in that
<dan2> using List.find>?
<pango> List.assoc
<Ballin_105> pango: im just suing the top level interpreter for making the program
<pango> Ballin_105: I'm showing you how to use make
<dan2> pango: the only problem I have with that is that the data I use in my xml file is in lower case, and the data that comes in the list is uppercase for at least the first variable
<dan2> pango: what's the function that converts between the two
<pango> String.{low,upp}ercase
<dan2> sweet
<dan2> pango: all the reasons I love ocaml
<pango> dan2: do you know savonet btw ?
<dan2> that's what I'm using for my mp3id3 library
<pango> right
<dan2> when I'm done, I'll contribute it to their project if they're interested
<dan2> pango: and ocaml is the greatest language ever created! :)
<dan2> pango: I'm thinking about creating an Ocaml2Java Generator
<dan2> pango: java has terrible data structure management
dbueno_ is now known as dbueno
<dan2> hey dbueno
<dbueno> dan2, hey
<dbueno> dan2: How'd using `traverse' go?
<dan2> dbueno: great
<dbueno> dan2: Glad to hear it.
<pango> JVMs have poor closures support
<dan2> this is true
<dan2> pango: managing complex data structures in java is a real pain in the ass
<dan2> for example
<dan2> imagine fun (x,y) -> x*y in java
<dan2> first off java doesn't support tuples
<dan2> that's at least 25 lines of code
_JusSx_ has quit ["leaving"]
<dan2> the problem with that, is I want the code to be portable
<dan2> I would need something that implemented ocaml on top of java
<pango> I think that has been done too, looking for a reference...
<Ballin_105> pango: it still dint fix it i dunno its like it not sending the string right but if i put it in plan text it will work fine GRRRRRRRRR
david_koontz has quit ["This computer has gone to sleep"]
<dan2> pango: is there a list method to merge all lists within a list
<dan2> damn there is
<dan2> they've thought of everything
pango has quit [Remote closed the connection]
pango has joined #ocaml
_fab has quit [Remote closed the connection]
<dan2> pango: Xavier Leroy needs to be put up as one of the greatest programming language geniuses of all time next to Dennis Ritchie
<dan2> List.concat (List.map (traverse (scanner dftag,regex) (function x -> x)) inputdirs)
<dan2> that's incredibly concise for the amount of work it does
<pango> well, that's nothing Lisp couldn't do
<dan2> but lisp can't do 5+5
<dan2> heh
<dan2> it would have to be inhumanely (+ 5 5)
mikeX has joined #ocaml
<dan2> I manipulate functors and multiple classes through out my code
<dan2> lisp couldn't do that
<pango> not afaik