<
Riastradh>
How do I get ocamldoc to recognise type constructors defined elsewhere when generating documentation from a .mli file?
mattam has quit ["leaving"]
* Riastradh
neverminds.
Kinners has joined #ocaml
platypus_ has joined #ocaml
platypus has quit [Read error: 113 (No route to host)]
platypus__ has joined #ocaml
platypus_ has quit [Read error: 113 (No route to host)]
polin8 has left #ocaml []
lament has joined #ocaml
lament has left #ocaml []
polin8 has joined #ocaml
lament has joined #ocaml
TimFreeman has joined #ocaml
TimFreeman has left #ocaml []
Kinners has quit [Read error: 104 (Connection reset by peer)]
mattam has joined #ocaml
lament has quit ["I AM NOT A MENSA MEMBER"]
jao|zZzZ has quit ["leaving"]
foxster has quit []
TachYon26 has joined #ocaml
lowks has quit [calvino.freenode.net irc.freenode.net]
platypus__ has quit [calvino.freenode.net irc.freenode.net]
lowks has joined #ocaml
platypus__ has joined #ocaml
foxster has joined #ocaml
Zadeh has joined #ocaml
giedi has joined #ocaml
lowks_ has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
lowks has quit [Connection timed out]
foxster has joined #ocaml
__DL__ has joined #ocaml
platypus_ has joined #ocaml
det has joined #ocaml
<
det>
I am trying to make a function to compue the cross product of a 2d vector, I have: let cross (x, y) = (y, -.x);;
<
det>
but the type is: val cross : float * 'a -> 'a * float
platypus__ has quit [Read error: 113 (No route to host)]
<
det>
when I want float * float -> float * float
<
det>
Is there a way better to do this without specifying the type ?
<
det>
should I be using a record ?
<
mattam>
annotate it if you prefer
<
mattam>
but there is no other way
<
det>
annotate means to specify the type?
<
mattam>
it'll be necessary, unless you do something float-specific with y
<
det>
I was wondering if I could just create some kind of constructor and do like
<
det>
let cross (x,y) = vector2(y, -.x)
<
det>
where ocaml knows vector2 always take 2 floats
<
mattam>
but then the type's in vector2 decl
<
det>
how would I create that kind of constructor? type blah = Vector2 of float * float ?
<
det>
can records share field names ?
<
Riastradh>
Is it possible to have mutually recursive modules?
<
mattam>
det: they can, but there are issues for constructing and accessing
<
det>
how can I be explicit about what kind if record I want to construct
<
det>
({x:1; y:2}: vector2) ?
<
mattam>
doesn't work
<
mattam>
write a function to build them
<
mattam>
Riastradh: I don't think so
<
det>
what I really want is something like: let cross Vector2(x, y) = Vector2(y, -.x);;
<
det>
is that possible to do somehow ?
Riastradh has quit [Killed (NickServ (Ghost: _Riastradh!~riastradh@pool-151-203-193-156.bos.east.verizon.net))]
<
det>
type vector2 = float * float;;
Riastradh has joined #ocaml
<
mattam>
you can have:
<
mattam>
type vector2 = Vector2 of float * float
<
det>
mattam: and for cross ?
<
mattam>
let cross v = match v with Vector2 (x,y) -> Vector2(y, -?x) | _ -> failwith...
<
platypus_>
is ocaml gpl ?
<
det>
platypus_: no
<
mattam>
if you have a constructor, you need to deconstruct
<
det>
platypus_: $15 student license
<
det>
platypus_: i mean, it's free
<
det>
mattam: is it meaningful to say: type vector2 = float * float;;
<
det>
the compiler accepts it
<
det>
but I dont understand how you could use such a type
<
Riastradh>
Use it just as an ordinary tuple.
<
mattam>
let cross ((x,y) : vector2) = (y, -.x)
<
mattam>
then cross is vector2 -> vector2
<
det>
mattam: ahh!, perfect
<
det>
mattam: thanks much
<
mattam>
platypus_: the compiler is under QPL and the library under GPL
det_ has joined #ocaml
<
mattam>
modified LGPL even
det has quit ["ircII EPIC4-1.1.2 -- Are we there yet?"]
<
det_>
ISP bumped me :/
det_ is now known as det
* Riastradh
is getting an odd syntax error.
<
det>
let cross (x,y):vector2 = y, -.x;;
<
det>
val cross : float * float -> vector2
<
Riastradh>
Would anyone mind if I pasted about ten lines into here?
<
det>
Riastradh: 20 cents a line
* Riastradh
bahs at det.
<
det>
mattam: was that the cross code you typed ?
<
det>
terminal died with internet
<
Riastradh>
...and this paste won't be a big flood, either -- I'll type it in slowly.
<
det>
ill start a tab
<
Riastradh>
let make dim_x dim_y f =
<
Riastradh>
let b = Array.make_matrix dim_x dim_y in
<
Riastradh>
for i = 0 to dim_x do
<
Riastradh>
for j = 0 to dim_y do
<
Riastradh>
b.(i).(j) <- f i j
<
Riastradh>
It claims that last 'b' is a syntax error.
<
det>
Riastradh: 2 character indentation is for lisp weenies
* Riastradh
is a Scheme weenie -- doesn't that count?
<
det>
of course it does
<
det>
that's much worse
<
Riastradh>
And anyways, it's just what the Tuareg mode does by default.
<
Riastradh>
Why's it worse?
<
det>
if dash was here, he'd hit you on the head with the club of non-linear continuations
<
Riastradh>
Non-linear continuations?
docelic|sleepo is now known as docelic|away
<
det>
you see, not only will it hit you, it may travel into the past and hit you as many times as he pleases
<
Riastradh>
Are they multishot continuations?
<
Riastradh>
And, er, what's wrong with them?
<
det>
something about implementation, I dont know :p
<
mattam>
Riastradh: done;
<
Riastradh>
mattam - For both of them?
<
mattam>
no, just when there is a sequence
<
Riastradh>
Or just the last one?
systems has joined #ocaml
* det
concedes and decides to just use anootated tuples :/
<
Riastradh>
ocamldoc is complaining of unbound record labels, which I've defined in other files...how do I, um, fix this?
det has quit ["TE) (Swing them udders"]
systems has quit [Read error: 110 (Connection timed out)]
docelic|away is now known as docelic
Vincenz has joined #ocaml
mattam_ has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
<
Vincenz>
is it possible to use a sumtype with one of the types having as constructor a struct?
<
Vincenz>
type mino = {name : int};;
<
Vincenz>
type plop = Ploot | Plop of mino;;
<
Vincenz>
type plop = Ploot | Plop of {name : int};; doesn't
<
Vincenz>
any idea why?
<
Vincenz>
I'm porting this .sml file to ocaml
<
Vincenz>
and in sml it seems to be allowed
<
Vincenz>
buy ocaml won't take it
docelic is now known as docelic|away
taw has joined #ocaml
<
Zadeh>
Vincenz: why porting?
<
Vincenz>
euhm...because I'm following this book for compiler construction in ml
<
Vincenz>
and some of the code, namely the definitions of the ast came in sml
<
Vincenz>
so I don't have to retype it all
<
Zadeh>
Is it the Appel book?
<
Zadeh>
how ya like it? I've wanted to check it out
<
Vincenz>
it's good :)
<
Vincenz>
do you know why the thing won't work?
<
Zadeh>
I don't know. I'm still an ocaml newb myself. :)
* Vincenz
snaps his fingers
TachYon26 has quit ["bez ki³y nie ma zaliczenia (z prawd studentek AM)"]
* Vincenz
mutters as he realizes he'll have to implement a big part himself
platypus_ has quit [calvino.freenode.net irc.freenode.net]
platypus_ has joined #ocaml
lus|wazze has joined #ocaml
<
Vincenz>
make that re-implement
<
Vincenz>
anyone know how to work with Hashtbl's ?
<
Riastradh>
Is the documentation in the OCaml reference manual insufficient?
<
taw>
as a side note, yes it is
<
taw>
they don't work like in other languages, so they should be documented better :)
<
Riastradh>
Who cares about implementation if you just want to use them?
<
taw>
interfacewise they don't
<
Riastradh>
How so?
<
taw>
ocaml has multivalued hashes, normal languages tave singlevalued hashes
<
taw>
and documentation says that iterating multivalue hash gives unspecified order or something
<
Riastradh>
It only says that the order in which the function to which 'iter' and 'fold' were applied is applied is unspecified.
<
taw>
yeah, that's what i'm saying :)
<
taw>
that makes it impossible to do something map-like on multivalued hashtables
<
taw>
what would otherwise be very nice feature
<
Riastradh>
Something map-like?
<
Riastradh>
Like the List.map function?
systems has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]
<
Vincenz>
module Table = Map(struct type t = symbol
<
Vincenz>
let compare (s1,n1) (s2,n2) = n1 - n2 end)
<
Vincenz>
never mind
<
Vincenz>
compile error :(
<
Vincenz>
basically I want a map
<
Vincenz>
that given a symbol
<
Vincenz>
(where a symbol is string*int)
<
Vincenz>
will compare and order the tree based on the int
<
taw>
how to find from what place in source code does exception come ?
<
Vincenz>
I know where the error is, I just can't decipher it
<
taw>
i'm getting some Not_found but can't find where they come from
<
taw>
ok, next question :)
<
taw>
anything that works like perl's pack/unpack ?
<
taw>
i have int array and need stream of reversed endian 16-bit values :)
giedi has joined #ocaml
<
Vincenz>
I have an .mli file that defines a module type TIGERSYMBOL
<
Vincenz>
and then I have an ml file
<
Vincenz>
module TigerSymbol : TIGERSYMBOL
<
Vincenz>
it complains it can't find TIGERSYMBOL
* Riastradh
had this problem, too, a while ago, but he forgot what the solution was.
<
taw>
does it open that .mli ?
<
taw>
it doesn't do it automaticaly even if they have the same name
systems has quit ["Client Exiting"]
giedi has quit [Read error: 104 (Connection reset by peer)]
giedi has joined #ocaml
<
Vincenz>
Riastradh: no recollection at all?
giedi has quit [Read error: 104 (Connection reset by peer)]
<
Vincenz>
was it something complicated or something simple?
giedi has joined #ocaml
giedi has quit [Read error: 54 (Connection reset by peer)]
Vincenz has quit ["movie"]
giedi has joined #ocaml
jao has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]
stefp has quit [Read error: 110 (Connection timed out)]
stefp has joined #ocaml
giedi has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]
giedi has joined #ocaml
<
taw>
i want to do deep print in ocamldebug
<
taw>
but it stops pretty quick
<
taw>
and replaces everything with ...
<
taw>
how can i tell it to increase it's limits ?
<
taw>
something like 10x more than it has now ?
giedi has quit [Read error: 104 (Connection reset by peer)]
giedi has joined #ocaml
mattam_ is now known as mattam
foxster has quit [Read error: 104 (Connection reset by peer)]
pattern_ has quit [calvino.freenode.net irc.freenode.net]
Smerdyakov has quit [calvino.freenode.net irc.freenode.net]
asqui has quit [calvino.freenode.net irc.freenode.net]
gl has quit [calvino.freenode.net irc.freenode.net]
lam has quit [calvino.freenode.net irc.freenode.net]
stefp has quit [calvino.freenode.net irc.freenode.net]
docelic|away has quit [calvino.freenode.net irc.freenode.net]
skimpIzu has quit [calvino.freenode.net irc.freenode.net]
liyang has quit [calvino.freenode.net irc.freenode.net]
platypus_ has quit [calvino.freenode.net irc.freenode.net]
giedi has quit [calvino.freenode.net irc.freenode.net]
Riastradh has quit [calvino.freenode.net irc.freenode.net]
lowks_ has quit [calvino.freenode.net irc.freenode.net]
wax- has quit [calvino.freenode.net irc.freenode.net]
phubuh has quit [calvino.freenode.net irc.freenode.net]
smkl has quit [calvino.freenode.net irc.freenode.net]
rox has quit [calvino.freenode.net irc.freenode.net]
jao has quit [calvino.freenode.net irc.freenode.net]
lus|wazze has quit [calvino.freenode.net irc.freenode.net]
taw has quit [calvino.freenode.net irc.freenode.net]
Zadeh has quit [calvino.freenode.net irc.freenode.net]
polin8 has quit [calvino.freenode.net irc.freenode.net]
pnou has quit [calvino.freenode.net irc.freenode.net]
lsr has quit [calvino.freenode.net irc.freenode.net]
giedi has joined #ocaml
stefp has joined #ocaml
jao has joined #ocaml
lus|wazze has joined #ocaml
platypus_ has joined #ocaml
taw has joined #ocaml
Riastradh has joined #ocaml
lowks_ has joined #ocaml
Zadeh has joined #ocaml
polin8 has joined #ocaml
Smerdyakov has joined #ocaml
docelic|away has joined #ocaml
wax- has joined #ocaml
pnou has joined #ocaml
smkl has joined #ocaml
skimpIzu has joined #ocaml
pattern_ has joined #ocaml
rox has joined #ocaml
asqui has joined #ocaml
phubuh has joined #ocaml
lsr has joined #ocaml
liyang has joined #ocaml
lam has joined #ocaml
gl has joined #ocaml
asqui has quit [Excess Flood]
asqui has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]
giedi has joined #ocaml
giedi has quit [Read error: 54 (Connection reset by peer)]
foxster has joined #ocaml
giedi has joined #ocaml
systems has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]
foxster has quit [Read error: 104 (Connection reset by peer)]
systems has left #ocaml []
giedi has joined #ocaml
giedi has quit [Read error: 54 (Connection reset by peer)]
giedi has joined #ocaml
giedi has quit [Read error: 104 (Connection reset by peer)]