lamcee has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
d0nn1e_ has quit [Ping timeout: 264 seconds]
snhmib has joined #ocaml
ia0 has quit [Quit: reboot]
ia0 has joined #ocaml
lamcee has joined #ocaml
maattdd has joined #ocaml
freusque has joined #ocaml
freusque has quit [Ping timeout: 264 seconds]
larhat has joined #ocaml
freusque has joined #ocaml
lamcee has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
govg has quit [Ping timeout: 260 seconds]
freusque has quit [Ping timeout: 246 seconds]
lamcee has joined #ocaml
jnavila has quit [Quit: It was time]
jnavila has joined #ocaml
argent_smith has joined #ocaml
freusque has joined #ocaml
psacrifice has joined #ocaml
freusque has quit [Read error: Connection reset by peer]
mrvn has left #ocaml [#ocaml]
freusque has joined #ocaml
alfredo has joined #ocaml
psacrifice has quit [Remote host closed the connection]
zpe has joined #ocaml
maattdd has quit [Ping timeout: 260 seconds]
mfp has joined #ocaml
lamcee has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
psacrifice has joined #ocaml
M-jimt has quit [Remote host closed the connection]
smondet[m] has quit [Remote host closed the connection]
srenatus[m] has quit [Remote host closed the connection]
Bluddy[m] has quit [Read error: Connection reset by peer]
timclassic has quit [Read error: Connection reset by peer]
ktosiek[m] has quit [Write error: Connection reset by peer]
M-martinklepsch has quit [Remote host closed the connection]
regnat[m] has quit [Read error: Connection reset by peer]
yetanotherion[m] has quit [Read error: Connection reset by peer]
M-Illandan has quit [Remote host closed the connection]
aspiwack[m] has quit [Read error: Connection reset by peer]
govg has joined #ocaml
ktosiek[m] has joined #ocaml
kakadu has joined #ocaml
cokanut has joined #ocaml
wu_ng has quit [Ping timeout: 260 seconds]
<cokanut>
How can I get `corebuild` to include transitive dependencies? I have `main.ml` which invoke a fn in module A. Module A in turn calls a fn in Module B. When I run `corebuild ./main.byte`, it compiles Module A, but not Module B and raises error.
FreeBirdLjj has joined #ocaml
<cokanut>
never mind - I used CamelCase to refer to the module instead of First_letter_caps_and_rest_snake
FreeBirdLjj has quit [Remote host closed the connection]
govg has quit [Ping timeout: 240 seconds]
ncthom91 has joined #ocaml
ncthom91 has quit [Read error: Connection reset by peer]
govg has joined #ocaml
lamcee has joined #ocaml
lamcee has quit [Client Quit]
silver has joined #ocaml
ciniglio has quit [Ping timeout: 246 seconds]
ygrek_ has quit [Ping timeout: 268 seconds]
govg has quit [Ping timeout: 240 seconds]
BitPuffin|osx has joined #ocaml
mengu has joined #ocaml
lamcee has joined #ocaml
hydrocat has joined #ocaml
<hydrocat>
Hello, I am writing a simple lexer using ocamllex and I'm not sure on how to get the current position from the lexer, is here the right place to ask for help ?
<companion_cube>
look at the `Lexing` module
<hydrocat>
companion_cube: So I did, the thing runs and it gives the expected results. However it is warning me that the type isn't visible from the current scope and it won't be selected if the type becomes unknown
<companion_cube>
ah, it's because field access is lexbuf.Lexing.foo
<companion_cube>
not just lexbuf.foo
<companion_cube>
unless you `open Lexing` or use sth like `module L = Lexing;; lexbuf.L.foo`
<hydrocat>
oh, so it's not just Lexing.foo ?
<companion_cube>
no, not from another module
<companion_cube>
now OCaml can still infer what record type you talk about
<companion_cube>
but it does print a warning
<hydrocat>
Okay, I see it
<hydrocat>
companion_cube: Thank you !
_andre has joined #ocaml
djellemah_ has quit [Ping timeout: 264 seconds]
Bluddy[m] has joined #ocaml
aspiwack[m] has joined #ocaml
srenatus[m] has joined #ocaml
regnat[m] has joined #ocaml
timclassic has joined #ocaml
M-martinklepsch has joined #ocaml
M-jimt has joined #ocaml
M-Illandan has joined #ocaml
yetanotherion[m] has joined #ocaml
smondet[m] has joined #ocaml
sepp2k has joined #ocaml
octachron has joined #ocaml
rpg has joined #ocaml
trapz has joined #ocaml
djellemah_ has joined #ocaml
<hydrocat>
Okay companion_cube, opening Lexing worked out ok, but I wonder why you mentioned the field access is lexbuf.Lexing.foo, would the Lexing module be inside lexbuf ?
<flux>
hydrocat, the normal way to access fields of values that are records from another module is value.Module.field
<flux>
hydrocat, however nowadays the ocaml compiler is able to infer the module if you know the type of 'value'. by default using that causes a compiler warning, because depending on it can be a bit fragile.
<flux>
after you understand the problem, its solution, and the problems with the solution you can disable the warning ;)
<companion_cube>
hydrocat: lexbuf is a value of type Lexing.lexbuf
<companion_cube>
and it's defined in the module, yes
trapz has quit [Quit: trapz]
<hydrocat>
oh, so it's kind of against the 'normal' Class.atribute from other languages. Here we can point to the module from one of it's fields ?
<companion_cube>
hum, it's just for type inference
<hydrocat>
hmm
yaewa has quit [Quit: Leaving...]
moei has joined #ocaml
<octachron>
hydrocat, you should read "record.Module.field" as "record.(Module.field)"
<octachron>
it is the field name that lives insides the module
<hydrocat>
octachron, so what is the hierarchy ? record has modules, module has fields ?
<octachron>
no, Module are at the top of the hierarchy
<hydrocat>
so, when we write record.module we're 'pointing' to the father ?
<octachron>
record.Module is not valid by itself
<octachron>
what is valid is record.field_path
<hydrocat>
Oh
<octachron>
then a field path is either just the name of the field of the path to the field, i.e Module_1.Module_2.field_name
<def`>
or*
<hydrocat>
Oh, I got it now. The "Field_path" explains it a lot
psacrifice has quit [Remote host closed the connection]
<octachron>
or the path to the field*, thanks def` :)
lamcee has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
djellemah_ has quit [Ping timeout: 240 seconds]
larhat has quit [Quit: Leaving.]
djellemah_ has joined #ocaml
rpg has quit [Ping timeout: 260 seconds]
<mami>
when deriving several modules from a first class module, is there a way to specify additional functionality in something like individual interface extensions?
trapz has joined #ocaml
<mami>
for example i have "S.Foo" with functions "get" and "set", and for three of the modules i derive thats enough, but for the fourth i would also like to have "copy" reacheable from the outside.
<mami>
so the the module type "Foo" would describe minimal functionality
djellemah_ has quit [Ping timeout: 258 seconds]
djellemah_ has joined #ocaml
nomicflux has joined #ocaml
nomicflux has quit [Client Quit]
ygrek_ has joined #ocaml
larhat has joined #ocaml
trapz has quit [Quit: trapz]
<hydrocat>
mami, when we derive a module, can't we add more functions ?
<hydrocat>
I mean, to derive a class is a characteristic from OOP ( which Ocaml should support )
ciniglio has joined #ocaml
<mami>
hydrocat: but would i not have to specify them in the interface for "Foo"? If i did that, i would have to fulfill this description for every module, or do i not get something here?
psacrifice has joined #ocaml
<def`>
mami: use the signature "include Foo val copy : ..."
spew has joined #ocaml
<mami>
def`: will try that, thx
yomimono has joined #ocaml
jabroney has joined #ocaml
shinnya has joined #ocaml
sh0t has joined #ocaml
mengu_ has joined #ocaml
mengu_ has quit [Read error: Connection reset by peer]
mengu_ has joined #ocaml
mengu has quit [Read error: Connection reset by peer]
cokanut has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
rpg has joined #ocaml
mengu_ has quit [Remote host closed the connection]
mengu has joined #ocaml
cokanut has joined #ocaml
mbac has quit [Ping timeout: 260 seconds]
yegods has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
jmiven has quit [Quit: co'o]
zpe has quit [Remote host closed the connection]
jmiven has joined #ocaml
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
larhat has quit [Quit: Leaving.]
yegods has quit []
maarhart has joined #ocaml
maarhart has quit [Client Quit]
larhat has joined #ocaml
orbifx-m has joined #ocaml
<orbifx-m>
hey all
<orbifx-m>
what's the simplest function for copying a file?
<orbifx-m>
renaming causes an issue because it's across filesystems
zpe has joined #ocaml
<_y>
(interested in the answer too)
<_y>
(last time i needed rename i ended up with Sys.command "mv"…)
balod has quit [Remote host closed the connection]
<toolslive>
ppx_const doesn't work. I can do let x = if%const [%getenv "TEST"] = "" then "XTrst" else "XProd;; but I'm not trying to generate an expression here.
yomimono has joined #ocaml
hydrocat has quit [Ping timeout: 260 seconds]
jao has joined #ocaml
<toolslive>
yes, cppo would work.
<toolslive>
but it's rather heavy, I need to insert it into the build tool etc etc.
jnavila has quit [Ping timeout: 240 seconds]
Oleg has joined #ocaml
psacrifice has quit []
zpe has quit [Remote host closed the connection]
trapz has joined #ocaml
Oleg has quit [Ping timeout: 260 seconds]
slash^ has joined #ocaml
yomimono has quit [Ping timeout: 268 seconds]
sepp2k has quit [Quit: Leaving.]
napping has joined #ocaml
MercurialAlchemi has joined #ocaml
<napping>
I have a type of terms including a constructor with a map indexed by the same term type. I'm defining this now with recursive modules, but I'd like to avoid that. Is it possible, without copying the map implementation?
toolslive has quit [Remote host closed the connection]
<Drup>
not really, no. Recursive module is a decent solution
<napping>
Well, I'm actually generating the code in question and targeting various languages (O'Caml is the fastest so far). I was hoping SML would be an small change, but they don't do recursive modules (and their IRC channel is quiet).
<napping>
others are parameterized over both key and value and take a hash function or whatever as an argument when creating a new instance
copy` has joined #ocaml
moei has quit [Quit: Leaving...]
tane has joined #ocaml
tobast1 has joined #ocaml
cokanut has joined #ocaml
marsam has quit [Remote host closed the connection]
TheLemonMan has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
average has quit [Quit: leaving]
hovind has joined #ocaml
sepp2k has joined #ocaml
marsam has joined #ocaml
moei has joined #ocaml
orbifx has joined #ocaml
marsam has quit [Remote host closed the connection]
slash^ has quit [Read error: Connection reset by peer]
mrvn has joined #ocaml
<mrvn>
any recommends for a 3D vector / matrix module?
govg has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.8]: i've been blurred!]
<flux>
Gg
marsam has joined #ocaml
cokanut has quit [Ping timeout: 246 seconds]
<flux>
mrvn, that was an answer ;-)
<mrvn>
oh, stupid name then. :)
<mrvn>
flux: is that a native module or bindings for some lib?
mengu has joined #ocaml
<flux>
native module
<Drup>
it's also just a collection of basic utilities, nothing complicated
<mrvn>
flux: looks good, thx. Missing a few infix operator like let ( *. ) x y = dot x y and let ( ^ ) x y = cross x y. But nothing I can't define myself.
<mrvn>
It kind of sucks that you have three "mul" functions for a vector, skalar, dot and cross product.
<mrvn>
4 if you include v * m
<mrvn>
and licenses GPL compatible. perfect.
<octachron>
mrvn, it is very questionable that the cross product should be defined as an operator
<octachron>
since it is not associative and it is not a natural operation on vectors
<polemarch>
I have tried installing the actual solvers locally but for some reason it's just so much trouble
<polemarch>
e. g. aspcud ignores input and packup hogs 100% cpu without producing a result
trapz has quit [Quit: trapz]
trapz has joined #ocaml
<mrvn>
octachron: it's something you need quite often and ^ looks like 2 vectors spanning a plane. :)
<mrvn>
octachron: I don't see it being different than a / b. the order matters.
<octachron>
mrvn, not only the order, (a ^ b) ^ c ≠ a ^ (b ^ c) which means that the operator notation is not really useful
spew has quit [Ping timeout: 268 seconds]
<mrvn>
(a / b) / c != a / (b / c)
<octachron>
mrvn, which is one of the reason why (/) is only used for short inline expression in mathematical expression
<mrvn>
if you go by that argument then onl + and * should be operators.
<mrvn>
Maybe I should have asked this first: any recommends for a module to manipulate 3D meshes? I want intersection, union, difference of meshes.
<mrvn>
and something that is forgiving when floats are rounded differently so faces don't align perfectly.
spew has joined #ocaml
<octachron>
mrvn, good point on the operator side. I may just dislike the cross product for theoretical reasons.
<mrvn>
octachron: hehe
<clockish>
Language question: is there a clean way to narrow a polymorphic variant by handling a case?
<clockish>
e.g., I'd like to avoid the spurious non-exhaustive-match error in
<clockish>
in match y with `B -> 1 | `C -> 2 ;;
<clockish>
let y = (match x with `A -> `B | x -> x)
<clockish>
let f (x : [< `A | `B | `C]) =
<mrvn>
then why match twice?
<clockish>
(in the actual code I'm trying to write, there's no double match; y gets used as a key for a map)
<mrvn>
clockish: I still don't get why the type system doesn't narrow the type on it's own.
<mrvn>
you're not the first to wonder
<clockish>
Yeah, I hoped it would but it doesn't.
<octachron>
clockish, I don't think that there is any solution except matching the whole input
<Oleg>
hello , would someone please take a look at this concurrent function
<Oleg>
let rec map f = function [] -> [] | x::xs -> f x::map f xs let tmap f l = let rec help = function [] -> [] | x::xs -> let c = new_channel () in let _ = Thread.create (fun c -> sync (send c (f x))) c in (receive c)::help xs in map sync (help l)
<Oleg>
oh
<Oleg>
that went ugly
<mrvn>
let f (x : [< `A | `B | `C]) = let y = (match x with `A | `B -> `B | `C -> `C) in match y with `B -> 1 | `C -> 2 ;;
<mrvn>
clockish: if you don't have a wildcard match in the first then it works.
<clockish>
@mrvn: yeah, that seems to be the most natural way. thanks.
<Oleg>
called every time the help function is called ?
<Oleg>
so it creates some unnecessary overhead as opposed to the 2nd tmap function ?
<mrvn>
no, it's only called once
<Oleg>
oh damn
<Oleg>
of course
<Oleg>
I wonder the Thread module
<Oleg>
is really used anywhere
<mrvn>
but map is List.map and help is just map. so why have both of them at all?
<Oleg>
that's just an implementation I got from another newbie like me
<mrvn>
yeah. tell him to reuse existing functions
<mrvn>
as far as I can see the bottom is just the top with using List.map
<Oleg>
yes , that's how I wrote it :)
<Oleg>
I also didn't see any point in defining again List.map
<mrvn>
ok. so then well done.
<Oleg>
the result is as expected, I wait only 5 sec for the whole result
<Oleg>
and not 20 sec
<Oleg>
for the 4 elements
<Oleg>
thank for your time
<Oleg>
*thank you
<mrvn>
it might be even clearer to read if you define a helper function for the (fun a -> ....) and then List.map helper l
<mrvn>
or at least fix the indentation
<Oleg>
I'll do that
<mrvn>
If I have a line break in a function call then I usualy put every argument on a separate line. Except for 'Printf.pritnf "format" \n args'
<mrvn>
printf can usualy work with one or two lines total.
<Oleg>
don't you loose that elegant look then :) ?
<Oleg>
because you take too many lines?
<Oleg>
actually I should try it our for myself
<mrvn>
if it's too many lines then why didn't it fit on one line? Some of the args must be long.
<mrvn>
I don't use line breaks on "List.map add x y"
<mrvn>
Try it and see if you like it. If not then don't use it. Unlike python nobody forces you to indent a specific way. :)
<Oleg>
well it's nice when a language has a style guide
<Oleg>
like PEP 8
<Oleg>
by the way if a thread reaches this code : "sync some_arg" then it evaluates the "some_arg" and then halts until it gets an answer from the "receive" function call
<Oleg>
are my statements right ?
<Drup>
clockish: you can also add the annotation on the wildcard instead
<Drup>
the type annotation*
<mrvn>
Drup: on the x -> x? which one?
<Drup>
yeah, in the pattern
<mrvn>
so the first x?
<mrvn>
(x : [< `B | `C] ) -> x?
ygrek_ has quit [Ping timeout: 260 seconds]
<clockish>
Huh. I get a type error when I try ^ that (about how [< `B | `C] needs to include `A but doesn't)
<clockish>
(ocaml 4.04)
<Drup>
type t = [ `B | `C] ;;
<Drup>
let f (x : [< `A | `B | `C]) = let y = (match x with `A -> `B | #t as x -> x) in match y with `B -> 1 | `C -> 2 ;;
<Drup>
right, it's not exactly a type annotation, but it does what you want
<Drup>
you can expand the match too, ((`B|`C) as x) -> ...