<tomp>
if anyone is so inclined to give me a hand ..
<tomp>
Since I'm a newbie I'm not sure if this is an appropriate
<tomp>
use for the channel .. If not let me know.
<tomp>
The problem is that I want an instance variable which is a Tk.canvas
<tomp>
but I can't define it in the actual 'val mutable ..' stmt
<tomp>
since it needs another instance variable (the Tk.root) as part
<tomp>
of it's 'modular' constructor.
<tomp>
Even if I try a 'dummy' canvas .. i.e.
<mflux>
hmh
<tomp>
Canvas.create ~width:800 ~height:800
<mflux>
None is ok
<mflux>
however you need to assign a value with Some foo
<mflux>
and retrieve the value with match canvas_iv with Some x -> x | None -> failwith "no canvas set :-("
<tomp>
Thanks .. that's a little confusing to me but at least
<tomp>
if gives me a wall to put my ladder against ..
<tomp>
So far I like Ocaml but the learning curve has been
<tomp>
quite steep (steeper than OO it seems) ..
<mflux>
I didn't find it that steep, though I had had some experience with functional languages before
<tomp>
When I was in college there was no CS major (I'm an EE) so
<tomp>
I never took Lisp :-(
<mflux>
I've never taken a course on lisp either, but it turned out to be worthwhile to study it so one can configure his emacs ;)
<tomp>
I probably doesn't hurt if you want to script Gimp either ..
<tomp>
altho' that's Scheme
<tomp>
Thanks again for the help .. with luck I'll have my electrons
<mflux>
I also use sawfish as my window manager (which uses rep, which is schemelike)
<tomp>
on the screen by morning
<mflux>
happy hacking
<tomp>
Tnx ..
vezenchio has joined #ocaml
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
Axioplase has joined #ocaml
<Axioplase>
Chat Lu!
PeterE has joined #ocaml
jourdechance has joined #ocaml
<jourdechance>
hello
<Robert>
Hi jourdechance
<jourdechance>
is there a trick to define a function which take a list l as argument and return the "recursive" list: l@l@l@...@l@... (i don't think so :/)
<Axioplase>
let rec foo l= l@(foo l);; ?
<Axioplase>
i think it is possible. i remember a teacher explainig this last year...
<mellum>
I don't think it's possible
<Axioplase>
Stack overflow during evaluation (looping recursion?).
<PeterE>
jourdechance: Wouldn't it have to be lazy then?
<mellum>
You can do stuff like let rec l = 1 :: l;; as a language extension, but I don't see how one could use that for what you want
<jourdechance>
(sorry, i was away)
<jourdechance>
yes i want something like: let rec l = 1 :: l;;
jourdechance has left #ocaml []
jourdechance has joined #ocaml
<jourdechance>
# magic_function [1;2;3];;
<jourdechance>
- : int list = [1; 2; 3; 1; 2; 3; 1; 2; 3; 1; 2; 3; ...]
Xolution has joined #ocaml
mlh has quit [Client Quit]
GreyLensman has joined #ocaml
<mellum>
let magic_function l = let rec loop = function [x] as t -> Obj.set_field (Obj.repr t) 1 (Obj.repr l) | _ :: t -> loop t in loop l; l;;
docelic has quit [Read error: 104 (Connection reset by peer)]
docelic has joined #ocaml
GreyLensman has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has joined #ocaml
docelic has quit [Read error: 104 (Connection reset by peer)]
docelic has joined #ocaml
GreyLensman has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has joined #ocaml
<jourdechance>
mellum, i've never heard about the Obj module before !
<jourdechance>
it is not documented ? can you explain it ?
<mellum>
jourdechance: It's undocumented magic. Don't try this at home ;)
<jourdechance>
it's really cool :)
<mellum>
Well, you can make your program crash when using Obj, so you should basically never use it
Zaius has joined #ocaml
mrsolo_ has quit [Read error: 104 (Connection reset by peer)]
<vincenz>
jourdechance: why do you want a recursive list like that?
PeterE has left #ocaml []
<vincenz>
only place that'd be useful is if ocaml was evaluate-by-need like haskell, or you'll have to make sure everything works like an evaluate-by-need
jourdechance has quit [Read error: 242 (No route to host)]
<Smerdyakov>
vincenz, why? You don't have to read an entire list....
mrsolo_ has joined #ocaml
<vincenz>
true
<vincenz>
but why would you make an infinitel ist then unless you thought you wouldn't be sure just how many elements you use
<vincenz>
which typically matches call-by-need
<vincenz>
I mean
<vincenz>
evaluate-by-need
bk_ has joined #ocaml
<Axioplase>
++
Axioplase has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has quit [Read error: 110 (Connection timed out)]
gim has joined #ocaml
GreyLensman has joined #ocaml
tomp has quit [Remote closed the connection]
GreyLensman has quit [Read error: 110 (Connection timed out)]
OliverTwist has joined #ocaml
GreyLensman has joined #ocaml
gl has joined #ocaml
GreyLensman has quit ["Leaving"]
GreyLensman has joined #ocaml
GreyLensman has quit [Read error: 104 (Connection reset by peer)]
GreyLensman has joined #ocaml
GreyLensman has quit ["Leaving"]
gl has quit [Read error: 104 (Connection reset by peer)]
gl has joined #ocaml
OliverTwist has quit ["Leaving"]
gl has quit [Read error: 54 (Connection reset by peer)]
gl has joined #ocaml
gl has quit [Read error: 104 (Connection reset by peer)]