gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
hcarty_ has joined #ocaml
mehdid_ has joined #ocaml
asmanur_ has joined #ocaml
strlen_ has joined #ocaml
vk0_ has joined #ocaml
opla2 has joined #ocaml
asmanur has quit [*.net *.split]
Modius has quit [*.net *.split]
mehdid has quit [*.net *.split]
f[x] has quit [*.net *.split]
hcarty has quit [*.net *.split]
strlen has quit [*.net *.split]
vk0 has quit [*.net *.split]
mnabil_ has quit [Ping timeout: 272 seconds]
oriba has quit [Quit: Verlassend]
<lewis1711> humm, perhaps that bit of java I did has forever stunted my programming but... it's not really possible to do "type hiearchies", is it?
<orbitz> you can subclass in Ocaml
<orbitz> that's what hte 'o' in 'ocaml' is
<orbitz> Although many argue nominal subtyping is weaksauce
<lewis1711> I haven't even got to classes yet. I am still too busy having fun with types
<orbitz> i assume by type hierarchy you mean subclasses
<lewis1711> nah, more stuff like "type number = Int of int | Float of float | Error;;", from the manual
<orbitz> that is algebraic datatypes, not a heiarchy
<lewis1711> algebraic...datatypes...
* lewis1711 attempts to combine two familiar concepts
<lewis1711> already there dude
<orbitz> examples are in Haskell and Ocaml
<lewis1711> I can see why someone recommended that book on types
<orbitz> you can get pretty far with only minimal knowledge of types
<orbitz> you can do a lot of stuff with types, but IMO only a few concepts rae really useful
<lewis1711> I am tempted to draw an analogy to algebraic datatypes
<lewis1711> sorry
lamawithonel_ has quit [Read error: Connection reset by peer]
<lewis1711> algebraic structures
<orbitz> what do you mean?
lamawithonel_ has joined #ocaml
<lewis1711> orbitz: well a lot of the terminology is similar. I mean I can imagine say, constructing a monoid as an algebraic data type
<thelema_> lewis1711: there's a simple algebra of types built by union (sum) and tuple (product)
emmanuelux has quit [Ping timeout: 240 seconds]
opla2 has quit [Ping timeout: 260 seconds]
smerz has quit [Quit: Ex-Chat]
jonafan has quit [Read error: Connection reset by peer]
jonafan has joined #ocaml
raichoo1 has joined #ocaml
raichoo has quit [Ping timeout: 240 seconds]
tautologico has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
<lewis1711> ocaml = mind blown
Amorphous has quit [Ping timeout: 272 seconds]
<thelema_> lewis1711: ocaml = mind expanded
<lewis1711> there's only so much my poor mind can expand before it gets blown
Amorphous has joined #ocaml
<thelema_> there's only so much your mind can expand each time it gets blown
<lewis1711> deep:P
<thelema_> :)
thelema_ is now known as thelema
<lewis1711> http://paste.pocoo.org/show/309788/ trying to do a bit of string processing here. I know line 3 is horribly wrong, but for now, why the syntax error at line 4?
<thelema> no |
<thelema> I recommend you use one before every pattern, including the first
<lewis1711> haha whoops
tautologico has quit [Quit: tautologico]
opla2 has joined #ocaml
fabjan has quit [*.net *.split]
fabjan has joined #ocaml
jonafan has quit [Quit: Leaving]
alexyk has joined #ocaml
<alexyk> how do I print a (float list) using List.print?
<lewis1711> alexyk: List.map (fun x -> print_float x) list;;
<alexyk> kk
<lewis1711> that works:P dunno if that's the nicest way though since I've learnt ocaml for 3 days
<alexyk> lewis1711: I think then, List.map print_float is enough
<alexyk> point-free
<lewis1711> ..oh yeah
<lewis1711> lol
<alexyk> but, this mashes them all together
<lewis1711> (isn't quite sure why he made that a lambda)
<lewis1711> so it does
<alexyk> List.map (printf "%f ")
<alexyk> (after open Printf)
<lewis1711> good find
<alexyk> but, of course, this is not using List.print which is what I'm curious about :)
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
raichoo1 has quit [Quit: Leaving.]
thatch_ has joined #ocaml
<thatch_> I was using ocaml-tutorial.org in my attempts to learn ocaml, but it seems to be down! Where can I find ocaml-tutorial?
<lewis1711> not sure. it's been down for the past few days at least
<lewis1711> http://caml.inria.fr/pub/docs/oreilly-book/html/index.html I'm find this really nice anyway
<thatch_> Anyone have the contents? I could really use it :)
<thatch_> ahh, yes
<thatch_> Thanks, That should stave me off!
raichoo has joined #ocaml
raichoo has quit [Client Quit]
alexyk has joined #ocaml
<thelema> alexyk: List.print Float.print stdout float_list
alexyk has quit [Read error: Connection reset by peer]
<thelema> grr, just missed
<lewis1711> hmm
<lewis1711> List.map (printf "%f ") is still much nicer though.
<thelema> dunno, List.print by default puts [ at beginning, "; " between elements and ] at the end. And each of these is configurable via optional parameters
<thelema> also, List.map isn't what you want for unit functions.
<thelema> you want List.iter, as it doesn't build a new list of unit values
alexyk has joined #ocaml
<thelema> alexyk: List.print Float.print stdout float_list
<lewis1711> where is List.print anyway?
<thelema> Batteries
<alexyk> thelema: thanks!
<lewis1711> open batteries?
<thelema> you have to install it first, but yes
<thelema> alexyk: also, from gildor - oasis shouldn't have circular dependency on anything
<lewis1711> it's installed
<lewis1711> and no
<alexyk> thelema: so I tried Print.printf p"lookie here: %{float list}\n" [1.0;2.0;3.0];; in Batteries repl, and it worked; but compilation failed, p in p"..." is undefied
<thelema> using ocamlfind?
<thelema> alexyk: are you using ocamlfind to compile?
<alexyk> thelema: yes
<thelema> you have to enable the syntax extensions
<thelema> I think the arguments for that are: -syntax camlp4 -package batteries.syntax
<alexyk> thelema: ah, ok
<lewis1711> the arguments on what?
<thelema> lewis1711: on ocamlfind
<lewis1711> ah
<thelema> lewis1711: the ocaml compiler expects to be given paths to any libraries it needs. ocamlfind does this much easier than doing it by hand
<lewis1711> not sure what I'm ocamlfinding. I know where my battiers are
<lewis1711> ah
<alexyk> thelema: for gildor: oasis wants expect.pcre package, where does it come from?
<thelema> ocaml-expect
<thelema> (I think)
<alexyk> thelema: ocaml-expect wants oasis in its own configure!
<alexyk> just trying ocamlbuild fails there
<alexyk> this is what I tried yesterday
<thelema> no project should need oasis to compile - the setup.ml generated by oasis is independent
<lewis1711> reading the batteries included documenation is giving me a headache. nap-time!
<alexyk> thelema: in ocaml-expect, ocaml setup.ml -configure says: I: Running command 'OASIS setup-dev -run /opt/local/bin/ocaml setup.ml -configure'
<alexyk> its configure runs oasis every time
<thelema> lewis1711: sorry about that - suggestions on batteries docs are welcome
<alexyk> this is darcs
<thelema> don't use the darcs repo, use the release
<thelema> the release shouldn't depend on oasis
<alexyk> thelema: ah
<thelema> just like one doesn't need autoconf installed to use a ./configure script
<thelema> but one does need it installed to create the script from version control
ygrek has joined #ocaml
alexyk has quit [Quit: alexyk]
<lewis1711> thelema: hard to tell if the docs are an issue. I was also tired. just seems like a weird process for an ocaml newb
<lewis1711> just stuff like I don't know what "a findlib-enabled myocamlbuildml" is, not familiar with ocaml build, etc. I don't know if that's a documenation at all
<lewis1711> *a documentation issue at all
alexyk has joined #ocaml
thatch_ has quit [Quit: Page closed]
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
opla2 is now known as Squarism
alexyk has quit [Read error: Connection reset by peer]
<lewis1711> http://paste.pocoo.org/show/309822/ in the second function, why can't I do something like "Mult (Const, Const)" ?
alexyk has joined #ocaml
<alexyk> module S=Set.StringSet
<alexyk> let set_of_list = L.enum |- S.of_enum
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
almaisan-away is now known as al-maisan
alexyk has joined #ocaml
<gildor> alexyk: indeed, the darcs repository use the setup-dev mode (to regenerate what is needed when compiling), but the release is made independant
<alexyk> gildor: ok, will try!
<gildor> but once, you will have the 1st version of oasis compiled, you can switch to darcs repo, if you want
<gildor> and one day, there will be a binary installer for Mac ;-)
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
lars9 has joined #ocaml
<lars9> is functor in ocaml the same thing as in haskell?
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]
<lewis1711> http://paste.pocoo.org/show/309834/ ok, why does the command on line 19 not evaluate to "xy" as per the pattern on line 15? (I get the syntax must be wrong, but what's the right way)
alexyk has joined #ocaml
al-maisan is now known as almaisan-away
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
alexyk has quit [Quit: alexyk]
mehdid_ is now known as mehdid
lars9 has left #ocaml []
<lewis1711> oh....patterns are iterated through in order:
zhengli has joined #ocaml
ulfdoz has joined #ocaml
SquirrelFox has joined #ocaml
SquirrelFox has left #ocaml []
jamii_ has joined #ocaml
ftrvxmtrx has joined #ocaml
<jamii_> I dont understand make
<jamii_> Does anyone know why the ocamlgraph rule doesnt get triggered in http://scattered-thoughts.net/code/puzzle/liarliar/Makefile
SquirrelFox has joined #ocaml
<adrien> because the "all" rule depends on it
<jamii_> wait, im confused. it *doesnt* get triggered by 'all' because 'all' depends on it?
<adrien> oh, sorry, I hadn't seen your negation, bit early I guess =)
<jamii_> :)
<jamii_> this is what I get when I run it
<adrien> maybe because there is a folder named "ocamlgraph"
<jamii_> ah, do i need to change the name to stop it looking at the folder
<adrien> see "Phony target" at http://linuxgazette.net/issue83/heriyanto.html
<jamii_> awesome, it works. thanks
<jamii_> make is weird
<adrien> =)
Squarism has quit [Ping timeout: 240 seconds]
pdhborges has joined #ocaml
pdhborges has left #ocaml []
<adrien> on the forge, how can I get this (standard afaict) page layout for my project: http://batteries.forge.ocamlcore.org/ ? with project summary, latest news, downloads & docs...
mnabil_ has joined #ocaml
<adrien> gildor: btw, you might want to decrease the font size for the wiki plugin: https://forge.ocamlcore.org/plugins/mediawiki/wiki/yypkg/index.php/Main_Page
<gildor> adrien: there is no more this kind of autogeneration of default project page
<gildor> have a look at sources, if you can find where it was (is) located
<adrien> gildor: ok, thought it came from gforge only
<gildor> if you find it, I will enable it
<gildor> for the wiki, open a feature request against site admin + size you wish
<adrien> gildor: thanks, cloning in progress, I'll take a look at it once it's done, I think I'll copy-paste some page and edit it and I'll open the feature request after that =)
mnabil_ has quit [Ping timeout: 240 seconds]
lewis1711 has left #ocaml []
mrvn has joined #ocaml
<mrvn> moin.
<mrvn> What isbetter? class block (init_x : int) = object val x = init_x method get_x = x end;; or class block (x : int) = object method get_x = x end;;
<mbac_> nobody uses the object system :)
<mbac_> you've been tricked
<mrvn> I would use records if they had inheritance
<mbac_> good lord nobody has given you the inheritance is a poor way to model problems kool-aid yet
<jamii_> engineering is safer without koolaid
<jamii_> its all poisoned anyway
<mrvn> Ok, here is the problem: I have a journal on disk with fixed sized entries. Each entry has a checksum, a unique id, a type, some custom data depending on the type, a list of IDs that have finished since the last entry and a block of raw data.
<mbac_> :)
<mrvn> So I was thinking of having a base class that handles the common elements, reading, writing, checksumming and so on and subclasses for the type specific things.
<mrvn> I also need to maintain a hashtable or array of active transations.
<mbac_> type custom_data = Foo_type of string | Bar_type of int | Baz_type of buh ;; type entry = { checksum: int; id: int; custom_data: custom_data }
<mbac_> your problem suggests that modelling to me
<mrvn> mbac_: But then I have functions that work on entries but only one type of entries.
<mbac_> yes
<mbac_> this is a feature
<mrvn> That then requires: match custom_data with Foo_type s -> | _ -> assert false
<mbac_> right
<mrvn> ugly
<mbac_> i see
jamii_ has quit [Quit: Leaving]
<mbac_> imo this is something you don't want to abstract
<mbac_> you want to scatter case analyses everywhere and let the type system tell you if you missed one
<mrvn> With classes I can store the base class in the global array but bind to the specific classes in the functions handling only one type.
<mbac_> if matching all of those cases everywhere is something you want to abstract away then maybe you don't need the custom data type
<mrvn> Then I can't store all active transactions in one array.
<mrvn> or I need to store the type there
<mrvn> Which actualy might not be too bad: type array_entry = None | Type1 of type1 | Type2 of type2 ...
<mrvn> instead of entry option
<mrvn> But if I define a seperate record for every entry type then I need to duplicate the functions comon to each type.
<mbac_> right, that's why entry has a custom_data sub-type in my model :)
<mrvn> maybe type 'a entry = { checksum:int; id:int; custom:'a; }
<mbac_> same thing no?
<mbac_> you're just leaving much more open-ended with 'a
<mrvn> mbac_: n. YOu can't create an array of 'a entries with 'a being unbound.
<mbac_> yeah you're right
<mrvn> It then needs the type array_entry = None | Type1 of type1 entry | ...
<mrvn> But the more open type allows to define common function working on 'a entry and specific ones for type1 entry. I think would work.
<mbac_> i don't think it will
<mbac_> i think type unification will screw you
<mbac_> but i've been awake for 25+ hours stop listening to me :)
<mrvn> sure. fun get_id entry = entry.id == 'a entry -> int
<mrvn> hmm. problem though. I want a fun to_string entry = ... 'a entry -> string. That needs virtual methods to convert the 'a.
avsm has quit [Quit: Leaving.]
<mrvn> anyway, back to my initial questions. What way is better for classes?
<mrvn> Or are they equivalent?
Lajla is now known as We
We is now known as Lajla
pdhborges has joined #ocaml
<pdhborges> Hi everyone Merry Christmas
ikaros has joined #ocaml
lpereira has joined #ocaml
<thelema> mrvn: they're both close enough.
<mrvn> doesn't the second one use 2 blocks of memory?
ygrek has quit [Quit: Leaving]
<thelema> the second one uses a closure to hold x, while the first uses an object. I don't know which is more efficient.
<pdhborges> I need an opinion about the zmq bindings
<pdhborges> we can set some socket options
<pdhborges> but there is a type of socket with extra options
<pdhborges> in haskell
<pdhborges> the use parametric socket with type classes to constraint the tpe parameter
<pdhborges> in some functions
<pdhborges> for ocaml I'm planning to use phantom types
<pdhborges> do you guys have any other sugestion?
<mrvn> socket == Unix.file_descr?
<pdhborges> no
<pdhborges> it's a zero mq socket
<thelema> pdhborges: phantom types seem like a good way to handle type distinctions between fundamentally similar values
<mrvn> pdhborges: I suggest putting the phantom types in a submodule so they also work inside the module itself.
<pdhborges> okay today I'm going to chage the bindings
<pdhborges> my only grip with the panthom types is the wierd 'a parameter that I can't constraint further
<thelema> ? you can insist it be a subtype of a polymorphic variant, which is what most people do
<mrvn> pheredhel: the [> `READ]?
<pdhborges> thelema: never saw that before
<pdhborges> do you have an example?
<thelema> type 'a foo = bar constraint 'a = [< `Read | `Write]
<pdhborges> O.O
<pdhborges> in tht case how do I use the type constructor>
<pdhborges> ?
raichoo has joined #ocaml
<mrvn> well, you just do
<pdhborges> but is there a way to do the following
<mrvn> Do you really need to constrain the type? That would prevent someone from extending it to have more phantom types.
<pdhborges> creat_scoket `Read : returning `Read foo?
<pdhborges> mrvn: the socket types are very stable
<mrvn> pdhborges: the users code isn't
<mrvn> creat_scoket : [< `Read | `Write] as 'a -> 'a socket?
<mrvn> Although that would allow creating a read-only socket with read/write type.
<mrvn> You should have a create_read_socket : unit -> `Read socket and a normal create_socket.
<mrvn> Unless you define values read and write and use those as argument.
ikaros has quit [Ping timeout: 240 seconds]
pdhborges has quit [Quit: pdhborges]
pdhborges has joined #ocaml
<pdhborges> mrvn
<pdhborges> ups
<pdhborges> I have the values read and write to use as argumets
<pdhborges> arguments*
ikaros has joined #ocaml
<mrvn> The problem with the constraint is that you can't extend it, e.g.: type 'a my_socket = 'a X.socket constraint 'a = [ `Read | `Write | `Accept ]
<mrvn> val bind : [> `Read ] my_socket -> int -> [> `Read | `Accept ] my_socket
<mrvn> or similar.
boscop has joined #ocaml
pdhborges has quit [Quit: pdhborges]
brendan has quit [Ping timeout: 240 seconds]
oriba has joined #ocaml
<mrvn> Question about singleton modules. Do you write let x = ref 0 let y = ref 0 let z = ref 0 or type t = { mutable x : int; mutable y : int; mutable z : int; } let me = { x = 0; y = 0; z = 0; }?
<thelema> if I want to marshal the whole structure , I use the second, else the first
<mrvn> marshaling is clear. but why the first otherwise?
pdhborges has joined #ocaml
brendan has joined #ocaml
emmanuelux has joined #ocaml
<thelema> !M.x vs. M.me.M.x
<mrvn> thelema: private values. So no problem there.
<mrvn> or M.get_x ()
<pdhborges> mrvn that's it!
<pdhborges> except I won't use another type
<pdhborges> the native function will return 'a scoket;;
<pdhborges> the create function signature will just match 'a with the polymorphic variant passed as an argument
<mrvn> What type is your "read" value then?
<thelema> mrvn: if everything's hidden behind a wall of abstraction, the single record is better for cache locality (assuming what's in the record benefits from such)
<mrvn> thelema: yeah, and uses less ram since there isn't a reference for every value but just ne record for all.
<mrvn> Other than the M.me.M.x I don't see any drawback in the record.
<thelema> a bit less ram - that's probably not in the 3% of useful optimizations
<mrvn> thelema: hehe. Might make a difference though as it can put the pointer to the record in a register and then access all values thorugh that. With individual refs it has to dereference each in turn.
<pdhborges> mrvn: I wanted something like this
<pdhborges> except socket does not have a type constructor
<mrvn> pdhborges: but then how do you declare the read value?
<pdhborges> because it is returned by a native method?
<pdhborges> mrvn: sry but I'm newbie. What is a read value?
<mrvn> the value you pass as socket_type.
<pdhborges> that value is `Read
<mrvn> let read = (`Read : [`Read]);;?
<mrvn> or should users write `Read verbatim?
<pdhborges> `Reav verbatim
<pdhborges> I thought `Read could be unified with 'a
Fullma has joined #ocaml
<thelema> mrvn: deref + offset might be more work than deref, and one can't as easily apply a function (ala [incr]) to a single ref
<thelema> pdhborges: it can.
<mrvn> thelema: me.x + me.y + me.z, put me in R0, add 0(R0) + 8(R0) + 12(R0).
<mrvn> thelema: With single refs you need to load the address of each into a register.
<thelema> true, but you can't have a list of only some of the refs and other wierd things
<mrvn> pdhborges: I can't get the readwrite to work there.
<mrvn> With the 'a mode I could have the readwrite of type [`Read | `Write] mode. Doesn't seem to work without.
<pdhborges> mrvn exactly
<pdhborges> I can't even compile create
<pdhborges> but your solution with mode works
nejimban has quit [Ping timeout: 250 seconds]
<pdhborges> a now I understand your solution with mode
smerz has joined #ocaml
<pdhborges> I still don't understand why this won't compile
<pdhborges> let lp a : ([< `Read | `Write] as 'a) -> 'a list = [a];;
<pdhborges> if a is Read | Write or Less
<mrvn> let lp a : 'a. ([< `Read | `Write] as 'a) -> 'a list = [a];; ?
<mrvn> +()
<pdhborges> + (0
<pdhborges> ?
<mrvn> let lp a : ('a. ([< `Read | `Write] as 'a) -> 'a list) = [a];;
<pdhborges> a
<pdhborges> yeah sorta
<pdhborges> but it won't compile
<pdhborges> :(
<mrvn> 'a. needs caml 3.12 iirc
ikaros has quit [Ping timeout: 240 seconds]
<pdhborges> I'm using caml 3.12
<pdhborges> I get a syntax error
<pdhborges> val create : ([< `Read | `Write ] as 'a) mode -> 'a socket works
<mrvn> let (lp : 'a. ([< `Read | `Write] as 'a) -> 'a list) = function a -> [a];;? Only have 3.11 here
<pdhborges> mrvn that works on 3.11?
<mrvn> no.
<mrvn> But 3.11 doesn't have the 'a. for functions anyway.
<pdhborges> there is a parenthesis missing somewhere
<pdhborges> But why does this work val create : ([< `Read | `Write ] as 'a) mode -> 'a socket
<pdhborges> 'a is unified across both 'a mode and 'a socket
<mrvn> # let lp (a : [< `Read | `Write] as 'a) = ([a] : 'a list);;
<mrvn> val lp : ([< `Read | `Write ] as 'a) -> 'a list = <fun>
<mrvn> specifying the signature of function always sucks.
<pdhborges> lol
<pdhborges> bah I was trying to use scala's syntax
<pdhborges> that why it didn't work
<pdhborges> XD
<pdhborges> no no
<pdhborges> actually I thought let a x : int -> int <=> let (a x) : int -> int
<mrvn> # let (lp q) ([< `Read | `Write ] as 'a) -> 'a list = [a];;
<mrvn> Syntax error: ')' expected, the highlighted '(' might be unmatched
<mrvn> which is also a syntax error
<mrvn> You can only give a type for the lp or the a but not (lp a)
lpereira has quit [Ping timeout: 240 seconds]
nejimban has joined #ocaml
f[x] has joined #ocaml
<pdhborges> mrvn: got it now it looks exactly like I wanted
<mrvn> The classic 5m to write, 55m to fix types split.
almaisan-away is now known as al-maisan
<pdhborges> What do you think?
somnium has joined #ocaml
jm_ocaml has joined #ocaml
<pdhborges> with this strategy the is no way to garantee that 'a is only one of `Read or `Write
<pdhborges> correct?
vk0_ has quit [Ping timeout: 264 seconds]
vk0 has joined #ocaml
<mrvn> # let b = create `Read;;
<mrvn> val b : _[< `Read | `Write > `Read ] socket = Bar
<mrvn> looks fine.
<mrvn> val create : ([< `Read | `Write ] as 'a) -> 'a socket = <fun>
<mrvn> create only accepts `Read or `Write or a combination (which you can't create).
<mrvn> # create `Foo;;
<mrvn> Error: This expression has type [> `Foo ] but an expression was expected of type [< `Read | `Write ] The second variant type does not allow tag(s) `Foo
<mrvn> Looks like you have exactly the restriction you want.
<mrvn> anyway, dinner is calling.
<pdhborges> thanks for your help!
<pdhborges> mrvn
nejimban has quit [Ping timeout: 276 seconds]
nejimban has joined #ocaml
al-maisan is now known as almaisan-away
<thelema> hmm, how can batteries installation be this easy: curl -L cpanmin.us | perl - http://latest.mojolicio.us
notk0 has joined #ocaml
<notk0> hello, I am having some trouble initiating parametrized records
<thelema> notk0: can you pastebin your failing code?
<notk0> like type 'a =sometype* 'a
<notk0> thelema, what is the correct way of initializing it?
<thelema> sometype*?
<notk0> I think I am doing it wrong
<notk0> thelema, sometype like type vect={x:float;y:float;z:float;}
<notk0> for example
<thelema> type 'a foo = {label: string; value: 'a}
<notk0> thelema, in my case its type 'a foo=bar * 'a
<notk0> and I can't seem to create one
<thelema> that's the syntax for a 2-tuple (pair)
<notk0> let f=(foo,3) should work right?
<thelema> yes
<notk0> hm let me try again
<thelema> you don't need to pre-declare types for tuples, the compiler can infer these types
pdhborges has quit [Quit: pdhborges]
<notk0> this seems strange, I am inside emacs and I open another module named Objects and I can create types from ther
<notk0> but when I call a function it says Reference to undefined global `Objects'
<notk0> hm
<notk0> but if I call it with incorrect data types it tells me how to call it correctly, if I call it correctly it fails
<thelema> it usually helps if you pastebin some of your code.
<notk0> thelema, I got it, I had to do #load "objects.cma"
<notk0> I though it does not need that, since it already recognized the types
<thelema> ah, toplevel.
<notk0> failwith halts the execution right?
<notk0> I mean it's name is kinda intuitive
<thelema> it raises the exception "Failure"
pdhborges has joined #ocaml
<notk0> thelema, allright then :P
<thelema> notk0: if you want to exit, use [exit] : int -> 'a
<notk0> thelema, well an exception that is not treated halts the execution right?
<thelema> yes, uncaught exceptions print an error if they hit the runtime
<thelema> s/if they hit the runtime//
alexyk has joined #ocaml
alexyk has quit [Client Quit]
Anarchos has joined #ocaml
<hcarty_> thelema: Pre-installed OCaml + oasis-db may make a Batteries install that easy.
<thelema> hcarty_: I hope so.
<hcarty_> thelema: Or possibly using a Perl-based installation script to build OCaml + Batteries
hcarty_ is now known as hcarty
<hcarty> thelema: It would be nice to make the process that simple
pdhborges has quit [Quit: pdhborges]
jm_ocaml has quit [Ping timeout: 250 seconds]
yougane has joined #ocaml
init1 has joined #ocaml
smerz has quit [Remote host closed the connection]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
jm_ocaml has joined #ocaml
<notk0> you have to use ;; only in the interpretor right? but it does not mess anything if you compile a file?
SquirrelFox has quit [Quit: Leaving.]
opla2 has joined #ocaml
notk0 has quit [Quit: Leaving]
Anarchos has quit [Read error: Operation timed out]
opla2 has quit [Ping timeout: 272 seconds]
opla2 has joined #ocaml
opla2 has quit [Ping timeout: 272 seconds]
<adrien> gildor: what are you using (or planning to use) to support multiple SCM in the oasis tools?
dskippy has joined #ocaml
smerz has joined #ocaml
ikaros has joined #ocaml
<oriba> hmhh, how can I get a hashtbl created in OOP style? I get an error message from the compiler: syntax error....
gildor has quit [Ping timeout: 255 seconds]
<oriba> let (ht2: (string, subvar) Hashtbl.t) = Hashtbl.create 10
<oriba> this works on toplevel
<oriba> val (subvar_hash:(string, subvar) Hashtbl.t) = Hashtbl.create 100
<oriba> this does not work
<oriba> do I have to use thge initializer-keyword?
<adrien> what do you call "oop-style" exactly?
<oriba> I want just that value to be defined
<oriba> and then call Hashtbl.create
<oriba> I get no type error, but syntax error!
gildor has joined #ocaml
<adrien> why not "let"?
<oriba> I tried
<oriba> hmhh
<oriba> do I have to use "initializer" for let?
<oriba> initializer does not help
<oriba> hmhh
<oriba> and without it also does not work
<oriba> I always get syntax error
<adrien> ah, I had misunderstood
<oriba> it seems, "let" can't be used inside an object definition
<oriba> and I want the hashtbl to be included in the class/object
<flux> class foo = let h : (int, int) Hashtbl.t = Hashtbl.create 1024 in object val h = h end ?
<oriba> maybe I could give it as class-param?
<oriba> hmhh
<adrien> actually it looks like it's simply the outer parens
<adrien> (for the syntax error)
<flux> if you must use let that is
<flux> otherwise you can just do class foo = object val h : (int, int) Hahstbl.t = Hashtbl.create 1024 end
<oriba> ah... you have the "let" outside of "object ... end!!
<flux> yes
<oriba> it seems that was my fault...
<flux> and I defined the type because I have no other code to infer the type by
<oriba> but the let is local to the object?
<flux> yes
<oriba> each instancitaed separately?
<flux> actually, no in this case!
<oriba> hmh
<flux> you need class foo () = .. in that case
<oriba> that would be a hash on all objects
<flux> I've found the separation of functions and classes a bit weird anyway
<flux> class is almost like a function that can only return an object
avsm has joined #ocaml
<oriba> hmhh ... so how to make that now?
<flux> so what do you want?
<oriba> ah...
<flux> you want it to be shared or you don't want it to be shared?
<oriba> really, throwing away the outer ( and ) around the value-definition, then it works
<oriba> hmhhh
<oriba> I found that with let I have to use e.g. let (x:int) = 44;;
<oriba> but in the object def it does not work this way...?!
<flux> hm?
<oriba> adrien mentione dthe outer parens
<oriba> and he was right
<oriba> strange
<flux> in objects you typically define object-scoped values with 'val'
<adrien> I have no idea why they are an issue however, doubt it's by design
<flux> values with 'val' can be used by inherited classes as well, which makes them different from 'let' values
<oriba> hmh
<oriba> but the definition of types should be the same...?!
<flux> what?
<oriba> I mean the syntax has a problem because of the parens?!
<flux> oh, I haven't actually used the syntax you used
<flux> I've always used it like: let x : int = 44
<flux> I guess the difference might be that 'let' is pattern matching but 'var' isn't
<oriba> hmhh, letting away the outer parens at least also works with let
<flux> that's my guess :)
<oriba> ah, I hate this type-constrain-syntax...
<oriba> for int I also do not use the type coinstraint.... of course
<oriba> but for things like hastbl it sometimes helps
<flux> keep on trying it out, I'm off to sleep :)
<oriba> haha
<oriba> good bight, flux
<oriba> night
<oriba> this now works: val subvar_hash:(string, subvar) Hashtbl.t = Hashtbl.create 100
<flux> if you must use parents, you can use it like: let x = (44:int) :-)
<flux> (..one final comment, now I'm really off..)
<flux> (parens or parenthesis, even, not parents)
<oriba> panties?
opla2 has joined #ocaml
opla2 has quit [Ping timeout: 276 seconds]
opla2 has joined #ocaml
yougane is now known as youscef
<mrvn> oriba: If you don't have any other code that infers the type you can also leave it as polymorphic.
<mrvn> Module/link question: There already is a ocaml-sha package providing the Sha1/Sha256/Sha512 modules with the same interface as Digest (hash a string). I want/need an interface with Bigarray instead of string now.
<mrvn> How do I write this so that people that don't use bigarrays don't need to link in bigarray?
<mrvn> Can I do some magic so it uses a different flavour when bigarrays are used like threads do?
almaisan-away is now known as al-maisan
joko has quit [Quit: leaving]
al-maisan is now known as almaisan-away
jm_ocaml has quit [Ping timeout: 276 seconds]
init1 has quit [Quit: Quitte]
<gildor> adrien: I am not sure to understand your question about SCM and oasis
<gildor> adrien: you can already say that you use darcs/hg/git/svn/CVS/bzr, isn't it enough ?
ikaros has quit [Quit: Leave the magic to Houdini]
<gildor> adrien: SCM in oasis is mostly a declaration (like homepage), made readable for computer
<adrien> gildor: it's mostly curiosity: I saw something that provides a unified interface to various SCMs (pull, push, commit... so much more than what oasis needs) and was wondering what was needed and what you were using in oasis
<adrien> now, thinking about it, I could have opened the source :p
<gildor> adrien: there is mr that deals with this kind of thing
dskippy1 has joined #ocaml
dskippy has quit [Read error: Connection reset by peer]
<gildor> and in the protype (on my computer) of oasis-db you have, it displas "git checkout URL" on the webpage
dskippy1 has quit [Read error: Connection reset by peer]
dskippy has joined #ocaml
youscef has quit [Quit: Quitte]
lewis1711 has joined #ocaml
opla2 has quit [Ping timeout: 240 seconds]
dskippy1 has joined #ocaml
dskippy has quit [Read error: Connection reset by peer]
<oriba> hmhh, how can I realize different kinds of "new"?
<oriba> I want do initialization in different ways
<oriba> with optional arguments in the class definition?
<oriba> ...hmhh or are there no optional args for classes possible?
dskippy has joined #ocaml
dskippy1 has quit [Read error: Connection reset by peer]
opla2 has joined #ocaml