<dsheets>
mrvn, yes, it seems you need to compute the screenspace, render the screenspace + margin from the lightsource and then render the screenspace?
<dsheets>
should be able to reuse some of the results for the two passes
<beginner42>
has someone an idea how i can find the problem with DL_error?
<mrvn>
dsheets: I don't need all of the margin, only enough to tell if I'm in shadow. The amount depends on the height of the last pixelsin the direction of the shadow.
<dsheets>
right. so you just need to project a terminator ray onto the fractal in the direction of the light
<dsheets>
that doesn't seem like a very easy operation
<dsheets>
perhaps there is something i've missed or an approximation to help
<mrvn>
dsheets: you draw a line from the pixel to the light source and then have to compute all the grid points below that line. But once the line is higher than the maximum height you can stop.
<mrvn>
n8
<dsheets>
right, this is what i was imagining. g'night
<beginner42>
ocamlfind: [WARNING] You have installed DLLs but the directory /.opam/4.00.1/lib/stublibs is not mentioned in ld.conf
<beginner42>
dsheets: does this give you some clue?
<mrvn>
for me that just shows the ocamlfind call, not gcc.
<beginnner42>
mrvn: what command should i issue?
amirmc has joined #ocaml
<avsm>
beginnner42: i wouldn't really recommend using OASIS for c bindings, to be honest. I just use ocamlopt directly, mostly via OCamlMakefile
<beginnner42>
avsm: my thoughts were that it should be an library in the end, that i can put into opam. Thought oasis would facilitate that
<mrvn>
beginnner42: last time I used strace.
<mrvn>
there is a -verbose <level> option but I couldn't get that to actualy print the gcc command.
<avsm>
beginnner42: it does make it easier to get the metadata, but for development, direct control over the ocaml commands is a lot easier
ggole_ is now known as ggole
<whitequark>
I'm not sure I understand labelled arguments
<whitequark>
utop # let x ?id ~foo = ();;
<whitequark>
val x : ?id:'a -> foo:'b -> unit = <fun>
<avsm>
C bindings are always a bit special, and OASIS doesnt have good support for them (yet — there's nothing fundamental)
<whitequark>
utop # x ~foo:1;;
<whitequark>
- : ?id:'a -> unit = <fun>
<mrvn>
avsm: oasis works fine for C bindings. The problem is ctypes doing strange things
<whitequark>
how do I make it just execute the function?
<avsm>
mrvn: not really. It doesn't have enough autoconf support. See Lwt/Core's gymnastics to work around that
<companion_cube>
whitequark: ?id:None I believe
<avsm>
it can be added; just hasn't been done yet. So for now, CCLib have to be hardcoded in the OASIS file.
<whitequark>
companion_cube: then what is the point of even making it optional :/
<companion_cube>
the problem with your function is that all its arguments are named or optional
<mrvn>
avsm: he has CCLib, doesn't seem to work
amirmc has quit [Ping timeout: 276 seconds]
<companion_cube>
so since you can pass them in any order, just giving ~foo makes for a partial application
<avsm>
he needs -Wl,—no-as-needed
<avsm>
but only on Ubuntu
<mrvn>
whitequark: you need a non optional non labeled argument to terminate the application
<companion_cube>
imho optional arguments only really make sense if at least one argument is positional
<companion_cube>
(can be unit)
<mrvn>
avsm: he has -Wl,--no-as-needed, doesn't work
<whitequark>
that's dumb :/
<beginnner42>
mrvn: i think i have only one - in front of the no-as-needed
<mrvn>
whitequark: the point of labels is that they can be used in any order. So how should ocaml know if you mean (x ~foo:1) or (x ~foo:1 ~id:2)?
<mrvn>
beginnner42: if that where the problem then gcc/ld would give you an error.
<whitequark>
mrvn: IMO if at the end of an application only optional labels left, OCaml should just treat it as full application without optional labels
<whitequark>
instead of a partial one.
<ggole>
(And the names can make code more readable.)
<whitequark>
*are left
<whitequark>
and what ggole says
<mrvn>
whitequark: let y = x ~foo:1 .... y ~id:2
<mrvn>
whitequark: perfectly valid code.
<whitequark>
mrvn: right now, sure. arguably this is not very useful.
<whitequark>
I won't cry over not being able to write that.
<mrvn>
it can be verry usefull
<mrvn>
anyway, that is how it is. Use let x ?id ~foo () = ()
<whitequark>
in fact I'm not even sure if currying for labelled arguments *ever* makes sense
<whitequark>
well, I'd rather demote one labeled argument to unlabeled one
<beginnner42>
is there no project on github that uses ctypes and oasis that i could really use as a guideline?
<mrvn>
whitequark: there are lots of cases where you call some function multiple times with the second argument always the same. With labels you can bind the second argument first and save typing.
<whitequark>
mrvn: so this is basically trading one set of cases when you need to explicitly type out closures, for another
<mrvn>
whitequark: no
<mrvn>
it tardes needing closures to not needing closures and having more readable code when you have lots of simmilar looking arguments
* whitequark
sighs
<ggole>
Labels are fine, really. It's optional args that are a bit kooky.
<watermind>
so the matrix is an array of array, therefore mutable... and I did it using recursion
<watermind>
although I know I could just use simple loops C style
<companion_cube>
first, I'd say that the "if i >= 0 then .... else ()" should rather be an assert
<companion_cube>
second, "else ()" is most of the time useless
<mrvn>
why not Array.iteri?
<watermind>
I see, I thought skipping the () could mean it would return undefined
<companion_cube>
undefined doesn't exist
<companion_cube>
you can only omit the "else" part if it returns ()
<watermind>
mrvn: didn't know about it... although I suspected something like that should exist
<watermind>
companion_cube: right that's what I was going to ask
<mrvn>
val iteri : (int -> 'a -> unit) -> 'a array -> unit
<watermind>
mrvn: cool
tani has quit [Ping timeout: 264 seconds]
<watermind>
how about assert, where do I find it?
<watermind>
it doesn't seem to be available by default
<mrvn>
Array.iteri (fun x row -> Array.iteri (fun y z -> res.(y).(x) <- z) row) matrix
<watermind>
mrvn: nice
<mrvn>
assert is a keyword
<watermind>
oh
<watermind>
but what happens when the assertion isn't satisfied? because I'm used to assert just breaking the program when it fails
<mrvn>
it raises an exception
<watermind>
oh ok, then I can't use it there instead of my if
<watermind>
because the if actually defines the base case of the recursion
<companion_cube>
oh, my bad oO
* companion_cube
slaps himself
<watermind>
:)
<watermind>
one more question... this confused me, why don't I need a rec in trans_line?
<watermind>
I forgot about it but it didn't complain
<flux>
if you defined trans_line earlier..
<flux>
then it's using that version
<wmeyer>
hi
<mrvn>
you do
<watermind>
hmmm
<watermind>
I see what may be happening
<flux>
if you reload the file to an 'empty' ocaml toplevel, it will fail
<watermind>
right
<mrvn>
Error: Unbound value trans_line
<watermind>
damn, that can lead to some weird bugs
<flux>
true. there was this extension for doing #use_module or something
<watermind>
is there some toplevel command to clean toplevel and then load a file ?
<mrvn>
watermind: performance wise it is usualy a good idea to process arrays in-oder, not reverse order.
<flux>
that loaded modules from source files the same way they are loaded in compiled programs
<companion_cube>
mrvn: that doesn't help much if Array.iteri is used, does it?
<mrvn>
Array.iteri is in-order
<watermind>
mrvn: oh I see, I just did it because it would lead to a simpler recursion since I could have 0 as the base case
<watermind>
I'll keep that one in mind too then
<companion_cube>
mrvn: in C I believe a for loop may be slightly more efficient if decreasing, though
<companion_cube>
because checking for 0 is faster
<watermind>
also... why do I need that begin end in trans_matrix but not in the let in trans_line?
<companion_cube>
I don't think that's very relevant for a beginner ^^
<mrvn>
companion_cube: most of the time the check can be stuffed in some empty slot.
<watermind>
companion_cube: I'm only a begginer in OCaml... I'm pretty experienced in Haskell, C, and others
<mrvn>
watermind: let has an implicit begin/end basically
<flux>
watermind, let is scoped like: (let x = y in expr1; expr2) but if is scoped like if expr1 then expr2 else expr3
<watermind>
right
<flux>
so 'let' starts a new scope. I wonder though how it could be improved..
Snark has quit [Quit: leaving]
<wmeyer>
companion_cube: flux mrvn hi
<flux>
if 'if' started a new scope, it would mean we would need to write code like (if true then printf "Hello world\n"); printf "hello afterworld\n";
* wmeyer
is getting annoyed, when install Agda on his arm netbook
<watermind>
flux: I see... I expected that to be the case actually
<flux>
wmeyer, hello.
<watermind>
I'm used to think of ; as just any other binary operator
<watermind>
one that sequences two statements and returns the result of the second
<companion_cube>
hi wmeyer
<watermind>
thanks for the feeback guys!
<companion_cube>
you're welcome :)
<flux>
watermind, I think the current 'if' can be more consistent in the presence of nested if/elses, but I didn't think it through..
<wmeyer>
flux: right :-)
ben_zen has joined #ocaml
<watermind>
flux: yes I can see how it makes for a sensible option... it also keeps notation more consistent with that of imperative languages in general
<wmeyer>
it's quite clunky, to use nested if's with imperative code normally it's best to sorround them with scope delimiters
avsm has quit [Quit: Leaving.]
<watermind>
I actually like Ada's approach where the delimiter is compulsory
<watermind>
that way nested if's with some missing elses aren't ambiguous
<mrvn>
python doesn't have that problem
<wmeyer>
mrvn: python has different problems
<companion_cube>
python doesn't have the same syntax
<companion_cube>
its syntax prevents its from having proper lambdas ;)
<mrvn>
companion_cube: what's wrong with lambda x: foo x?
<wmeyer>
first of all python does not use proper off-side rule like haskell
<companion_cube>
mrvn: python has too many statements for lambdas to be able to express everything in an expression
<wmeyer>
it does some heuristics to parse the multiline code fragments
<wmeyer>
mrvn: I wouldnt say the syntax prevents, but rather how lambdas are limited
<wmeyer>
in particular case, introducing `let' inside lambda is not possible
<wmeyer>
lambdas with side effects are prohibiten
<wmeyer>
lambdas with side effects are prohibited
<mrvn>
One thing that always trips me is y = 1 \n f = lambda x: print(y) \n y = 2 \n f 0 prints 2 and not 1 like it would in ocaml.
<wmeyer>
:D
<wmeyer>
yes, indeed, I've heard that JS got it right actually :-)
<watermind>
mrvn: ouch that's awful... so (...) y = 2 \n f 0 \n y = 3 \n f 0 would print 2 and then 3?
<mrvn>
watermind: yes. python has mutable variables. So y = 3 changes y and does not bind a new one
Neros has joined #ocaml
<watermind>
right
wmeyer has quit [Ping timeout: 264 seconds]
avsm has joined #ocaml
<watermind>
when I define an array directly, as in let a = [| 1 ; 2; 3|] ;; the resulting type is int array
<mrvn>
yes
<watermind>
if I define it using Array.init then the type is int Core.Std.Array.t
<mrvn>
because you opened Core.Std.
<watermind>
i thought Core.Std would be opened by default
<watermind>
so it is only opened at the point where I use a Core function?
<mrvn>
it is only opened when you open it
<watermind>
that's the thing I don't open anything explicitely
<watermind>
both definitions are one right after the other
<mrvn>
Are you using Core.Std.Array.init?
<watermind>
let me try swapping the order
manud has joined #ocaml
<mrvn>
[| |] is always the built in array type
<watermind>
oh I see
<mrvn>
at least I think it is. don't think that calls any Array.* functions that you could overload.
<watermind>
however I can apply my trans_matrix function to both
<watermind>
val trans : 'a Core.Std.Array.t Core.Std.Array.t -> unit
<watermind>
so it seems like arrays are automatically coerced to Core.Std.Array's
<mrvn>
Core.Std.Array.t = Array.t
<watermind>
ok so it is the same type...
<mrvn>
If you use it with an Core.Std.Array.t it will infer that type.
<watermind>
I see
travisbrady has joined #ocaml
Arsenik has quit [Quit: Quitte]
tane has quit [Quit: Verlassend]
pkrnj has quit [Quit: Computer has gone to sleep.]
cdidd has quit [Ping timeout: 264 seconds]
cdidd has joined #ocaml
dtg has quit [Quit: Leaving...]
ben_zen has quit [Ping timeout: 276 seconds]
travisbrady has quit [Quit: travisbrady]
pkrnj has joined #ocaml
Simn has quit [Quit: Leaving]
osa1 has quit [Ping timeout: 246 seconds]
ulfdoz has quit [Ping timeout: 264 seconds]
watermind has quit [Quit: Konversation terminated!]
gasche has quit [Ping timeout: 260 seconds]
malo has quit [Quit: Leaving]
tobiasBora has joined #ocaml
<tobiasBora>
Hello,
<tobiasBora>
I'd like to know how I could run my program in several cores.
<tobiasBora>
I arrive to generate a pseudo multithread with thread.cma, but I don't think it is run in several cores...
<tobiasBora>
So the efficiency is the same ...
watermind has joined #ocaml
watermind has quit [Quit: Konversation terminated!]
gasche has joined #ocaml
<tobiasBora>
I saw Jane Street, is it the standard way to do it ?
Drup has joined #ocaml
hcarty has quit [Ping timeout: 248 seconds]
hcarty has joined #ocaml
ollehar has quit [Ping timeout: 264 seconds]
<troydm>
tobiasBora: you can forking library
<troydm>
*use*
<tobiasBora>
And I've some problems with modules : how could I just load a file in interpreter mode and by compilation ? I tried #load "file.ml" but it says that it must be an object... So I MUST compile or is it possible to load a .ml ?