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/
_fab has quit [Remote closed the connection]
jeremy_c has joined #ocaml
dark_light has quit [No route to host]
<jeremy_c> I heard reference today about java's get/set style not being good.I'm up for al alternative method of dealing with SQL records. The problem is when I set/change a value, on many of my objects, I have to record that change which will later got into a change log attached to that record. How else would you do that other than get/sets?
<dibblego> it is not get/set that is "not good", it is OO
<dibblego> I can guess at the argument that has been thrust upon you
<dan2> dibblego: OOP is fine as long as the classes and it's functions are static/immutable
<dibblego> dan2, almost, that fixes a lot of problems, but not all
<dan2> dibblego: well, it makes it to the point where it's very usable and you can work around the kinks
<dibblego> dan2, only because of the low expectations of industry
<dan2> heh
<dan2> dibblego: ain't it the truth
<dibblego> :)
<dibblego> glad someone hears me :)
<dibblego> I'm writing a book on it
<dan2> dibblego: why do you think I prefer to program in Ocaml?
<jeremy_c> really, what is alternative to my synario?
<dibblego> dan2, I know absolutely nothing about OCaml except what it stands for, so not a clue
<dan2> dibblego: it has the best type safety of any language I swear. i.e. 2.3 + 5 = compile error
* jeremy_c comes from an imperative/oo background
<dan2> dibblego: and it's totally functional
<dibblego> dan2, I use Haskell a lot, OCaml is on my todo list
<dan2> dibblego: with a decent implementation of classes if necessary
<love-pingoo> dibblego: writing on the expectations of the industry or the badness of OOP ?
<dibblego> love-pingoo, I hope to propose a formal invalidation of OOP as a mutually exclusive entity to software
<love-pingoo> jeremy_c: I don't see any solution to your problem without references
<dibblego> using reductio ad absurdum but for a layperson audience, so talking about the industry is inevitable
<jeremy_c> love-pingoo: right now I have a ton of val mutable's in a class.
<love-pingoo> dibblego: and did you manage to define OOP in the first place ?
<dan2> dibblego: it is lousy, it's not natural
<dibblego> love-pingoo, I propose a definition of course
<dan2> dibblego: we think in instructions when we do something, thus imperative programming makes sense (C). When we want something accomplished, we want it to be functional, thus functional programming is a great tactic for cutting down on work.
<love-pingoo> I believe that what OO is changes from language to language, and it so your arguments based on your definition might not hold that clearly for every "OO" language
<dan2> dibblego: make sure you define OOP for C++, Java, and Smalltalk (official OOP)
<dan2> dibblego: Java OOP is very close to smalltalk iirc
<dibblego> dan2, I will be much broader than any specific language definition - it should be easily accepted
<dan2> I use java all the time for work, but I don't know smalltalk that well
<dibblego> yes I am using Java to demonstrate the point
<dibblego> I used to work on the Java implementation for IBM
<dan2> dibblego: ahh, I've seen you in #java before
<dibblego> :)
<dibblego> I'm the shit ranter that nobody understands
<dan2> dibblego: I remember talking with you before
<dibblego> yeah I think I remember talking
<dibblego> I don't go into #java much on this server
<love-pingoo> I don't know haskell that much.. do you consider type classes OO ?
<dan2> love-pingoo: no
<dibblego> love-pingoo, no
<dan2> love-pingoo: it's just cool and strange at the same time
<dibblego> love-pingoo, but it's perfectly legitimate to do so if you like - since no formal definition exists - but if you do, most of my arguments don't hold up
<dan2> dibblego: are you putting emphasis on functional programming languages?
<dibblego> dan2, yes as one solution to all these problems
<love-pingoo> I'd be interested to read that when it's ready. I like OO in OCaml, although I agree that there are some really ugly things..
<dibblego> dan2, it comes about because I started reinventing Haskell/Clean when I started to write my own programming language - which was intended to solve all of these problems - I'd found that I'd reinvented most core aspects of FP
<dan2> dibblego: I think the big problem why we're stuck on OOP for the time being is mostly due to the need to get something higher level than C
<dan2> dibblego: when people thought functional in the 80s, they thought Lisp
<dibblego> dan2, yeah I can only speculate about that - I just hope it changes before I die
<dibblego> I read an article this morning that said it well
<dan2> I didn't
<dan2> could you link that to me
<dibblego> "The assignment statement is the von Neumann bottle-neck of programming languages and keeps us thinking in word-at-a-time terms in much the same way thecomputer's bottleneck does." http://www.stanford.edu/class/cs242/readings/backus.pdf
<dan2> dibblego: one other major problem with OOP is the fact that it's really hard to visualize it
EsotericMoniker has quit ["This computer has gone to sleep"]
<dan2> dibblego: imperative programming is very very easy to visualize, I do instructions, I repeat my crap, etc, Multiple people on one assembly line = multiple threads
<love-pingoo> are you guys, and the author of that article, trying to rule out every assignation ?
<dan2> dibblego: Objects aren't natural... for example, look at your clock: What does it do? It tells me the time. How does it work? ..., a Question is the equivalent of a functional understanding of the problem
<dan2> Questions are human nature
<dibblego> dan2, I think the problem is that OO cannot exist where we observe linear time relative to the software itself - but that is difficult to resolve and talk about
<dibblego> love-pingoo, at the very least, minimise it
<love-pingoo> fair enough
<love-pingoo> but I don't see the link with OO, it's just imperative vs. functional for now
<dibblego> I cannot pass a network computer as a function argument so that I can network bytes as functions
<dibblego> yes I think the problem is one step deeper and requires a thorough explanation, because in my experience, people poke holes in it
<dibblego> holes that have already been covered, but come about again
<dibblego> retreading over the same ground gives me sore feet
<dibblego> it's natural to poke holes in it of course
<dan2> dibblego: this is a great article
<dibblego> dan2, great ain't it? :)
<dibblego> I want to take that previous sentence and put it on my grave
<dibblego> then die
<dibblego> well not really
<dan2> dibblego: btw, I think within the next 30 years, programming and computers will imitate more bodily functions (yes as in biosciences)
ZeeGeek has joined #ocaml
<dan2> dibblego: genetic programming is a humongous success for those who know how to use it properly
<dan2> dibblego: it's just a sign that we will be moving more towards systems that mimic the human body but attempt to accelerate it
<dibblego> dan2, I hope the same can be said for FP
<dan2> dibblego: the reason functional programming works is because every component of the human body is `functional'
<dan2> humans don't have objects
<dibblego> the problem is a critical mass who do not accept - or perhaps cannot accept - what it is and why it more closely aligns with 'software'
<ZeeGeek> I'm not sure about the differences between "let rec a () = a(); ();;" and "let rec b () = b();;"
<dibblego> dan2, I think you are touching on my point but in a slightly more abstract way
<ZeeGeek> a();; will cause stack overflow while b();; won't
<dan2> dibblego: to replace the von neumann bottleneck, we need to understand how the brain stores things
<dibblego> dan2, perhaps, in the meantime I am convinced we can make progress from where we are
<dan2> yup
<dibblego> dan2, I left IBM because they are propagators of this nonsense
<dan2> dibblego: so what do you do now?
<dibblego> I work for a smaller company
<dibblego> I am tasked to redefine the company
<dibblego> a bit of pressure
<dan2> dibblego: I design voip systems
<dibblego> it comes about because I spent hundreds of hours with the manager convincing him why Java is not a solution
<dibblego> sounds fun
<dan2> dibblego: it pays well because there are seriously no accessible programmers in the industry
<dan2> dibblego: everybody is a contractor, and the sky is the limit for fees
<dibblego> sounds even more fun
<dan2> dibblego: I just banked on 70/hr
<dibblego> US70/hr?
<dan2> yeah
<dibblego> cool
<dibblego> using ocaml?
<dan2> unforteanetly, I have to use Java for most of the work
<dibblego> unskilled labour at US70/hr is not to complain about :)
<dan2> if "functional" java existed, it's my code
<love-pingoo> ZeeGeek: a is not tail-rec
<dibblego> dan2, http://contractualj.com is a feeble attempt at functional Java - I've since moved on
<dan2> dibblego: java isn't designed right to be a functional programming language
<dibblego> at the time I didn't know I was reinventing FP principles
<dan2> dibblego: to seriously take over the industry, here are my suggestions
<dibblego> right, not only that, there are some inherent contradictions that cannot be solved - provably so
<dan2> dibblego: 1) Design a functional programming system that can handle enterprise grade software
<dan2> 2) Make it portable
<dibblego> my thoughts precisely
<ZeeGeek> love-pingoo: so it needs to record what every round of recursion returns, right?
<dan2> 3) Explain the cost advantages
<dibblego> provide the migration path of the nonsense
<love-pingoo> ZeeGeek: exactly
<ZeeGeek> love-pingoo: thank you
<dan2> 4) Deploy it in at least one of the 7 infrastructure groups
<dibblego> s/3) Explain/3) Demonstrate
<dan2> dibblego: I'll tell you these once: Banking, Communications, Defense, Energy, Healthcare, Transports, Utilities
<dibblego> I don't see why nobody has provided a FP language that compiles to the JVM or the .NET CLR then start moving off it
<dan2> dibblego: these are the major infrastructure groups
<dan2> dibblego: these kinds of companies grow as a function of population growth (this is very very important)
<dibblego> dan2, agreed entirely
<dibblego> I fear that Microsoft or someone like that is already on the ball
<dan2> dibblego: Europe is currently declining in population. If for any reason there was some sort of world crisis, Europe would be the first to collapse
<dan2> dibblego: nope, they're not
<dibblego> or Google perhaps
<dan2> Google maybe, but I doubt it
<dibblego> why? there are many people I know who share exactly my interest who have been recruited by google into senior positions
<dibblego> why is it that you and I can see these problems yet nobody (read: few) else can? I don't think it's that "not obvious"
<dan2> dibblego: I tried explaining to my boss my major revolution in communications theory. A complete reversal model of the internet would drastically increase communications between people which would cause another boom that lasted 20 years
<dan2> dibblego: I went and studied the stock market and business, cycles and other things on a 1.5 year sabbatical from programming
<dibblego> well, I spent 230 hours explaining my ideas to my boss - and now we as a company are stuck
<dibblego> 230 is our estimate since we had to consider how we billed time
<dibblego> I have considered going back to studying
<dan2> dibblego: functional programming will be an end answer, unquestionably
<dan2> dibblego: btw, here's my hint to you: If you want major adoption. Get the DoD behind you
<dan2> All of the US's major technology has come for and by the military
<dan2> unquestionably
<dan2> dibblego: most projects fail because they never go straight for the throat which is infrastructure
<dan2> in every recession/depression through history, we have declared war on someone or something
<dan2> given those happen every 4 years
<dan2> it's almost guaranteeds
<dan2> guaranteed
<dan2> the "Cold War" had the most intensive military spending in history
<dibblego> I hate how everyone who shares a similar interest I find on IRC and is in the US or EU
<dan2> what do you mean?
<dibblego> I think my view is too narrow to solve this problem
<dibblego> I need alternative views as well
<dibblego> I mean my only means of outlet is IRC
<dibblego> which I find cumbersome
<dan2> dibblego: I think you should be pushing for the use of Genetics and Biorhythimic programming as answers
<dibblego> I think FP, with a migration path and demonstrable value is a good first step
<dan2> dibblego: I feel that people do not want to give the answers that are right in front of their eyes
<dan2> dibblego: why have insects have virtually not evolved but have been around the longest?
<dan2> dibblego: they outproduce/overpopulate
<dan2> dibblego: it's pretty clear that humans evolved from Apes or some sort of Monkey
Mr_Awesome has joined #ocaml
<dan2> dibblego: programming needs to be evolutionary
<Mr_Awesome> ive defined some infix operators in a module; but apparently i have to open the module before i can use them. is there any way around that?
<dan2> Mr_Awesome: not really other than giving them a named operator equivalent
<love-pingoo> Mr_Awesome: nope, open or explicitely name
<Mr_Awesome> that sucks
<love-pingoo> open A or A.(+)
<Mr_Awesome> how does the num module do it?
<love-pingoo> it's in the pervasive module, implicitely opened
<love-pingoo> otherwise you can go for some preprocessing using camlp4
<Mr_Awesome> no its not; ive had to prefix types and such with Num
<love-pingoo> (or ask ocaml to implicitely open your own pervasive, but I don't know how to do that)
<love-pingoo> Mr_Awesome: sorry I thought you were talking of the int/float functions ans stuff
<Mr_Awesome> nvm, i guess Num is the same way
<Mr_Awesome> well, i could create a nested module that contains all the normal functions and leave the infixes outside, then when i open the module i only open the infixes
<love-pingoo> yeah, it avoids the mess
<love-pingoo> hmm, what I'd actually do is have a nested module for the infixes
<love-pingoo> you have a big module M with your normal functions, and M.Notations for the infixes
<love-pingoo> it's more convenient, and you can open M.Notations without opening M
<jeremy_c> let log_d = log#printf ~dl:(Some 0) ;;
<jeremy_c> Can I do that? log#printf takes a few optional parameters then the same params as printf
<jeremy_c> During compile I get: The type of this expression,
<jeremy_c> ?ll:int option -> ('_a, unit, string, unit) format4 -> '_a,
<jeremy_c> contains type variables that cannot be generalized
batdog|gone is now known as batdog
<love-pingoo> you used Printf.printf in the def of your printf method ?
<love-pingoo> it wants to know what it is expected to print
<love-pingoo> printf is not a normal function, it becomes something "normal" only when it gets its format string attached
<jeremy_c> love-pingoo: it's not my method, but Ocaml Logger. I was hoping for a partial bind. Just to make it easy to call, log_d "%s\n" "John" instead of log#printf ~dd:(Some 0) "%s\n" "John"
<love-pingoo> ah ok. but then log_d has only an existential '_a and will print only one kind of format
* love-pingoo tries to figure out one way to do that nicely...
<jeremy_c> love-pingoo: hm, not really my desired result.
<love-pingoo> sure
<love-pingoo> let me see check how it was with that dtools library I used
<love-pingoo> hmm, no really nice solution.. but here's something:
<love-pingoo> let log_d s = log#printf ~dl:(Some 0) s ;; << s will be specialized to string soon
<love-pingoo> let f fmt = Printf.sprintf fmt ;;
<love-pingoo> and then you can do (log_d (f "bla%d" 10))
<love-pingoo> wait.. that seems dumb
<love-pingoo> I can't get these '_a with the Printf module, what's the logger you use ?
joshcryer has quit [Client Quit]
<love-pingoo> ocaml turned the universal into '_ because you partially instantiated the function with that dl arg
<Mr_Awesome> love-pingoo: that nested infix idea is good, i think ill use it
<love-pingoo> jeremy_c: does it work to explicitely pass all the arguments: let log_d ?ll format = log#printf ~dl:(Some 0) ~ll format ?
<love-pingoo> jeremy_c: it should work, I tried a mini example here
<love-pingoo> and btw it will allow you to avoid ~ll:(Some l) and type ~ll:l when you have one l to pass
<jeremy_c> love-pingoo: I must have done something wrong, getting compile errors w/your statement.
<love-pingoo> I didn't try exactly what I wrote (I tried without OO), maybe I mistyped something
<love-pingoo> what does it say ?
<jeremy_c> Oh.
<jeremy_c> wait... old code stuck in there, sorry. it compiled clean.
<jeremy_c> love-pingoo: yes, that works.
shawn has quit ["This computer has gone to sleep"]
<love-pingoo> jeremy_c: you're writing database stuff right ? have you ever heard of (or tried to write) a tool for generating an ocaml class from a table ? so one wouldn't have to bother about sql, get updates automated and so on, much like in ror
<jeremy_c> love-pingoo: that's what I did.
<love-pingoo> jeremy_c: ocaml didn't see that the instantiation of ~dl didn't break the generality of the rest of the type
<love-pingoo> jeremy_c: then I'd like to see it, if it's visible
<jeremy_c> love-pingoo: not exactly like ror. I don't generate dynamically on runtime, but I generate the model/finder's via a make file. So, when the database changes, you have to recompile.
batdog has quit [Remote closed the connection]
batdog has joined #ocaml
<jeremy_c> love-pingoo: It generates classes... xxx_base_model.ml xxx_model.ml and xxx_finder.ml ... you can edit xxx_model and xxx_finder to your hearts content, xxx_base_model.ml is where the database abstraction takes place.
<love-pingoo> jeremy_c: of course not runtime, that's what I meant
<love-pingoo> I would like to see more systems showing that these dynamic runtime things can mostly be done at compile-time, avoiding crappy languages
<jeremy_c> love-pingoo: I just got it to a working state (the resulting modules) this afternoon, so things are ugly. It's also my first sizable ocaml prg, so you'll prob see things you don't like.
<love-pingoo> let me know when it's "done"
<jeremy_c> love-pingoo: do you use postgresql?
<love-pingoo> nope :\
<jeremy_c> love-pingoo: right now (it's bad I know) but it does postgresql only. I want to abstract the generation so it can do others, but I'm not there yet.
<love-pingoo> I use ruby/sqlite for tiny hacks, and used ocaml/mysql a little.. I'm not an everyday database user, I'm just curious
<jeremy_c> love-pingoo: do you want to see the code or play with it?
<love-pingoo> ocaml-sqlite is broken from what I heard :(
<love-pingoo> and I never tried this ocaml-dbi
<jeremy_c> love-pingoo: I can pastebin the generator code if you want to see it.
<love-pingoo> jeremy_c: I'd like to play with it, when I get a little spare time (not now)
* jeremy_c didn't like ocaml-dbi, ocaml-unixodbc kept "Bus Err'ing" on me on large queries
<love-pingoo> I'd prefer to use it first and love how simple it is ;)
<jeremy_c> ./build_model -d dbname=test -t users -c user
<jeremy_c> :-)
<jeremy_c> I use Ocaml-template for the template files, so the user can write/alter the templates how they wish.
<love-pingoo> jeremy_c: that's cute ! no extra work between the build_model and the second file ?
<jeremy_c> what do you mean the second file?
<jeremy_c> oh.
<jeremy_c> the second file is an example of using the build models/finders
* love-pingoo -> lunch
<jeremy_c> love-pingoo: build_model will build fully functional classes w/finders, insert, update, remove, change logs, etc...
<Mr_Awesome> hmm, now record fields dont seem to be bound unless i open the module
<jeremy_c> Mr_Awesome: recvar.Module_name.attribute
<jeremy_c> Mr_Awesome: I don't like it either :-(
<Mr_Awesome> well, i suppose i could toss the records into a module and allow them to be opened... but if i dont want to open them for some reason i end up typing a ton of extra qualifiers
<Mr_Awesome> oh well
<jeremy_c> yeah, I didn't quite understand the reasoning behind it.
pattern has quit [Read error: 113 (No route to host)]
pattern has joined #ocaml
<Mr_Awesome> hmm, not quite sure how to do this
<jeremy_c> um, how do I copy a file? I see remove, unlink, symbolic link, mkdir, rmdir, but no simple cp?
<Mr_Awesome> its almost worth making it into a class
<jeremy_c> Mr_Awesome: that's the conclusion I came to
<jeremy_c> am I crazy or does the std libs not have a copy command for files?
chessguy has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC has never been so good"]
<Mr_Awesome> jeremy_c: something tells me youre not crazy
<jeremy_c> I see things for every file operation but copy. weird.
<dibblego> copying files is a compound operation requiring some in-memory buffering
<dibblego> you cannot copy files with stdio.h or java.io either
<Mr_Awesome> is there a function to just create a file?
<dibblego> nfi, never used ocaml
<dibblego> I'd imagine so - every other language does
pangoafk has quit [Remote closed the connection]
pangoafk has joined #ocaml
<love-pingoo> the Unix module is quite the same as what you have in C
<love-pingoo> if you want to create a file, use open
<love-pingoo> and copy is not elementary, indeed
<love-pingoo> Mr_Awesome: regarding the record field thing, it's about type inference
<love-pingoo> the engine has to know which type of record you're using, and cannot tell just by seing the name of the field
<love-pingoo> for OO, thanks to structural subtyping, the name of the method is enough
<Mr_Awesome> i know exactly why, its just inconvenient
<love-pingoo> OK. Most of the time I just open my modules, and try to avoid collisions ;)
<dan2> dibblego: push simplicty with your book
<dibblego> dan2, definitely
<dan2> excuse my spelling
<dan2> dibblego: how do we remove assignment?
<dibblego> dan2, pass the universe as a function argument :)
<dibblego> pass space/time itself
<dan2> heh, you might be on to something there
<dibblego> I have no better answer that what category theory provides
<dibblego> *than
<dan2> dibblego: basically keep an open house all the time and manufacture goods to order eh?
<dan2> it works for In-N-Out Burger
<dibblego> lol
<jeremy_c> If I wanted to become a OCaml expert, is there a resource or collection of resources you'd recommend?
<dan2> jeremy_c: google for ocaml book
<jeremy_c> right now I am getting by, and I suppose as time goes on I'll get better, but if I wanted to fast track my getting better instead of getting better by accident.
<dan2> you'll find it
<dan2> it's damn good
<jeremy_c> Developing Applications With Objective Caml ?
<jeremy_c> online/free even?!?!?
<dan2> sounds right
<dan2> yup
<jeremy_c> cool. thanks.
<dan2> dibblego: you know, the main purpose of computers these days is still sort data
<dibblego> yep
<dan2> dibblego: we need to write a genetic programming application that creates a better sort than one that already exists
<dan2> dibblego: even if the runtime is months before completion
<dibblego> that's quite ambitious
<dan2> dibblego: but wouldn't that be the answer
<dibblego> potentially
<dan2> something that's faster than the quick sort and uses less memory than the merge sort
<dan2> dibblego: the catch 22 is that a sort must depend on <> and can't perform any better than log n at best
<dan2> and log n is at least better than n log n
<dan2> dibblego: in fact, a GP that could recreate a circuit to provide a much faster <>= would be more ideal
<dibblego> I would consider full-time research if I set that as a goal
<jeremy_c> hey, did I miss the file copy command in the libs or is there not one?
<dan2> dibblego: unforteanetly, excuse me, n log n is the lower bound, and the merge sort (also by von neumann) is still the best
<Mr_Awesome> jeremy_c: there is not one
<jeremy_c> k
<dibblego> jeremy_c, there isn't one (hearsay) and it makes no sense for there to be one
<jeremy_c> dibblego: why? just open, read, write, close?
<dibblego> jeremy_c, because of the read/write
<dibblego> jeremy_c, is there such a thing in C/C++, Java or any other language?
<jeremy_c> dibblego: most people will wrap that in copyfile or something.
<dibblego> jeremy_c, most poorly skilled developers might
<dibblego> and there are certainly lots of those
<jeremy_c> dibblego: hm. I guess I am one... I have a few places where I copy files, why not use 1 command instad of a few?
wkh has joined #ocaml
<dibblego> by creating that higher-order, you offer no advantage and a binding to such things as the size of the in-memory buffer, the method of reading
<dibblego> I see people who exercise those trendy XP processes do things like that and I just cringe
<dan2> dibblego: is it possible to sort a list without comparison operators?
<dibblego> dan2, the notion of equality/inequality is intrinsic to sorting
<dibblego> dan2, at least, I cannot imagine some refutation to that
<dan2> dibblego: while I studied the stock market, 100 years ago a man named Gann proved that markets were symmetrical
<dan2> and that time and price were interchangable (I can prove it if you would like)
<dan2> or rather he stated
<dan2> I have the proof
<dibblego> I know very little about the stock market, but sounds interesting
<dan2> it has to do with the squares of numbers and 360 degrees
<wkh> egh, you've fallen for that numerological technical analysis stuff?
<dan2> every 180 degrees was the next major prive level
<dan2> wkh: I did 2 years of research on it, I have more proof than necessary, but my point is this
<dan2> given set of numbers [2,1,3,6,9,4]
<dan2> find the largest number in the data set, and the smallest number in the dataset
<dan2> in this case, 1 and 9
wkh has quit []
<dan2> group all the angular numbers together
<dan2> at a bare minimum
<dan2> [3,6,9] from the top, [1,2,4]
* dan2 goes and checks his reference docs
<dibblego> what is angular?
<dan2> I'm looking at my notes
* dan2 tries to remember the stupid formula
<dan2> (n*180)-225 % 360
<dan2> or something very close to that
<dan2> for 9 that returns 315 degrees which is part of the 45 degree angle family
love-pingoo has quit ["Leaving"]
<dan2> simply enough again, you just take the sqrt and subtract it from the number or add it until you have all of your dataset
<dan2> so [3,6,9]
<dan2> 1 doesn't work too well, so you have to multiply by 10
<dan2> you take the sqrt of 10 = 3.16 and use that with the formula
<dan2> hmm
<dan2> I'll need to think on this more
<dan2> I don't know how to apply it properly
<dan2> they key however is finding a cyclical relationship in the dataset
<dan2> if you could use the angular degrees to parition the dataset, you might have good results
<dan2> dibblego: here's another idea
<dan2> dibblego: take an entire dataset take the mean of the numbers and calculate the standard deviation
<dan2> use standard deviations of 1 2 and 3 to partition the data set
<dan2> that's on the internals of the dataset
<dan2> as well, calculate the standard deviation of the length of the dataset (basically sqrt of length and use those to reorder
<dan2> case example
<dan2> [4,1,2,5,6,3,7,0,9,8]
<dan2> dataset of 10
<dibblego> have you documented all this?
<dan2> some
<dan2> ok, so the sqrt of 10 will be rounded to 3
<dan2> the middle of the dataset is position 5
<dan2> which is number 6
<dan2> 2 std dev away neg [4,1,2] -1 [2,5,6] +1 [6,3,7] +2 [0,9,8]
<Mr_Awesome> so, i wrote a class that uses another class, but instead of letting me use the class in the interface file it says there is a conflict with the type < x : float; y : float; .. >
<dan2> the standard deviation of the entire dataset is 2.87
<dan2> bah
<dan2> I'm too tired to think about this
<dibblego> another time mate :)
joshcryer has joined #ocaml
<dan2> dibblego: what I'd really like to try is using the ADX (WIlder's DMI (Directional Movement Index)) with GP
<dan2> and sorting
<dan2> dibblego: possibly the most powerful stock market indicator in history
<dibblego> sounds like to need to do research
<dan2> dibblego: it calculates trend strength
ktne has joined #ocaml
<dan2> dibblego: use it to find data that isn't with the trend seperate it, repeat repeat, merge merge merge
<dan2> dunno
<dan2> a lot of neat tools out there
shawn has joined #ocaml
<Ballin_105> jeremy_c: i want a motorized glider real bad
_velco has joined #ocaml
<jeremy_c> it would be nice.
<Ballin_105> i would like a little motor on the front so if i needed it to fly like a plane it would
<Ballin_105> jeremy_c: but also be light enough and versatile to glide
<Mr_Awesome> are there any timing functions in ocaml?
Mr_Awesome has quit ["...and the Awesome level drops"]
jewel has joined #ocaml
batdog is now known as batdog|gone
jcreigh has quit ["sleep is good"]
pangoafk has quit [Remote closed the connection]
pangoafk has joined #ocaml
Wild_Cat has joined #ocaml
joshcryer has quit [Nick collision from services.]
joshcryer has joined #ocaml
ramkrsna has joined #ocaml
jewel has quit [Read error: 104 (Connection reset by peer)]
<Ballin_105> how cnan i run my ocaml app just through an interpreter ....... just using the linux module
<Ballin_105> ocaml ddd.ml fff.ml unix.cma
<Ballin_105> like that ?
jewel has joined #ocaml
Wild_Cat has quit []
<Ballin_105> hmmmmmmm
dibblego has quit ["Leaving"]
<Ballin_105> dammit ........im still having some problems with this multiple files
<Ballin_105> anyone up ?
love-pingoo has joined #ocaml
<Ballin_105> i keep trying to use a file inside of another file but i keep getting unbound module
<love-pingoo> did you specify all of your .cmo files in the right order on ocamlc command line ?
<Ballin_105> love-pingoo: i am trying to use the ocaml interpreter
<Ballin_105> just ocaml
<Ballin_105> i dont want to compile anything right now
<love-pingoo> so what are you trying to do, can you describe a bit ?
<Ballin_105> well i would love to be able to use Camelia
<Ballin_105> but for some reason i cant use multiple files i can only use it if i do everything in one file
<Ballin_105> i can load moldules
<Ballin_105> but im trying to load a file .......... xml.ml and use it within my tcp.ml
<Ballin_105> but yea
<Ballin_105> love-pingoo: do you have Camelia installed ?
kral has joined #ocaml
<love-pingoo> nope
<love-pingoo> never tried
<Ballin_105> i like it alot .........very simple but gets the job done good ...........but i just cant use multiple files
<Ballin_105> i can edit what it sends to the interpreter and all but hmmmmmmm
<Ballin_105> grrrrrrrr
<love-pingoo> how are you trying to "load" your other file ?
<Ballin_105> open Globstuff;;
<Ballin_105> and i have a file called globstuff.ml in the same directory
<love-pingoo> forget about that, it's for compiled modules
<Ballin_105> yea thats what i thought
<Ballin_105> how can i use another file in my file
<love-pingoo> anyway, you can't expect to test your code interactively for long since you're building a real app
<love-pingoo> learn compilation
<Ballin_105> is it #use "dfdf.ml";;
<Ballin_105> ?
<love-pingoo> it should
<Ballin_105> if this works i have been on a wild goose chase ofr a while 1 sec
<Ballin_105> where od i type #use ?
<Ballin_105> in the file ?
<love-pingoo> in the file you run
<love-pingoo> the one you pass to the toplevel
<Ballin_105> #use "globstuff.ml"
<Ballin_105> that is art the top of my file
<Ballin_105> at*
<Ballin_105> and its giving a parse ewrror
<Ballin_105> love-pingoo: any ideas?
<love-pingoo> #use "foo" ;;
<Ballin_105> in the file right ?
<Ballin_105> thats what i did
<love-pingoo> did you put the ;; ?
<Ballin_105> #use "globstuff.ml"
<Ballin_105> #use "globstuff.ml" ;;
<Ballin_105> love-pingoo: ^^
<love-pingoo> and it says parse error ? then I don't know what camelia does, or what you do with it..
<Ballin_105> i never tired this with camelia
<love-pingoo> [dbaelde@localhost bedwyr]$ ocaml
<love-pingoo> Objective Caml version 3.09.2
<love-pingoo> # #use "/tmp/ml.ml" ;;
<love-pingoo> val x : int = 1
<love-pingoo> this is exactly equivalent to running ocaml /tmp/ml.ml
<Ballin_105> love-pingoo: http://phpfi.com/154921
<love-pingoo> what do you do with this file ? ocaml thisfile.ml ? and what's the exact error message ?
<Ballin_105> syntax error
<Ballin_105> line 1
<love-pingoo> [dbaelde@localhost ~]$ ocaml /tmp/your.ml
<love-pingoo> Cannot find file globstuff.ml.
<Ballin_105> WTF
<Ballin_105> love-pingoo: yea it worked here but for some damn reason this thing is saying its a syntax error
<Ballin_105> what a bunch of crap
<love-pingoo> Ballin_105: be more precise when you ask questions.. for example I don't know what "this thing" is in the previous sentence
<Ballin_105> camelia is this thing
<Ballin_105> it has a type check
<Ballin_105> it checks for syntax errors
<Ballin_105> and for some reaons it says #use etc etc is a syntax error
<love-pingoo> I can't help you with camelia
pangoafk has quit ["bbl"]
<Ballin_105> love-pingoo: i mena yea it works
<Ballin_105> like i can write code and run it works good
<Ballin_105> but the syntax check is the problemo
<Ballin_105> love-pingoo: is the #use syntax invalid ?
<love-pingoo> as you said, it worked, so YES
<love-pingoo> ocaml is the ultimate test for syntax validity
<love-pingoo> not camelia
kral has left #ocaml []
pango has joined #ocaml
<Ballin_105> yes i understand
smimou has joined #ocaml
<Ballin_105> man o man
<Ballin_105> try connect client_sock (ADDR_INET ((inet_addr_of_string "71.65.50.313"), 5222))
<Ballin_105> whats wrong with that
<Ballin_105> it was wroking just finre
<Ballin_105> fine
<Ballin_105> nevermind
slipstream has joined #ocaml
slipstream-- has quit [Read error: 60 (Operation timed out)]
<jeremy_c> Ballin_105: skip the ide's, pickup emacs or vim :-) gn all.
jeremy_c has quit [Client Quit]
<Ballin_105> love-pingoo: http://phpfi.com/154933
<Ballin_105> could you tell me whats wrong here
<Ballin_105> i posted the error on there
velco has joined #ocaml
Wild_Cat has joined #ocaml
_velco has quit [Read error: 145 (Connection timed out)]
pango is now known as pangoafk
_velco has joined #ocaml
Banana has joined #ocaml
Banana has left #ocaml []
<love-pingoo> Ballin_105: I guess you've figured out the problem by now
<Ballin_105> love-pingoo: naw ;)
<love-pingoo> sock_send takes a socket and a string, not a socket a format and the format's params
<love-pingoo> read the type of things
<love-pingoo> something like (sock_send client_sock (establish_connect_xml cli ip)) seems to be typed correctly
<love-pingoo> does it make sense
<love-pingoo> ?
<Ballin_105> i dunno ..........why wont it allow me to use the strong from the xml.ml file ?
<Ballin_105> sock_send client_sock "dfsdfdsfsdfsdf" ;;
<Ballin_105> that works fine
<love-pingoo> but (sock_send client_sock "%s" something) is nonsense
velco has quit ["Ex-Chat"]
<love-pingoo> do you see that there's one more argument ?
<Ballin_105> there is ?
<Ballin_105> sock_send client_sock "dfsdfdsfsdfsdf" ;;
<Ballin_105> that worked fine
<Ballin_105> why cant i just use a %s there instead of doing that
<love-pingoo> but in the code you wrote (which I just repeated) there are THREE arguments to the function
<Ballin_105> :( love-pingoo bear with me ........ but i am lost ........so whats a good solution ?
<love-pingoo> you don't just add "%s", you also add a third argument (causing the error), and btw "%s" isn't a normal string, it's a format
<love-pingoo> (sock_send client_sock (establish_connect_xml cli ip)) seems to be what you need
<love-pingoo> you create the string (establish_connect_xml cli ip) then you pass it to sock_send
<love-pingoo> I don't know from where came what you wrote, but "%s" is not a function like in python where ("%s" % foo) evaluates to the string foo
Banana has joined #ocaml
Banana has quit [Client Quit]
<Ballin_105> love-pingoo: grrrrr...........there needs ot be a better way of doing this
<love-pingoo> what's not good with it ? it's simple
<Ballin_105> hold on
<Ballin_105> i think
<Ballin_105> sock_send client_sock establish_connect_xml ;;
<love-pingoo> I'm starving so you'd better think fast ;)
<Ballin_105> love-pingoo: that should work
smimou has quit ["bli"]
<love-pingoo> no because establish_connect_xml is not a string but a string -> string -> string
<love-pingoo> that's why I passed it two params, cli and ip
<love-pingoo> Ballin_105: is that ok with you ?
<Ballin_105> love-pingoo: i think sock_send client_sock establish_connect_xml ;; is working
<love-pingoo> then I must have misread your code
<love-pingoo> anyway, I'm leaving
<love-pingoo> see you
love-pingoo has quit ["Leaving"]
Revision17 has quit [Read error: 110 (Connection timed out)]
<Ballin_105> sock send is already waiting for a string correct ?
m3ga has joined #ocaml
mikeX has joined #ocaml
Snark has joined #ocaml
<Ballin_105> lablgtk needs updates for their bindings to 2.8 or 2.10
Wild_Cat has quit ["Leaving"]
Snark has quit [Remote closed the connection]
m3ga has quit ["disappearing into the sunset"]
tld has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
_fab has joined #ocaml
jeremy_c has joined #ocaml
triple_ has joined #ocaml
pango_ has joined #ocaml
mikeX has quit [Remote closed the connection]
cjeris has joined #ocaml
jeremy_c has quit [Client Quit]
jeremy_c has joined #ocaml
batdog|gone is now known as batdog
jewel has quit [Read error: 110 (Connection timed out)]
jeremy_c has quit [Client Quit]
ZeeGeek has quit [Read error: 110 (Connection timed out)]
_JusSx_ has joined #ocaml
jeremy_c has joined #ocaml
m3ga has joined #ocaml
llama32 has joined #ocaml
<llama32> does compiled ocaml use .so's, or is everything statically linked?
<ktne> here only kernel.dll is linked from my .exe
<llama32> hmm
<llama32> ktne: what channels are you not in?
<ktne> llama32 :)
cjeris has left #ocaml []
Revision17 has joined #ocaml
cjeris has joined #ocaml
Boojum has joined #ocaml
Snark has quit [Read error: 110 (Connection timed out)]
velco has joined #ocaml
llama32 has quit ["Leaving"]
chessguy has joined #ocaml
ktne has quit []
lesshaste has quit ["Leaving"]
ziggurat has joined #ocaml
chessguy has quit [Connection timed out]
chessguy has joined #ocaml
velco has quit ["Ex-Chat"]
DR_QUAT has left #ocaml []
postalchris has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
smimou has joined #ocaml
piggybox has quit [Read error: 110 (Connection timed out)]
piggybox has joined #ocaml
pango_ has quit ["Leaving"]
chessguy has joined #ocaml
pango has joined #ocaml
_JusSx_ has quit ["leaving"]
danly has quit ["Lost terminal"]
dleslie has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- The future of IRC"]
_velco has quit ["I'm outta here ..."]
<flux__> the channel's been delightfully busy lately
<postalchris> flux: Perhaps you'd like to buy some Viagra?
ziggurat has quit ["Leaving"]
<flux__> o
<flux__> ookay..
<cjeris> the compilers class i'm taking this term insists on sml not ocaml :(
<cjeris> stupid uncurried functions
dark_ has joined #ocaml
<flux__> uh, sml doesn't have automatic currying?-o I would've thought that to be an ml feature
dark_ is now known as dark_light
<flux__> I've been considering of taking a look at sml, because atleast it is standard (otoh no new features are to be expected) and it has multiple implementations..
<cjeris> not that, but i have to conform to the conventions of the code we're given, which is usually uncurried.
<cjeris> it's just the whiny pain of adapting to a new set of syntactic conventions :)
<cjeris> that, and sml-mode's indenter sucks.
<cjeris> MLton apparently produces verrrry fast code though.
<zvrba> mlton is slow compiler :(
<zvrba> bute fast code, yes :)
<zvrba> i actually prefer sml over ocaml
<zvrba> nicer syntax to begin with :)
<dark_light> why?
<dark_light> i don't know sml
<dark_light> but syntax of ocaml is so.. fine
<zvrba> what why?
<dark_light> i don't like some things (like, i have to declare every register i use), but in the end..
<dark_light> zvrba, why you prefer sml
<dark_light> zvrba, it's only about the syntax?
<zvrba> what register?
<zvrba> nah, not only syntax (although it's nicer)
<dark_light> that things.. let a = { b = "x"; c = 1 }
<zvrba> more logical arguments in lib functions
<zvrba> that's record
<dark_light> i have to declare type foo = { b : string; c : int }
<dark_light> eh, record
<zvrba> (extremely annoyed with ocaml's taking ADT as the LAST argument >:)
<zvrba> look at hash tables for example
<dark_light> here in brazil we call this "registro".. more friendly to register than record, but you are right:)
<zvrba> .. and in SML i manage to produce functional code much of the time
<zvrba> with ocaml, i always end up with quick and dirty procedural code with side-effects
<zvrba> don't know why, but just an observation :)
<dark_light> in sml hash tables are primitives?
<zvrba> not :(
<zvrba> and you have to use SML-NJ lib to actually get a usable implementation
<dark_light> in python there are dictionaries as primitives, just fine..
<zvrba> (but that one is ported at least :))
<dark_light> zvrba, well so it's just a matter to port SML-NJ to ocaml:)
<zvrba> "just"
<zvrba> i'd rather use sml then :P
<zvrba> seriously, all things almost equal, SML wins with syntax :)
<dbueno> cjeris: where are you at school that you're writing a compiler in SML?
<dark_light> zvrba, almost equal? i though there were differences
<zvrba> well, i have no need for objects
<zvrba> and ocaml's ` variants look a bit... ugly..
<zvrba> SML just feels cleaner. + smlnj and mlton have native implementation of continuations
<dark_light> zvrba, hmmm.. ugly?
<zvrba> what is ugly?
<zvrba> ah
<zvrba> yeah
<dark_light> i tell what is when i see it
<dark_light> and that variants looks awesome for me, heh
<zvrba> could'nt think where I could use them and why
<dark_light> maybe i don't know anything better..
<zvrba> I mean ` variants, not ordinary variants
<dark_light> zvrba, i have in C code some defines to magic numbers, so i use only the defines in code
<dark_light> like #define ERROR_ARGH 1
<dark_light> that's a good use to variants, because you know that the compiler you do it's best to otimize it (allocating as char, or whatever it's thinks is best)
<dark_light> zvrba, there are any parallel to variants in SML?
<dark_light> zvrba, variants are good too because you don't have to parse many errors with a type so finite
<zvrba> you don't get what I'm talking about
<dark_light> ah.
<dark_light> yeah, of course not
<zvrba> look under 4.2, polymorphic variants
<dan2> zvrba: I've just scrolled up and read what you said. While I have not ever used SML, I will say this: Ocaml was a language designed for programmers and it's very powerful and usable
<dan2> zvrba: you could code most of an entire kernel in ocaml if you wanted to
<dan2> (OS kernel)
<dark_light> zvrba, i don't know how to use `
<zvrba> dan2: i never said anything to the contrary
<dan2> right I know
<zvrba> ...so?
<dark_light> :)
<dark_light> heh
dleslie is now known as danly
<dark_light> With polymorphic variants, this original assumption is removed. That is, a variant tag does not belong to any type in particular, the type system will just check that it is an admissible value according to its use. You need not define a type before using a variant tag. A variant type will be inferred independently for each of its uses.
<dan2> zvrba: ocaml is still actively developed and I know from experience, it's easy to port C applications to. Can you say the same for sml?
<zvrba> dark_light: yeah, i can read that for myself :P
pangoafk has quit [Nick collision from services.]
<dark_light> zvrba, i posted it just to say: i didn't understand well even reading this :P
<zvrba> dan2: there are several implementations; sml/nj and mlton are still developed
<zvrba> i did understand it, i just can't see the use of it :P
<zvrba> anyway, smerdyakov talked me into sml after I first started with Ocaml
<zvrba> and I ended up preferring sml
<zvrba> as far as the features i'm using go, they're pretty much the same
<zvrba> for me the difference now is mostly cosmetic and I prefer sml :)
<dark_light> i think all modern languages developers that are considering improve it's languages should 'congregate' (?) theyselves and decides a 'common' base of libraries/etc for all languages.. like, PHP, Python, Perl, Ruby, .. , Ocaml , ... , I think it would benefit all of us..
<zvrba> look at .NET
<dan2> zvrba: I don't want that personally
<zvrba> what? .net ?
<dan2> dark_night: do you know how much of a nightmare that is for a developing language
<dark_light> the idea behind .NET is a bad idea?
<dan2> zvrba: I meant to type dark_night
<dark_light> dan2, night, heh
<dark_light> dan2, no i don't know
<zvrba> well, there's F#, Python, managed C++, ... bunch of languages ported to .net
<dark_light> dan2, i really think it's funny
<dan2> dark_light: just remember that standards stunt growth, not the other way around
<zvrba> i just have to find some time to play with Mono
<dark_light> zvrba, i don't like the idea i must use a VM..
<zvrba> it's JIT :P
<dark_light> jit? :P
<zvrba> just in time compiler
<dark_light> well, generally i use ocaml's bytecode, just because it compiles faster :P
<zvrba> compiles VM to native code
<dark_light> ah
<zvrba> on the fly
<zvrba> as needed
<dark_light> zvrba, well..
<dan2> Java could seriously benefit from a port of Ocaml to it
<dark_light> dan2, hmm, why?
<zvrba> anyway, /me off
<dan2> dark_light: there are a lot of things that are not trivial in java
<dan2> dark_light: one of them is managing data structures
<dan2> dark_light: the ML languages are by far the best I've seen (I program fluently in over 10 different languages)
<dark_light> zvrba, []s
<dark_light> dan2, better than lisp? (i have some curiosity of learning lisp)
<dan2> lisp has been around for a very long time and I still think Ocaml has much more sensible structure management
<dan2> another thing java lacks is decent operators
<dan2> it's also not that easy to write high quality immutable code in java which is ironic since it's so heavily used as a concurrent language
<dan2> immutability is the ultimate advantage when dealing with threads
<dan2> finally, even with generics, the java type system is still a nightmare
<dark_light> operator overloading is a nightmare
<dan2> I didn't say operator overloading
<dan2> I meant operator creation
<dark_light> i don't know java, i am beginning to use c++
<dan2> operator overloading is bad when mixing non-compatible types
<dan2> i.e. objects and primitives
<dark_light> dan2, things become very confuse when a operator can mean multiple things..
<dark_light> i didn't liked it and by the way i am hating c++:)
<dan2> oh I know
<dan2> operator overloading is a nightmare
<dan2> I know C++
<dan2> I have to code in it all the time
<dan2> as well, I also have to code in java all the time
<dark_light> dan2, i will have to code in java and i fear it :(
<dark_light> dan2, thatSyntaxIsPainfulToMe, and it occurs in every lib
<dbueno> dark_light, since lisp is dynamically typed dealing with complex data structures & algorithms can be hellish
<dan2> dark_light: dbueno pointed out why I don't like using lisp over ocaml for data structures
<dark_light> dbueno, you know why lisp is dinamically typed? in the time of lisp, there were no type inference in computer science, there were no good implementations..? or dinamically typed was a real choice?
<dbueno> I don't think it was an absence of types/inference that makes it dynamically typed.
<dbueno> dark_light, the flexibility of macros and code-is-data in lisp is possible only because it is dynamically typed.
<dbueno> At least that is my impression.
<dbueno> Literally any piece of lisp code can be given to an operator and magically become data.
<dark_light> i don't understand well macros
<dbueno> And certain data structures can be evaluated by lisp; thus, "code is data."
<dark_light> dbueno, it's seems very error-prone to me, like the C pointers
<dbueno> Yes, it is very easy to use difficult tools incorrectly.
<dbueno> But that doesn't mean they're useless.
<dark_light> sure
<dbueno> Lisp macros (different from C macros) are very powerful. And error-prone.
<dbueno> Scheme attempts to fix some of the error-prone-ness of Common Lisp macros.
<dark_light> i have to learn lisp. many people is saying that it's the best language overall, i must at least check out
<dbueno> dark_light, if nothing else, if you truly "get" Lisp, you'll never be the same again. In a good way. =]
<dbueno> I was a lisp-head for years. Then I learned SML.
<dbueno> Now I *love* coding in Ocaml. Strong typing makes me happy.
<dark_light> dbueno, ESR said it too, and it's one more reason to learn lisp
<dbueno> And the type system in ML... it's great.
<dbueno> Ye.
<dbueno> Yes, sorry.
<dark_light> dbueno, ocaml is very good. but i have a huge list of languages to learn before i die
Boojum has quit ["Leaving"]
<dark_light> lisp, and.. python, perl, ruby, lua, haskell.. well, to begin.. prolog seems good too..
<cjeris> dbueno: the class is Harvard CS153... nice side benefit of being Harvard staff :D
chessguy has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- The professional IRC Client"]
_fab has joined #ocaml
chessguy has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Go on, try it!"]
chessguy has joined #ocaml
<datrus> when running a parser built using ocamlyacc, i get an exception "Fatal error: exception Parsing.Parse_error". how can i get more information about the error?
m3ga has quit ["disappearing into the sunset"]
<dan2> alright
<dan2> could someone help me debug this compiler error
<dan2> my mind is racing and I can/t seem to find out what the hell is wrong, but it's probably trivial
<postalchris> dan2: which line is the error?
<dan2> postalchris: see --- Error Referenced ---
<dan2> postalchris: which is line 31 on that paste
<dbueno> datrus, set your environment variable OCAMLRUNPARAM="b,p"
<postalchris> Try replacing [ list @ ... ] with ( list @ ... )
<dbueno> datrus, that will show you the actions of the parser as well as an exception stack trace.
<dan2> postalchris: ok, doing so now
<dan2> postalchris: thanks, you know some of these errors are so trivial except you just can't see them
<pango> dan2: are you using physical inequalities (!=) on purpose ?
postalchri1 has joined #ocaml
<pango> dan2: also, indentation is broken, but that could be pasting...
<dan2> pango: the pasting screwed the indentation
<dan2> pango: the inequalities are only used on integers which is fine
<dan2> pango: how should I be comparing strings
<dan2> isn' that standard = syntax?
<pango> that still hurts my semantic sensibility ;)
<postalchri1> dan2: lost signal there for a minute, did my edit work?
<pango> = and <> are structural, == and != and physical
<dan2> postalchris: yeah
<pango> s/and physical/are physical/
<dan2> pango: ok, so are you suggesting using the keyword not?
<dan2> but they're integers
<dan2> and integers can be compared with !=
<pango> because internally physical (in)equalities on non boxed values is tranlated into structural (in)equalities
<pango> don't know if it's purely on purpose, or the result of implementation
<pango> still, I don't think ints have an "identity", so comparing them physically sounds weird
<pango> (maybe I should feel lucky that OCaml has only two kind of equality operators only, but still, that's one too many ;) )
<dan2> pango: comparing strings you can use = right?
<pango> you can use both, just won't get the same results ;)
<postalchri1> you *should* use "=", right?
<pango> if you do hash consing, you can use physical (in)equality operators
<pango> but yes, in general structural gives you expected results
<dan2> ok, good
postalchris has quit [Read error: 110 (Connection timed out)]
<dan2> pango: good answer. Works first attempt (God I love ocaml)
<luca83> pango: I've seen that the html version of the ORA book has all solution to exercises... very good :)
<pango> luca83: does it work right for you ? I've always had issues with this dhtml stuff
<luca83> Me too... with firefox the yellow context boxes don't stay in the page... but however fine :-D
<luca83> pango: sadly tonight I'll be studying :(
<pango> luca83: seems to work better with the english version of the book... In the french version (http://www.pps.jussieu.fr/Livres/ora/DA-OCAML/) all the popups are displayed right from the start, overlapping each over, total mess
<luca83> ok I'll read the english version :)
<dan2> pango: isn't it amazing the almost always working principle in ocaml, "if it compiles, it works"
<pango> not always, but indeed static typing helps spotting a lot of mistakes
<pango> like infinite loops ;)
<dan2> oh yeah
<dan2> pango: the code I just wrote and showed you was to extract information from xml blocks that include the order and characteristics of how to order and symlink my mp3 collection in it's own set of folders
<dan2> pango: that took me about 1 hour and half to complete, and I can only imagine that it would take close to 8 hours to test and ensure operability in say Java
dark_light has quit [Remote closed the connection]
<dan2> currently I can not organize my mp3s properly among my servers and multiple hard drives (some of which are ntfs)
<dan2> this application takes an xml file recursively loads the names in to memory
<dan2> uses the provided regex with DirectoryFormat xml block
<dan2> scans for all which this directoryformat applies
<dan2> takes OutputDirectory information and recursively creates a hierarchy of folders matching the xml ordering and tagging information i.e. <artist/> <album/>
<dan2> the symlinks all the files into those folders from the input directories
<dan2> neat or what?
Mr_Awesome has joined #ocaml
<pango> interesting
<dan2> it requires the mp3s to be properly tagged as minimal requirement
<dan2> but all of mine are already
<dan2> it should work for anything that uses id3
<dan2> including ogg, wma, and mp3
<dan2> ;)
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Go on, try it!"]
<dan2> this is the sweet spot for ocaml
<pango> it seems that the outer structure of the function you pasted is some kind of "loop", I wonder if the whole code could be made more readable by using a high order function
<dan2> pango: probably, but that function only needed to be written once
<pango> well, beside reusability, I may still go for writing some high order functions if it makes code readable... Maybe for your next program ;)
<dan2> pango: the sweet spot again for ocaml is managing data structures esp. recursive ones
* pango nods
<Mr_Awesome> dan2: i agree
<pango> and 'match' rules ;)
<dan2> oh yeah!
<pango> another thing, complexity of a @ b is O(List.length a), so when used to add elements one by one to a list, overall complexity becomes O(n^2)
<pango> (adding them to the tail that is, as you do in the pasted code)
<dan2> pango: well I could add them to the front, but I get a situation I don't want, and if I do add them to the front, I'll need to reverse them
<dan2> pango: are you suggesting that add to front and reverse is a faster operation?
<pango> both adding to the front and reversing are tail recursive operations, so for large lists it's the only solution
<dan2> pango: this list won't get any longer than 32 variables
<dan2> pango: is it worth the effort?
<pango> for that size, probably not
<dan2> pango: for the mp3 recursive listing, order does not matter, so this won't be an issue there
<pango> I always keep an eye on performance and complexity issues, I just can't help it ;)
<pango> beside the fact that building-in-reverse-then-List.rev scales to larger lists, it should also create less garbage, hence GC would have less work to do, etc.
<dan2> yeah, I understand
<dan2> pango: but it's not that important on this, I was just thinking about what I needed to accomplish, not the performance of this operation because it's so small anyway
<dan2> pango: and realistically 32 is the absolute maximum, there won't be more than 4 or 5 at the most realistically
cjeris has left #ocaml []
<Mr_Awesome> append is O(n)?
<dan2> 2/3rds of the 32 aren't even practical for use anyway
<Mr_Awesome> what about (^) ?
<dan2> Mr_Awesome: yes because they're single linked lists or the first element doesn't keep a reference to the last element
<Mr_Awesome> oh ok
<Mr_Awesome> but strings are different, correct?
<dan2> Mr_Awesome: I can only imagine that concatenate is the equivalent of malloc (size of combinedstring), then two memcpy operations
<dan2> Mr_Awesome: which would make it very different
<Mr_Awesome> iow O(1)
<Mr_Awesome> or is memcpy not constant time
<dan2> memcpy is operating system dependant as far as performance goes
<Mr_Awesome> the complexity is even OS dependent?
<dan2> yes
<dan2> Mr_Awesome: afaik, memcpy worst case performance is O(n)
<pango> Mr_Awesome: in the size of first argument, yes
<pango> Mr_Awesome: strings are represented in (packed) char arrays, so the new string must be allocated, then each initial string blitted to the target string
<pango> Mr_Awesome: I don't know the complexity of allocating a block of memory, but blitting is O(n)
<pango> it's not, copying twice as much data requires twice as much work
<pango> tricks can be done to use SSE & friends operators to speed up memcpy, but that doesn't change the complexity
<dan2> pango: heh
<pango> s/operators/instructions/
<dan2> on Linux, malloc is a constant timed operation
postalchri1 has quit [Read error: 110 (Connection timed out)]
<dan2> or O(1)
<pango> Mr_Awesome: if you create a string by catenating several strings (or char) better go for a Buffer.t
<Mr_Awesome> yeah i learned that a little too late
<pango> internally it uses a string, but takes care of exponential reallocation for you
shawn has quit ["This computer has gone to sleep"]
<pango> dan2: but ocaml strings are not strictly malloc()ed
<dan2> I personally have no idea how they work, but at a minimum they used the size of the string + the size of a 32 bit integer
chessguy has joined #ocaml
<dan2> pango: if they call boehm gc's malloc or it's equivalent, that is also O(1)
<dan2> pango: it uses internal buffering
<pango> no, it's not boehm
<pango> there's a chapter in the oreilly book about OCaml's GC
<dan2> I didn't read it
<pango> chapter 9, IIRC
<dan2> I don't usually interface the GC
<pango> it's generational, stop-and-copy for young generation, and incremental mark-and-sweep for older
<pango> strings being "large", they may be allocated directly in the old generation however, I'm not sure
<dan2> however it works, it works well
<pango> btw, I wonder if (dl)malloc is O(1) on average, or also worse case
<dan2> on Linux, it's worst case is O(1)
<dan2> it has to do with how the linux virtual memory system works
<pango> malloc is only weaking related to virtual memory management (brk() ?)
<dan2> yes iirc
<dan2> free() and memalign are NOT O(1)
<pango> strange stuff ;)
<dan2> well, it's really advantageous to those people who use memory pools
<pango> and that do not call free() on exit ;)
<dan2> why would you need to ever call free() on exit?
<dan2> doesn't make any sense to me
<pango> well, because we use operating systems that ensure it's not necessary
<dan2> and if you're using an operating system that doesn't automatically free all crap on exit, it's retarded
<pango> those days, yes. Just mentionning it hasn't always been thecase
<Mr_Awesome> also, its a good idea in case you change the point at which the program exits
<pango> but well, programs are all the time assuming things from the platform they're running on
<dan2> pango: this is probably true. however, I have only programmed since 2000
<pango> at some point, they have to
<dan2> frankly, whether you ever use C or not, it's worth learning the language. Once you learn C, you learn how your operating system works which is very important to all programmers
chs_ has quit []
<pango> it's probably true of several other languages
<dan2> pango: I was making the argument last night that object oriented programming wasn't natural. Imperative and Functional programming styles can be found in nature.
<dan2> C was designed for operating systems
<dan2> Ocaml was designed for programmers
<dan2> C++ was designed for <nobody knows>?
<dan2> I don't even think a full implementation of C++98 exists yet
<dan2> and notice it came out in 1998
<dan2> ;)
<Mr_Awesome> dan2: good point, object-orientation in nature is the just teh way we perceive it
<pango> I was wondering if "imperative and functional styles in nature" are really out there, or only as different ways to see things
<dan2> imperative is very natural
<dan2> people follow instructions or procedures
<Mr_Awesome> really though, the higher-level objects are more or less emergence of things working on smaller and smaller scales
<dan2> functional programming is the act of asking a question
<dan2> What does this do?
<dan2> this is a question answered by functional programming
<Mr_Awesome> you lost me with that last one
<dan2> erm
<dan2> rather functional programming exists to answer questions
<dan2> the beauty behind functional programming is that function xyz has a purpose to answer the question perceived
<dan2> pango: the simplistic example of functional programming is how our cells work in our bodies
<dan2> pango: they exhibit functions, each and everyone different
<pango> but they have state, too
<dan2> I don't think that's actually true
<dan2> I think what you refer to as state is a cyclical rotation
<dan2> which is in itself a recursive loop of change
<pango> depends at what space and time scale you're looking at
<pango> I really thing all this is a matter of way you analyse a single thing
<dan2> pango: probably true
<pango> s/thing/think/
<Mr_Awesome> pango: thats why all the programming paradigms exist; they are merely tools for accomplishing tasks
<pango> Mr_Awesome: and to understand them in the first place
<pango> like in physics, we see things thru models
<Mr_Awesome> well thats a more academic way of looking at it
<pango> some models may be better than others to explains different kinds of tasks
<pango> with fuzzy overlaps
shawn has joined #ocaml
<pango> dan2: it's also interesting that you're saying objects are not natural, given that OO appeared in SIMULA, that was a language for SIMULAting physics ;)
<dan2> objects aren't natural
<dan2> a great physicist once told me
<dan2> "There is no past, there is no future, there is only present."
<dan2> time is a recursive function
<dan2> we know it repeats time and time again ;)
<dan2> and it continues onto infinity
<dan2> therefore state can only be implemented in a recursive functional manner
<pango> mmmh
<Mr_Awesome> who said functional and oo cant coexist
<Mr_Awesome> have you learned nothing from ocaml, my friend?
<dan2> Mr_Awesome: oo can exist, I'm saying that it creates more problems than it helps
<pango> my point of view would rather be that, oo being ok to model physics doesn't imply it's the best model for all tasks
<pango> (as in very oo centric languages)
<dan2> ocaml is the best of all three known worlds
<dan2> imperative, functional, and oo
<Mr_Awesome> i wouldnt say its the best of imperative
<Mr_Awesome> or oo really
<dan2> while that's true, it's the best implementation combining all three
<Mr_Awesome> ruby comes pretty close
<Mr_Awesome> though its way too slow to be useful for a lot of things
<dan2> the best traits of ocaml are that since almost everything is functional and immutable, it can thread very easily
<pango> what's difficult with ocaml, is to use the right features for the right tasks :)
<dan2> and managing data structures by far
<dan2> pango: heh
<pango> (on that point, I feel like I still have a lot to learn...)
<dan2> pango: that's a fundamental problem of evolution
<dan2> pango: functional programming is the only kind of method currently known that can naturally evolve like nature
<pango> dan2: stay polite ;)
<dan2> tho, to the best of our knowledge evolution is screw up until it works
<dan2> Genetic Programming Guru John Koza has this well documented
<dan2> GP is possibly the coolest thing I've ever seen
<dan2> programs that evolve themselves to solve the problem better
<dan2> someone I know used GP to evolve stock market trading systems
<dan2> his stuff works the best of anything I've ever seen
<pango> stock market works like "screw up until you screw them", no ? ;)
<dan2> basically
<dan2> but the stock market itself he showed me was a system of evolution in itself
<dan2> whenever some brilliant stock market guru pointed out something that had worked for him and sold tons of books on it, the market learns the new information and it's usability begins to fade
<dan2> so to beat the street you need to have a system that evolves with the market
<pango> I never looked at that too closely, but it seems many experts agree that the influence of irrational/speculative behaviors has been underestimated so far
smimou has quit ["bli"]
<pango> I wonder what's the irreductible part of that for any model
<dan2> pango: my work on the market proved how you could use emotions to trigger major events and trading points
<pango> sure
<dan2> pango: no but this was special
<dan2> pango: what one thing has throughout all of history triggered man's emotions?
<dan2> it's the tides
<pango> mmmh isn't that too abstract
<dan2> pango I backtested well over 200 years worth of data
<dan2> it's pretty damn accurate
<pango> but can it fit into a model ?
<dan2> the problem was descriptive units for identifying the points more accurately
<dan2> pango: oh yes
<dan2> pango: I have it totally statistically analyzed
<dan2> pango: the problem is that the model uses average distances from i.e. full moons for projected dates with standard deviations
<pango> and, can it be used predictively ?
<dan2> pango: very
<dan2> pango: the question is how do you remove the averages and use something that in itself progresses more predictably
<dan2> you lose a lot of value with averages
<dan2> but I don't know of a better way to project the dates yet
<pango> can't help you there... much less so close to bedtime ;)
<dan2> pango: what time zone are you in?
<pango> UTC+2 for now ;)
<pango> so it's 1am here
<dan2> ouch
<dan2> go get some sleep man
<pango> will try :)
<dan2> pango: where are you located?
<jeremy_c> I find that I am using Extlib for almost only DynArray/DynList. Let's say I wanted to use Arg.parse. It has a parameter called anon_func, that takes a string and returns a unit. Let's say I wanted to collect all the strings sent to that func, how could I do it w/o DynList?
<jeremy_c> (fun string -> unit)
<Ballin_105> yo yo
<jeremy_c> yo yo will do it?
<jeremy_c> :-)
batdog is now known as batdog|gone
<Ballin_105> Exception: Unix.Unix_error (EPIPE, "send", "").
<Ballin_105> what is this
<dan2> you triggered an epipe error
<Ballin_105> what is that
<dan2> Ballin_105: man 2 write
<dan2> read the error description
<Ballin_105> huh?
<dan2> read it
<Ballin_105> hmmmmm
dibblego has joined #ocaml
<Ballin_105> i need sock_send function to apply more then one function
<dan2> wb dibblego
<dibblego> g'day
<Ballin_105> sock_send client_sock "<?xml version=\"1.0\"?>
<Ballin_105> <stream:stream xmlns:stream=\"http://etherx.jabber.org/streams\" xmlns=\"%s\" to=\"%s\">" jabber_client jabber_ip ;;
<Ballin_105> how cna i do something like that ?
d-bug has quit [Client Quit]
heh has joined #ocaml