<Enveigler_>
Is someting like let g = (Gdk.Rectangle) in let ( x, y, width, height ) = map g, [x,y,width, height] in ...
<Enveigler_>
possible?
<TeXitoi>
I don't think, but I don't know the object model, so I can be wrong
<Enveigler_>
Hmm. I /thought/ that this was a general syntax question rather than a matter applicable to a specific class or data structure. It just seems tehre ought to be a more general way of accessing a bunch of members that binding each one in a separate let statement. or even using the full name explicitly for each member in let ( v1,v2,v3) = ( e1, e2, e3 ) in ...
<Demitar>
Define a function?
cjohnson has quit ["KVIrc 3.2.0 'Realia'"]
Enveigler has joined #ocaml
<Enveigler>
Is #ocaml archived anywhere?
Enveigler_ has quit [Read error: 110 (Connection timed out)]
<Demitar>
I seem to recall that but I don't know where.
Smerdyakov has joined #ocaml
TeXitoi has quit [brown.freenode.net irc.freenode.net]
pattern_ has quit [brown.freenode.net irc.freenode.net]
TaXules has quit [brown.freenode.net irc.freenode.net]
mrvn has quit [brown.freenode.net irc.freenode.net]
dan2 has quit [brown.freenode.net irc.freenode.net]
Demitar has quit [brown.freenode.net irc.freenode.net]
cognominal has quit [brown.freenode.net irc.freenode.net]
mrsolo has quit [brown.freenode.net irc.freenode.net]
pango has quit [brown.freenode.net irc.freenode.net]
skylan has quit [brown.freenode.net irc.freenode.net]
vincenz has quit [brown.freenode.net irc.freenode.net]
Hadaka has quit [brown.freenode.net irc.freenode.net]
whee has quit [brown.freenode.net irc.freenode.net]
johs has quit [brown.freenode.net irc.freenode.net]
det has quit [brown.freenode.net irc.freenode.net]
_shawn has quit [brown.freenode.net irc.freenode.net]
batdog has quit [brown.freenode.net irc.freenode.net]
noj has quit [brown.freenode.net irc.freenode.net]
Enveigler has quit [brown.freenode.net irc.freenode.net]
mflux_ has quit [brown.freenode.net irc.freenode.net]
joo_ has quit [brown.freenode.net irc.freenode.net]
slashvar[lri] has quit [brown.freenode.net irc.freenode.net]
rox has quit [brown.freenode.net irc.freenode.net]
Smerdyakov has quit [brown.freenode.net irc.freenode.net]
ulfdoz_ has quit [brown.freenode.net irc.freenode.net]
cmeme has quit [brown.freenode.net irc.freenode.net]
mattam has quit [brown.freenode.net irc.freenode.net]
Hipo has quit [brown.freenode.net irc.freenode.net]
_fab has quit [brown.freenode.net irc.freenode.net]
Herrchen has quit [brown.freenode.net irc.freenode.net]
Banana has quit [brown.freenode.net irc.freenode.net]
rossberg has quit [brown.freenode.net irc.freenode.net]
raboof has quit [brown.freenode.net irc.freenode.net]
calvin_ has quit [brown.freenode.net irc.freenode.net]
fab_ has joined #ocaml
Smerdyakov has joined #ocaml
Enveigler has joined #ocaml
mrsolo has joined #ocaml
TeXitoi has joined #ocaml
slashvar[lri] has joined #ocaml
pango has joined #ocaml
mrvn has joined #ocaml
Herrchen has joined #ocaml
ulfdoz_ has joined #ocaml
_shawn has joined #ocaml
dan2 has joined #ocaml
Demitar has joined #ocaml
skylan has joined #ocaml
vincenz has joined #ocaml
cmeme has joined #ocaml
Hadaka has joined #ocaml
pattern_ has joined #ocaml
whee has joined #ocaml
cognominal has joined #ocaml
johs has joined #ocaml
raboof has joined #ocaml
rox has joined #ocaml
TaXules has joined #ocaml
det has joined #ocaml
Hipo has joined #ocaml
calvin_ has joined #ocaml
Banana has joined #ocaml
batdog has joined #ocaml
noj has joined #ocaml
joo_ has joined #ocaml
mflux_ has joined #ocaml
mattam has joined #ocaml
rossberg has joined #ocaml
Smerdyakov has quit ["igo"]
mauke has quit [Remote closed the connection]
Enveigler has quit [Read error: 104 (Connection reset by peer)]
Enveigler_ has joined #ocaml
mrsolo has quit [Client Quit]
araujo has joined #ocaml
ulfdoz has joined #ocaml
mrsolo has joined #ocaml
ulfdoz_ has quit [Read error: 110 (Connection timed out)]
Herrchen_ has joined #ocaml
araujo has quit [Remote closed the connection]
Demitar has quit ["Terminated with extreme prejudice - dircproxy 1.0.5"]
Herrchen has quit [Read error: 110 (Connection timed out)]
Enveigler_ has quit [Read error: 104 (Connection reset by peer)]
Enveigler_ has joined #ocaml
<mflux_>
enveigler_, I think you could write let module R = Gdk.Rectangle in let x = R.x area in ..
<mflux_>
hm
<mflux_>
or is Gdk.Rectangle a module? it would look like it is, with a function x with one argument?
<mflux_>
if it was just a struct wouldn't you rather write let x = area.Gdk.Rectangle.x
<mflux_>
well, if it were a struct would could write match area with {Gdk.Rectangle.x = x; y = y} -> ..
<mflux_>
enveigler_, also, you could write your own language extension for that ;)
<Enveigler_>
Thanks mflux_.
<Enveigler_>
I tried
<Enveigler_>
let R = Gdk.Rectangle in
<Enveigler_>
let ( x, y, width, height ) = (
<Enveigler_>
R.x area,
<Enveigler_>
R.y area,
<Enveigler_>
R.width area,
<Enveigler_>
R.height area
<Enveigler_>
) in
<Enveigler_>
but got "Unbound constructor R"
<Enveigler_>
I'm still trying to get a feel for Ocaml syntax, so writing a langauge extension is probably beyind me (for a day oor two :) )
<mflux_>
let _module_ R = ..
<Enveigler_>
AH..
<Enveigler_>
Perfect. Works a treat. Thankyou muchly.
<mflux_>
there is also the openin-extension in caml humps
<Enveigler_>
More reading :)
<mflux_>
which allows you to write like open Gdk.Rectangle in let x = x area
<Enveigler_>
I've used open (with Graphics) which definitly cuts down on the syntax involved. I'll look into that. Thanks again.
<mflux_>
happy to help a fellow ocamler ;)
<Enveigler_>
I'm not sure I qualify as one yet--but I'm trying ;)
<Enveigler_>
Instinct make me want to do just 'let x = area.x' or even 'let ( x, y, width, height ) = map area, [ x, y, width, height ] in ', but I guess that's just silly.
<mflux_>
hmh, infact you could write let [x, y, h, w] = List.map (fun f -> f area) [R.x, R.y, R.width, R.height] in .. but that would cause compile time warning
<mflux_>
make that R.x; R.y; etc instead
<mflux_>
(and [x; y..] too)
<mflux_>
or you could reverse that with match and handle the case that never happens
<Enveigler_>
That's nice, but gives the warning. Now to try and understand the " reverse that with match and handle the case that never happens" bit.
__DL__ has joined #ocaml
Sonarman has quit [Read error: 110 (Connection timed out)]
<mflux_>
you could just define a function let tuple4_of_list l = match l with [a, b, c, d] -> a, b, c, d | _ -> failwith ":-("
<mflux_>
and then write let x, y, h, w = tuple4_of_list (List.map ..)
<mflux_>
again, [a; b; c; d] :-)
Enveigler_ has quit [Read error: 110 (Connection timed out)]
Snark has joined #ocaml
mrvn_ has joined #ocaml
whee has quit ["Leaving"]
mrvn has quit [Read error: 110 (Connection timed out)]
mrvn_ is now known as mrvn
Enveigler_ has joined #ocaml
Snark has quit ["Leaving"]
raboof_ has joined #ocaml
shawn_ has joined #ocaml
raboof has quit [Read error: 110 (Connection timed out)]
_shawn has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
stef__ has joined #ocaml
cognominal has quit [Read error: 110 (Connection timed out)]
__DL__ has quit ["testing network configuration"]
__DL__ has joined #ocaml
Enveigler_ has quit [Read error: 110 (Connection timed out)]
Enveigler_ has joined #ocaml
stef__ has quit [Read error: 110 (Connection timed out)]
pango_ has joined #ocaml
fab_ has quit [Read error: 145 (Connection timed out)]
Enveigler_ has quit [Read error: 110 (Connection timed out)]
Demitar has joined #ocaml
Demitar has quit [Client Quit]
raboof_ is now known as raboof
Demitar has joined #ocaml
fab_ has joined #ocaml
gim has quit [Remote closed the connection]
gim has joined #ocaml
whee has joined #ocaml
Saulzar has joined #ocaml
Saulzar has quit ["Leaving"]
Smerdyakov has joined #ocaml
whee has left #ocaml []
pango__ has joined #ocaml
whee has joined #ocaml
pango_ has quit [Read error: 110 (Connection timed out)]
Sonarman has joined #ocaml
araujo has joined #ocaml
vezenchio has joined #ocaml
mfurr has joined #ocaml
Enveigler_ has joined #ocaml
mauke has joined #ocaml
Smerdyakov has quit ["eat"]
Enveigler_ has quit [Read error: 110 (Connection timed out)]
Isumi has joined #ocaml
Isumi has left #ocaml []
Smerdyakov has joined #ocaml
Sonarman has quit [Connection reset by peer]
raboof_ has joined #ocaml
raboof has quit [Read error: 54 (Connection reset by peer)]
raboof_ is now known as raboof
batdog is now known as batdog|gone
__DL__ has quit ["good night"]
batdog|gone is now known as batdog
tautologico has joined #ocaml
mfurr has quit ["Client exiting"]
vezenchio has quit ["ni shi wei yi de shen hua -- wo zhi ai ni You are my super star"]
araujo has quit ["Programs must be written for people to read, and only incidentally for machines to execute"]