ayrnieu changed the topic of #ocaml to: OCaml 3.08.4 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/
pango_ has joined #ocaml
Smerdyakov has joined #ocaml
ulfdoz has quit [Read error: 60 (Operation timed out)]
ulfdoz has joined #ocaml
vezenchio has quit ["I could see how [James Randi] comes off as a bit abrasive, as he uses terms like "gobbledigook" and "woo-woo" when referring ]
vezenchio has joined #ocaml
smimou has quit ["?"]
Oatmeat has joined #ocaml
Oatly has joined #ocaml
pango__ has joined #ocaml
Oatmeat has quit [Read error: 110 (Connection timed out)]
pango_ has quit [Read error: 110 (Connection timed out)]
aegray has joined #ocaml
<aegray> What would be the best way to compare (ie if they are equal) two recursive data types? Would it just be to write a recursive helper function?
revision17_ has joined #ocaml
revision17_ has quit [Read error: 104 (Connection reset by peer)]
aegray_ has joined #ocaml
aegray has quit [Nick collision from services.]
aegray_ is now known as aegray
vezenchio has quit ["I could see how [James Randi] comes off as a bit abrasive, as he uses terms like "gobbledigook" and "woo-woo" when referring ]
vezenchio has joined #ocaml
pango__ is now known as pango
vezenchio has quit ["I could see how [James Randi] comes off as a bit abrasive, as he uses terms like "gobbledigook" and "woo-woo" when referring ]
cratuki has joined #ocaml
__DL__ has joined #ocaml
__DL__ has quit [Remote closed the connection]
__DL__ has joined #ocaml
__DL__ has quit [Remote closed the connection]
__DL__ has joined #ocaml
cratuki has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
Snark has joined #ocaml
MisterC has joined #ocaml
ChipsterOne has joined #ocaml
lispy has joined #ocaml
ChipsterOne has quit []
Skal has quit [Read error: 110 (Connection timed out)]
_JusSx_ has joined #ocaml
<ulfdoz> pango: Yes, that was my basic idea, but I think, I can live with Arg.
revision17_ has joined #ocaml
Bigb[a]ng is now known as Bigbang
Revision17 has quit [Read error: 110 (Connection timed out)]
descender has quit ["XML is like violence, if it doesn't solve the problem, just use more."]
Oatmeat has joined #ocaml
brx has joined #ocaml
descender has joined #ocaml
Oatly has quit [Read error: 110 (Connection timed out)]
brx_ has joined #ocaml
brx has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
_JusSx__ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
Submarine has quit ["Leaving"]
mhilhors has joined #ocaml
ski has quit [Read error: 104 (Connection reset by peer)]
brx has joined #ocaml
ski has joined #ocaml
brx_ has quit [Read error: 110 (Connection timed out)]
mhilhors has quit ["leaving"]
moea has joined #ocaml
<moea> what would the easiest way be to convert from decimal to hexadecimal in ocaml?
brx has quit [Read error: 110 (Connection timed out)]
<smimou> Printf.sprintf ?
<moea> is there a way to do it without involving strings?
<smimou> what do you want to do exactly ?
* Snark doesn't understand
<moea> convert base-10 to base-16
<Snark> moea: things are stored in binary form anyway...
<smimou> an integer is an integer
<Snark> so base-10 base-16 base-whatever is a string issue...
<moea> a network protocol i am trying to implement needs certain things to be hex
vodka-goo has joined #ocaml
<smimou> moea: do you have a precise example ?
<moea> well, one thing involves converting the length of a string to base 128
<smimou> if I get correctly your problem, you should use modulos, etc.
<moea> i wrote a general re-basing function: let digits n base = let rec loop n digits = if 0 < n then let (d, m) = (n / base, n mod base) in loop d (m::digits) else (List.rev digits) in loop n [];;
<moea> i am not sure if thats the best solution though
<smimou> I would have done the same kind of things
<moea> ok
ramkrsna_ has joined #ocaml
<moea> thanks
<moea> will ocaml ever have polymorphic arithmetic operators?
<Snark> hopefully no
<moea> like + for floats/ints instead of + and +.
<moea> why is it a good thing not to have them?
<smimou> it would complicate the type system
<moea> oh
<Snark> it would make it crumble, I would say
<smimou> gcaml was an extension of caml trying to do that
<smimou> so it should be possible
<Demitar> Is there some Ultimate Polymorphic Datastructure[tm] lying around somewhere? Basically I have a set of data I want to view in a few ways (sorted by various indexes) and the ability to also use it as a hash (keyed by a different index). Basically strongly typed in-memory sql.
<Demitar> Perhaps such a datastructure would be a worthy challenge... (Would probably require some camlp4 magic to make it convenient.)
<mflux> at times I've thought (with a friend) about a language for describing data structures, which would then generate code for you to use in your (c/c++) application
<mflux> and it would allow for instance adding indices to optimize performance without changing your code
<mflux> so in a way similar to sql
<mflux> but, it was just an idea ;)
<smimou> that's called modules in ocaml, isn't it ?
<Demitar> Well what one would want is sql really, but transparent to the user. :)
<mflux> smimou, no, it wouldn't really be the same thing
<smimou> what difference ?
<mflux> well, I take it you're familiar with sql?
<smimou> hum not much further than SELECT
brx has joined #ocaml
<mflux> well, the point with sql is that the database optimizes the queries for you
<mflux> let's say you have a list of people's personal information
<Demitar> (The main problem I have with sql in applications is that you instantly lose the carefully planned[1] typing. [1] Well perhaps not planned, more that it's so strong it enables you to leverage the rest of the application in the end. :)
<mflux> all the persons may have an index number associated with them, and obviously if the data structure is a tree or an array, searches per the id is fast
<mflux> but what if you want to search by their last name?
<mflux> how big code changes do you need to to add a data structure that indexes the data in that aspect?
<mflux> and what if you later find out that maintaining such an index is too much of an overhead for a few rare occasions of actually using it, when you can simply sequentially scan the datastructure to find the data?
<mflux> with sql it's just matter of creating of dropping the index on that field
<mflux> no changes needed to the queries
<smimou> interesting
<mflux> and lets say you have two such tables, and you want to find the common names in them, the database can optimize that case too if it has the indices
<mflux> with ocaml its an early decision to decide if some data is accessed via hashtbl, map, array or list, and if you make more advanced queries, which may or may not make use of the underlying data structure, you need to write lots of code
<Demitar> I guess it would be possible to write a (slightly clunky) semi-polymorphic table structure. Say class ['a,'b,'c,'d,'e] table ~a_cmp ~a_default ~b_cmp ... = object method top_a : 'a -> ['a,'b,'c,'d,'e] item = ... method bottom_a = ... method take_a = ... method top_b = ... etc
<Demitar> Yes, the problem arises when you want more than one way of accessing the data.
<smimou> mflux: is that what they call views (yes I'm a complete sql newbie) ?
<Demitar> Currently I have a datastructure which I want hashed by a key, but also sorted by another key (since I'll be pruning old entries regularly).
<mflux> smimou, well views are more like pre-written selects, you don't need to use views to use those optimizations, they are always around
<Demitar> s/hashed/uniquely mapped/
<smimou> ok
<Demitar> *ponders* camlp4 just might be up for the challenge. (Provided there is someone who's willing to bother. It simply confuses me. :)
<mflux> for some idea: http://modeemi.fi/~flux/query
<mflux> it has two similar queries on my (simple) database, to a view defined as SELECT pelikerta.id, pelikerta.viikko, peli.paiva, peli.kentta, peli.kello FROM peli, pelikerta WHERE ((pelikerta.peli = peli.id) AND ((peli.vuosi)::double precision = date_part('year'::text, now())))
<mflux> even though one would expect the first would be a 'subset' of the second one, it isn't
<mflux> postgresql keeps tables on the statistical properties of the tables to decide what is the best way to make the query
<mflux> btw, this is what I think is the problem with object databases, you can't really write ad hoc queries into them, but you need to design them for the queries, and changing may be far from trivial
<mflux> although I hear there are some object database query languages? I don't know how they work though
<moea> the benefits of object databases are great for the cases when you aren't going to need to query arbitrarily
<mflux> atleast during the development stage I think arbitrary queries are very nice ;)
<moea> this is true, if you come up with a schema, persist a bunch of objects and then decide one of them needs another attribute, it's a mess to upgrade
<moea> no alter table add column
<Demitar> If you're using object you most likely want them to have a common archetype anyway. :) (And thus they should ideally upgrade automagically.)
brx has quit [Success]
<moea> a lot of OODBs do not allow subclassing of persisted objects :(
<Demitar> Well my only experience with OODBs is ZODB really.
<moea> yay python. i've used atop/axiom, also python
<mflux> so what do you do when you need to add an attribute?
<mflux> write a conversion routine?
<Demitar> (python is of course the ideal language for something as flexible as an OODB)
<moea> mflux: yes, you update the schema-version attribute on the class, add the attribute, and then write a conversion routine to fill in the data for the already-persisted objects
<moea> at least, in my limited experience
<Demitar> And in the Zope case that would most likely reside in the objects class itself. :)
_JusSx_ has joined #ocaml
threeve has joined #ocaml
_JusSx__ has quit [Read error: 110 (Connection timed out)]
threeve has quit []
brx has joined #ocaml
ramkrsna_ has quit [Remote closed the connection]
brx_ has joined #ocaml
aegray has quit [Read error: 110 (Connection timed out)]
aegray has joined #ocaml
brx has quit [Connection timed out]
brx_ has quit [Read error: 110 (Connection timed out)]
exa has joined #ocaml
albertelegance has quit [Read error: 104 (Connection reset by peer)]
albertelegance has joined #ocaml
brx has joined #ocaml
gim_ is now known as gim
vezenchio has joined #ocaml
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
ulfdoz has quit [Remote closed the connection]
ulfdoz has joined #ocaml
brx has quit [Remote closed the connection]
brx has joined #ocaml
albertelegance has quit [Read error: 104 (Connection reset by peer)]
xre has joined #ocaml
khaladan has quit [Connection timed out]
xre has left #ocaml []
brx has quit [Read error: 110 (Connection timed out)]
brx has joined #ocaml
* exa is away: Away at the moment
exa is now known as exa_away
exa_away is now known as exa
albertelegance has joined #ocaml
exa has quit [Remote closed the connection]
exa has joined #ocaml
MisterC has quit [Remote closed the connection]
ion_bidon has joined #ocaml
<ion_bidon> hello, does ocaml have a function to print a structure ?
<mellum> ion_bidon: no.
<ion_bidon> mellum: ok thanks
<Smerdyakov> You can make 'em with camlp4.
<ion_bidon> Smerdyakov: ok:)
<smimou> there are some very basic functions in extlib for that though I think
<ion_bidon> ok
<ion_bidon> If I have a function "b" declared after a function "a", how can I call it from "a" ?
<Smerdyakov> Use mutually recursive function definitions.
<ion_bidon> great ok thanks
<Smerdyakov> Or re-order the functions, if "b"'s definition doesn't reference "a".
<ion_bidon> Smerdyakov: cool it works
mattam has quit [Read error: 104 (Connection reset by peer)]
Banana has quit [Read error: 104 (Connection reset by peer)]
Banana has joined #ocaml
mattam has joined #ocaml
cjohnson has joined #ocaml
Snark has quit ["Leaving"]
cmeme has quit [Network is unreachable]
<ulfdoz> Irgendwie ist das Blödsinn, wenn eine Funktion nur unit zurückgeben darf. :\
<ulfdoz> sry. wrong chan.
Oatly has joined #ocaml
Oatmeat has quit []
Oatly is now known as Oatmeat
Bigbang is now known as Bigb[a]ng
Skal has joined #ocaml
cjohnson has quit [""We live like penguins in the desert...""]
<Demitar> Anyone happend to have a small ipv6 expander?
* Demitar ponders pseudocode.
<Demitar> ::1 -> ::0001
<Demitar> :: -> missing number of :0:
<Demitar> :0: -> :0000:
<Demitar> s/://
<Demitar> And finally read the hex value.
<Demitar> Hrm.
<Demitar> :: -> missing number of :0:
<Demitar> Non-filled :<n>: groups -> pad with 0s
<Demitar> And the s/:// and decode the hex.
vodka-goo has quit []
<Demitar> Guess one also needs to convert any ipv4 adresses contained there to hex as well before doing anything else.
Schmurtz has joined #ocaml
exa has quit [Remote closed the connection]
_JusSx_ has quit [Read error: 104 (Connection reset by peer)]
zigong has joined #ocaml
mflux_ has joined #ocaml
mflux has quit [kornbluth.freenode.net irc.freenode.net]
ion_bidon has left #ocaml []
zigong has quit [Remote closed the connection]
Schmurtz has quit [Remote closed the connection]
smimou has quit ["bli"]