khaladan_ has quit [Read error: 145 (Connection timed out)]
llama32 has joined #ocaml
khaladan- has quit [Read error: 145 (Connection timed out)]
yondalf_ has joined #ocaml
revision17 has joined #ocaml
yondalf has quit [Connection timed out]
sponge45 has joined #ocaml
<llama32>
hmm... building camelia dies on the first file compiled - spits out tonnes of errors that i can't be bothered looking at [C++ isn't my strong point]
<llama32>
anyone had similar problems?
yondalf_ has quit ["leaving"]
dudleyf has joined #ocaml
joshcryer_ has joined #ocaml
joshcryer has quit [Nick collision from services.]
joshcryer_ is now known as joshcryer
trrkkkkkk has joined #ocaml
trrkkkkk has quit [Read error: 148 (No route to host)]
<jigga_what>
llama32: YES
<jigga_what>
if you want camelia i can send you a binary
<jigga_what>
i compiled it on an old version of qt
<jigga_what>
but it is a great program
<llama32>
jigga_what: that would be great... will the binary work on newer versions though?
<jigga_what>
yep
<jigga_what>
wellll works here
revision17 has quit [Read error: 131 (Connection reset by peer)]
<llama32>
are ocaml executables [on linux] dynamically linked [as opposed to statically linked - i know i can't dynamically load ocaml libraries at runtime]
<pango>
C libs (well, any .so in fact) are dynamically linked. bytecode can be dynamically loaded, afaik. native code is always statically linked.
<marburg>
I don't really like when people do this, so I apologise in advance, but could someone tell me why I get a "Syntax Error" on the highlighed line: http://pastebin.com/823026
<pango>
marburg: because let a = ... etc, must be followed by "in"
<marburg>
pango: thanks. I'll look up the "in" keyword
<pango>
let without in is only usable for toplevel definitions
<pango>
in is not a separate keyword, it's always used with let
<marburg>
pango: do i have to do: let var = blag in name_of_subroutine ?
<llama32>
pango: so in each binary i produce, [the used parts of] any libraries i use will be included?
<pango>
marburg: yes, let [rec] ident = expr [and ident = expr]* in expr ... or something like that
<marburg>
pango: awesome-possum
<pango>
marburg: in your code, replacing the ;s at the end of each let line should do it
<pango>
llama32: in native code, at least, yes
jordan has joined #ocaml
<jordan>
does the modules system of ocaml have more features than java's for example?
<pango>
jordan: I don't know java module system, but OCaml's is very sophisticated, so probably
<llama32>
pango: is this much of a problem - in the sense that if i have 30 [small-ish] ocaml programs installed on a machine - will it be a noticable size increase over dynamically linked? [eg for people downloading over dialup]
<jordan>
i am truying to make a clear comparison
<jordan>
everyone says ocaml's module system is very expressive etc. but i am just trying to find concrete differences
<jordan>
between ocaml and java packages
<pango>
llama32: if the programs are short vs. the size of ocaml libs they use, that would probably be noticeable
<llama32>
are only the used parts of the libraries included?
<llama32>
ie functions that are not referenced and will never be called will be excluded?
<pango>
jordan: in OCaml, if you don't restrict yourself to .ml/.mli pairs (which is a specific use of modules), you can define modules and modules types (signatures) separately
<pango>
jordan: in signatures you can constrain what's visible from a module... Either hide things totally, or make types abstract, or private (values of those types can only be constructed from within the module),...
<pango>
jordan: and since modules and modules types are separate, you can use different signatures on the same module, or the reverse
<pango>
jordan: then there's functors... think of those as functions in the module domain (parametrize modules with modules,...)
<pango>
llama32: from experimentation, libraries are not partially included, it's all or nothing
<llama32>
hmmm
<llama32>
are they at least optimised for the cases in which they're used?
<llama32>
if not - why can't they be dynamically linked?
<pango>
it seems dynamic linking is platform dependant, so it's more work than the time they can put in it
<pango>
I suppose this is the reason why it's not done
llama32 is now known as h3r3tic
<pango>
what do you mean by "are they at least optimised for the cases in which they're used" ?
h3r3tic is now known as llama32
<pango>
compiler does cross-modules inlining of short functions (below -inline threshold)
<llama32>
hmm
<pango>
but it's not a "whole program optimizing compiler", like MLton, for example
<llama32>
i don't see how it's too platform dependant to worry about
<llama32>
hmm
<jordan>
pango: makes sense, but what's a case where you'd want several distinct signatures for the same module type
<pango>
jordan: hide different things to different clients
<jordan>
i see
<pango>
I don't think it's too far fetched for large modules
<Mr_Awesome>
you know whats even better than ocaml?
<llama32>
Mr_Awesome: your mum?
<Mr_Awesome>
that was low
<llama32>
nonetheless, continue...
<Mr_Awesome>
nothing!
<llama32>
haha
<Mr_Awesome>
teehee
<llama32>
ocaml sorta put me off my attempt to make a language/interpriter, simply because it's so damn good it makes my language look like someone put BASIC in a blender
<Mr_Awesome>
but, if you write your language *in* ocaml, it might be almost half as awesome
<llama32>
nah, still as crap, but the VM will be faster and smaller and easier to understand than if i wrote it in C
<llama32>
btw - how complicated is ocaml's bytecode interpriter - i'm thinking of perhaps writing a bootable OS kernel that just interprits [perhaps even JIT's] ocaml bytecode... i know it's been done before [desert springtime], but my one would be better :)
<flux__>
oh right, and then there's the visual c-version
<jigga_what>
yes
<jigga_what>
best version for windows
<flux__>
I don't have visual c
<jigga_what>
im sure borland
<jigga_what>
or lcc would work
<flux__>
lcc?
<jigga_what>
LCC i think is a free windows compiler
<jigga_what>
i *think*
<jigga_what>
but if you want to use a feature that is unix specific then you have ot use
<jigga_what>
cygwin
<jigga_what>
but i never had too and most people make stuff to work nateivly on all
<flux__>
apparently bytecode run with ocaml-msvc is 30% slower than others
<flux__>
but it does implement the Unix-module, doesn't it?
<jigga_what>
yea well im sure
<jigga_what>
yes
<jigga_what>
yea but using cygwin is prolly much slowerr
<flux__>
I don't think there's overhead except when you're doing system calls
<jigga_what>
cygwin is nothing but more overhead
<flux__>
stuff that needs to be 'emulated'
<flux__>
and that's not really that much in my app
<flux__>
it's a small game, actually :)
<jigga_what>
no its not emulated
<jigga_what>
its ported
<flux__>
well there's a thin layer that performs windows system calls in place of posix ones, no?
<flux__>
I'm talking about cygwin
<jigga_what>
application ->unix call ->>cygwin -> windows call
<flux__>
I wouldn't call that exactly native
<jigga_what>
flux__: yes but thats far from emulation ;)
<flux__>
but could be near 'emulation' ;)
<jigga_what>
slightly
<jigga_what>
do you call wxwidgets emulation also :P
<flux__>
I don't know what wxwidgets do
<flux__>
I could maybe call it 'emulation' ;)
<jigga_what>
one api all platforms
<jigga_what>
pos
<jigga_what>
good idea
<jigga_what>
ver bad implenmtation
<jigga_what>
i prefer gtk+ / QT
<flux__>
but how is gtk+ on windows?
<jigga_what>
but gtk+ is more portable and smaller
<jigga_what>
very good
<jigga_what>
you can get themes for it that make it look 90 percent native
<jigga_what>
called wimp
<jigga_what>
i prefer that over the regualr windows theme
<jigga_what>
:P
<jigga_what>
but
<jigga_what>
i like my qt style plastik themes even on windows
<jigga_what>
lablgtk is most likely the best library around for Ocaml
<jigga_what>
if ocaml had a qt layer that would even be better
<jigga_what>
but with the use of that SWIG stuff you can implment qt stuff but thats eh no fun
<jigga_what>
i'll update that GD library when i find some time
<jigga_what>
the imagemagick library is also very good though for it
Demitar has joined #ocaml
<jigga_what>
i bet ocaml light outputs smaller executeables
Leonidas has joined #ocaml
yondalf has joined #ocaml
ikaros has quit [Read error: 60 (Operation timed out)]
pango_ has quit [Read error: 104 (Connection reset by peer)]
pango_ has joined #ocaml
ikaros has joined #ocaml
yondalf_ has joined #ocaml
ppsmimou has quit ["Leaving"]
yondalf has quit [Read error: 110 (Connection timed out)]
ppsmimou has joined #ocaml
Leonidas has quit ["Leaving"]
trrkkkkkk has joined #ocaml
yondalf has joined #ocaml
trrkkkkk has quit [Read error: 148 (No route to host)]
yondalf_ has quit [Read error: 104 (Connection reset by peer)]
<llama32>
[perhaps there is a better place to ask this - suggestions?] anyone know of an algorithm for finding lines/curves in a bitmap? like i want to feed in a black + white cartoony drawing, and it should basically vectorise it - at least partially
<mellum>
That is somewhat nontrivial. I guess you'd better look for existing software.
kral has joined #ocaml
slipstream has joined #ocaml
<llama32>
time for implementation and optimization is something i have a lot of... ingenuity for actually working out how to do it is where i'm at a loss :)
yondalf has quit [Read error: 110 (Connection timed out)]
<llama32>
that looks like just what i'm after, thanks
<mellum>
inkscape has a nice interface for that.
<mellum>
and as to time, improving upon the state of the art would probably take you *years*. It's *really* not a simple problem.
<pango_>
mellum: inkscape uses potrace... That's how I retrieved the link ;)
<llama32>
i don't plan on improving on it :) in fact i probably won't even re-implement it - i'd probably be much better off just using potrace behind the scenes :)
<llama32>
i was sortof expecting a few articles on how it's done and some commercial, closed source applications that do it - not a good, free implementation
* llama32
is rather interested in developing a small animation package where most work can be done on paper rather than on tablet or mouse
slipstream-- has quit [Read error: 110 (Connection timed out)]
<marburg>
can one "pass by reference" is ocaml?
_fab has joined #ocaml
jordan has quit [Read error: 104 (Connection reset by peer)]
buluca has quit [Read error: 145 (Connection timed out)]
zak_ has joined #ocaml
zak_ is now known as llama33
<mattam>
marburg: one can pass a reference yes
<pango_>
actually, most of the time, you pass references, no ? Beside small enumerable types, most things are boxed...
llama32 has quit [Read error: 110 (Connection timed out)]
ramkrsna has quit [Read error: 131 (Connection reset by peer)]
ramkrsna has joined #ocaml
yondalf has joined #ocaml
<mattam>
you pass pointers but can't modify them, just what is pointed by them, if it's mutable
<flux__>
+NOT mutable
<mattam>
nope :)
<flux__>
oh, right, parse error
<flux__>
:)
<llama33>
is there something like sleep/wait/pause in ocaml?
ikaros has quit ["Leaving"]
<flux__>
the Unix-module contains many functions related to signal handling
<flux__>
I'm not sure if there's pause
<flux__>
oh, you mean just 'sleep'?
<flux__>
there's Unix.sleep. for sub-seconds sleep you might use Unix.select [] [] [] 0.42
<llama33>
probably - something that waits x seconds then returns
<llama33>
hmm interesting
ikaros has joined #ocaml
<llama33>
does ocaml have something similar to scheme/LISP's functions that read structured data?
<flux__>
there are language extensions for that
<flux__>
check out caml hump
<flux__>
and camlp4-extensions
<flux__>
one I liked reads and writes s-expressions
<flux__>
I think it's called sexplib
<llama33>
[i don't need it to be in the format of scheme/LISP]
<llama33>
sex? ooh, i like the sound of that one
<flux__>
also recently I used library called xml-light, which is also somewhat convenient
<flux__>
it doesn't do a lot more than convert an xml to a straight-forward data structure and back
<flux__>
but it works for me
yondalf has quit [Read error: 104 (Connection reset by peer)]
yondalf has joined #ocaml
marburg has quit [Remote closed the connection]
<llama33>
for someone with not much [though some] experience with GUIs and no experience with either gtk or tk, which would be better? [their ocaml bindings, of course, i'm not deciding between C and tcl :)]
yondalf has quit ["leaving"]
<flux__>
I don't know, but I would go gtk in any case :)
<flux__>
although there was some page on the web that made Tk look almost just as pretty as gtk
<flux__>
and it was written in ocaml too
<llama33>
also forgot to ask - how is labltk[2]'s support in win32?
<flux__>
I don't know, but I would expect it to be supported atleast
<flux__>
google perhaps knows better
<flux__>
(or some other idler)
<llama33>
i'm not *too* interested in look & feel [this is more the sort of app only i'll be using]
<flux__>
maybe you should compare the quality of documentation before deciding
<llama33>
well, labltk seems to be better supported in terms of everything but documentation [perhaps just because it is smaller and simpler]
<llama33>
i think i'm stuck with gtk - i'd sorta prefer tk, but i'm writing a graphics app that'll use cairo, and cairo won't work on tk :(
<flux__>
how's cairo with ocaml-gtk?
<flux__>
what kind of app are you writing, btw?
<llama33>
cairo-ocaml can apparently go through the gtk bindings, but unfortunately i think it's only on X11 anyway :|
<llama33>
animation/cartoon app - something like flash but simpler, and with an emphasis on drawing on paper, then scanning it in [and vectorising it]
buluca has joined #ocaml
<llama33>
hmm
<llama33>
i think i'm sorta screwed :(
<llama33>
for cross-platform stuff anyway
pango_ has quit [Remote closed the connection]
<llama33>
anyone know if labltk's canvas can blit from BigArray's?
ikaros has quit ["Leaving"]
ikaros has joined #ocaml
<llama33>
i wish labltk was better documented :|
pango has joined #ocaml
<lde>
llama33: grep -i array ocaml/labltk/*.mli
<llama33>
great idea, thanks lde :)
<llama33>
damn :(
<lde>
you can use ocamlbrowser, btw
<llama33>
i was a bit confused by it, since i'm not too familiar with labltk or even ocaml itself
<lde>
or just mli files
<lde>
they often have useful comments
<flux__>
hm, ocamlbrowser doesn't apparently know the ocamldoc-format
<llama33>
i think i'm out of options for using cairo + tk :(
<lde>
oh, those comments are documentation.
Leonidas has joined #ocaml
<llama33>
maybe it would be worth me writing a simple widget toolkit layer over ocaml-sdl
<flux__>
if you're not writing a game, I'm not sure it's worth the trouble..
<flux__>
writing a good toolkit can be a big task
holdenk has quit [Remote closed the connection]
<llama33>
but i need either cairo support or a way to efficiently write similar functions myself [not as fancy as cairo] - tk doesn't allow this, and gtk only allows it on linux [i might be able to do it on windows by making cairo draw to a bigarray then have gtk blit from it, but lablgtk doesn't seem to well supported/tested on windows anyway and i'm sure i'd discover some bugs]
<llama33>
and im sure the toolkit would be useful to others
<llama33>
plus the project will [eventually, assuming i get it working to begin with ;)] be big enough to warrant such framework
pango has quit [Remote closed the connection]
<lde>
can't you blit yourself?
<llama33>
to gtk? i guess so - but i'd rather a solution that i'm either sure will work - or whose only bugs come from me :)
<lde>
to tk
trrkkkkk has joined #ocaml
<llama33>
oh, yeah... but i think it might be pretty slow
trrkkkkkk has quit [Read error: 145 (Connection timed out)]
johnnowak has joined #ocaml
<llama33>
is there a way to store functions that take any [amount & type of] arguments and return anything? i can't imagine a [practical] way of doing it safely, so i guess there might not be...
<lde>
yes, using lists
<llama33>
explain
<lde>
if you want every function to be of the same type then they can get list as an argument and return list
<lde>
otherwise you can store anything in list
<lde>
um
<lde>
no, you can't. braino. :-)
<lde>
only the first one.
<lde>
argh, no, that won't work either
<flux__>
llama33, what kind of need do you have?
<johnnowak>
just implement a scheme interpreter in ocaml and then have at it
<lde>
you can ofcourse store a known number of such functions in a tuple
<lde>
*of course
<lde>
you'd have to know the types also.
<flux__>
lde, you will need to have something like like type arg = Int of i | Str of string | etc type funcs = (strnig * arg list) list
<llama33>
flux__: for this imaginary widget toolkit... sorta a very simple object system - just a list of method name & function pairs... i guess i _could_ use the normal ocaml object system, but where's the fun in that?
<flux__>
the fun would be in that it would be statically checked ;)
<lde>
flux__: right, but it doesn't work for any type...
<flux__>
nope
<flux__>
only the enumerated ones
<llama33>
not really too sure why i'm trying to avoid the normal object system now i think about it
<flux__>
ocaml doesn't provide you with unsafe casts in any case, though
<llama33>
i guess i'm thinking too much in scheme [OO? sure, go ahead and write it.] and not enough in ocaml [OO? sure - we have that.]
<flux__>
unless you like have a hash table that maps the upper classes into lower classes
<flux__>
but one can usually manage just fine without that
* llama33
should probably sleep about now
<llama33>
cya all
<llama33>
and thanks for the help
<llama33>
hmm, do lists in ocaml work like in scheme/LISP [other than typing of course]? like can i have 3 lists, where the first one is a few elements then the second one, and the second one is a few more elements, then the third one?
<haelix>
llama33: sure. Just use a list of lists
<llama33>
not sure what you mean, but i did some googling, and it does work the lisp way
ramkrsna has quit ["Leaving"]
<haelix>
I mean list holds only elements of a given type
<haelix>
well
<haelix>
_one_ given type
<haelix>
call it 'a
<haelix>
the list is then of type __ 'a list __
<haelix>
two list of the same type can have different numbers of elements
<haelix>
so can be put in a list of list
<haelix>
(wich would then be a _______ 'a list list _________
<haelix>
)
<llama33>
i think you mis-understood what i meant [or i mis-wrote it]
<haelix>
Can you explain it again, then ?
<llama33>
i meant was each list really an element, then a list [which is the rest of the list]
<haelix>
oh, a car and a cdr
<llama33>
and it is - element :: (element2 :: (element3 :: ...))
<haelix>
It seems to me that this is actually an implementation detail
<haelix>
but, yes
<haelix>
in Ocaml
<haelix>
list are taylored for efficiency of CAR retrieval:
<haelix>
List.hd your_list;;
<haelix>
and CDR :
<haelix>
List.tl your_list;;
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
johnnowak has quit []
bmiller has joined #ocaml
llama33 has quit [Read error: 145 (Connection timed out)]
danly has joined #ocaml
danly has quit [Remote closed the connection]
velco has quit ["Ex-Chat"]
kral has quit [Read error: 131 (Connection reset by peer)]
danly has joined #ocaml
triple_ has quit [Remote closed the connection]
triple_ has joined #ocaml
_velco has quit ["I'm outta here ..."]
delamarche has quit []
delamarche has joined #ocaml
ita has joined #ocaml
<ita>
hi all !!!
delamarche has quit [Remote closed the connection]
pango has joined #ocaml
delamarche has joined #ocaml
bluestorm has joined #ocaml
love-pingoo has joined #ocaml
trrkkkkkk has joined #ocaml
smimou has joined #ocaml
<flux__>
haelix, actually it's more like that the definition of 'a list is type 'a list = [] | (::) of ('a * 'a list) (except you can't write that)
<pango>
type 'a list = :: of 'a * 'a list | Nil works, however
<flux__>
oh
<flux__>
so :: is allowed as a constructor
<flux__>
other symbols apparently aren't
<pango>
# [3;4;5] ;;
<pango>
This expression has type 'a list but is here used with type int list
<pango>
(seriously confused :) )
love-pingoo has quit ["Connection reset by pear"]
trrkkkkk has quit [Read error: 113 (No route to host)]
pango_ has joined #ocaml
bmiller has quit [" "]
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
malc_ has joined #ocaml
david_koontz has joined #ocaml
pango has quit [Remote closed the connection]
shawn__ has quit ["This computer has gone to sleep"]
shawn__ has joined #ocaml
bmiller has joined #ocaml
_fab has quit [Read error: 60 (Operation timed out)]
_fab has joined #ocaml
<jigga_what>
whoa i still cant get this lablgtk2 to compile
<jigga_what>
i just dont know where the problem lies
joshcryer has quit [Read error: 60 (Operation timed out)]
Mr_Awesome has joined #ocaml
Skal has joined #ocaml
<gunark>
is there a way to have an optional argument filled in with a default value based on the result of some function?
<gunark>
a way that doesn't require bizzarro pattern matching against 'a option and or None/Some.... :|
<Mr_Awesome>
gunark: i think so
delamarche has quit []
<Mr_Awesome>
does the result of the function depend on anything within the function you're defining?
joshcryer has joined #ocaml
<gunark>
no
malc_ has left #ocaml []
<gunark>
i assume by that you meant "does the result of the default value function depend on anything within the function you're defining?"
bmiller has quit [" "]
<Mr_Awesome>
thats what i meant
<gunark>
basically i want...
<Mr_Awesome>
let f ?(x = 4 + 5) y = y;; works
<gunark>
hm what if i want
<gunark>
let my_list ?(max = List.length my_list) = my_list;;
<gunark>
i.e. if max is not explicitly specified, max = the length of my_list
<gunark>
err
<gunark>
that should be
<gunark>
let f my_list ?(max = List.length my_list) = my_list;;
<gunark>
hm okay i guess that does work
<gunark>
for some reason i wasn under the impression last night that it wasn't working
<Mr_Awesome>
that function does nothing
<gunark>
right
<jigga_what>
*cries*
<gunark>
the body is a lot more complicated obviously :)
<Mr_Awesome>
just an example?
<jigga_what>
9 hours trying to get lablgtk+ to compile and nothing
<Mr_Awesome>
so you have a variable my_list, and now youre making a function called my_list?
<pango_>
and List.length seems to be evaluated in all cases
<Mr_Awesome>
you realize that when you reenter the function's surrounding scope the variable my_list will be unretrievable
<gunark>
no no, basically i wanted a function that does something with a list, and either it does it for the whole list, or if i specify a ~max parameter, it only does it up to max element in the list
<pango_>
let rec x = 1 :: x in f x () ;; (* waiting forever... *)
<Mr_Awesome>
well just don't name the function the same as any variables in the current scope
<Mr_Awesome>
wait forget what im saying, i read that wrong
<gunark>
argh okay no that doesn't work...
<gunark>
let f my_list ?(max = List.length my_list) () = print_int max;;
<gunark>
that gets me 'a list -> ?max:int -> unit -> unit = <fun>
<gunark>
or...
<Mr_Awesome>
is that not what you want?
<gunark>
goddamnit
<gunark>
i always forget to end with ()
<gunark>
no that does work
<gunark>
i just need to call
<gunark>
f [1;2;3;4] ();;
<gunark>
instead of
<gunark>
f [1;2;3;4];;
<Mr_Awesome>
yes
<gunark>
ok cool thanks
<Mr_Awesome>
for what? :P
<gunark>
for listening to me yabber on :)
gene9 has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
<pango_>
uh, bad conclusion; let rec x = 1 :: x in f x ~max:5 () ;; *does* stop
trrkkkkk has joined #ocaml
<Mr_Awesome>
why wouldnt it?
<pango_>
For a moment I thought it computed List.length needlessly
<Mr_Awesome>
ah
pinupgeek has joined #ocaml
<jigga_what>
this is ridiculous
<jigga_what>
i have compile lablgtk2+ 50 times
<jigga_what>
now it wont compile
pinupgeek has quit []
pinupgeek has joined #ocaml
trrkkkkkk has quit [Read error: 113 (No route to host)]