adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.2 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
<lewis1711> I am able to use the Int32 module to create int32s. but I get the error that "add" is an unbound value
<lewis1711> is there some .cma I need to load?
<lewis1711> Int32.add, to be specific
AltGr has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
<lewis1711> it's weird, I have Int32 succ, neg, and zero
<lewis1711> but not add
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
badkins has quit []
<lewis1711> looks like the stdlib and core have different Int32 libs, and I have this one loaded, which has no arithmetic
<ollehar> lewis1711: check the interface of the module
<ollehar> well, you have (+)
<lewis1711> oh right, so core has over-written the std lib with its own special infix ops
saite has joined #ocaml
<saite> hi, a newbie(ish) question about ounit and bisect: i have a library and ounit tests for it. i also have a bisect enabled build. now i have the naive idea to improve test coverage and check progress with the bisect reports. the bisect reports however differ between ounit test runs (without change to the code).
ollehar has quit [Remote host closed the connection]
hay207 has quit [Ping timeout: 256 seconds]
smtb_ has quit [Quit: Page closed]
sp0on has joined #ocaml
tmtwd has quit [Ping timeout: 252 seconds]
toomuchtvrotsurb has joined #ocaml
hay207 has joined #ocaml
hay207 has quit [Ping timeout: 246 seconds]
dhil has quit [Quit: Leaving]
dvb_ua has joined #ocaml
hay207 has joined #ocaml
struktured has joined #ocaml
blandflakes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
sp0on has quit [Ping timeout: 264 seconds]
sp0on has joined #ocaml
dvb_ua has quit [Ping timeout: 265 seconds]
saite has quit [Quit: WeeChat 1.1.1]
lewis1711 has left #ocaml ["Ex-Chat"]
lewis1711 has joined #ocaml
<lewis1711> hmmm, I thought I was a decent functional programmer when I had a contract writing CRUD stuff in F#. I found it easier to code than something like C#. But now I am actually writing something kind of difficult in ocaml, I am finding it quite challenging. For OO type things, I know a lot of good practices - avoid inheritance, tight interfaces, composition, etc. but with FP, I am still kind of uncovering them - if there ever is an "Effec
<lewis1711> tive ocaml" or something, I wonder if "Don't nest variants too much" will be a chapter
KDr2 has quit [Ping timeout: 250 seconds]
KDr2 has joined #ocaml
bernardofpc has quit [Quit: leaving]
bernardofpc has joined #ocaml
bernardofpc has quit [Client Quit]
<Drup> lewis1711: how much variant did you nested in order to have issues ? :p
toomuchtvrotsurb has quit [Remote host closed the connection]
<Drup> (assuming you are not talking about polymorphic variants)
<lewis1711> Drup, well I had something like "Atom (SE (I32 i))" and I realised that was a bit ridiculous
bernardofpc has joined #ocaml
<Drup> is it ?
manud has joined #ocaml
<lewis1711> yeah, I feel 3 nested type constructors is too much
<lewis1711> then again I have a low tolerance for this kind of thing. I get confused easily. YMMV
<Drup> I feel like it's fine, as long as you have smart constructors and all the jazz in place
swgillespie has joined #ocaml
<lewis1711> Drup, "smart constructors" ?
<Drup> functions that are used like constructors, to build values, but do it smartly :p
<Drup> imagine you have a record type t = { foo : foo; bar : bar; baz : baz }
<Drup> you could provide a constructor : let new_t ?(foo:default_foo) ?(bar:default_bar) ~baz = { foo ; bar ; baz }
<lewis1711> oh right yeah
<Drup> it's "smart", because it has default values for some things
<lewis1711> but smart constructors don't help when you're pattern matching to do something useful with the innermost bit of data
<lewis1711> A (B (C (D e)))
<Drup> indeed
dvb_ua has joined #ocaml
jefus has left #ocaml ["Leaving"]
tmtwd has joined #ocaml
walter|r has quit [Remote host closed the connection]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
darkf has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
shinnya has quit [Ping timeout: 240 seconds]
tmtwd has quit [Remote host closed the connection]
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
ygrek has quit [Ping timeout: 246 seconds]
samrat has joined #ocaml
<lewis1711> ocaml has way too many redundant things for "import this but of functionality"
<lewis1711> in source code, do I use "use"?
samrat has quit [Read error: Connection reset by peer]
<apache2> no
<lewis1711> I *think* I need to compile everything, then #load stuff in the repl to test it. then recompile when things change
<apache2> `open` and `include/import` (cant rememberthe name)
<lewis1711> yeah include
<lewis1711> right so if I use "include Lol" for lol.ml, it will work... but only if lol.ml has been compiled. modules are reliant on compilation. I think I am getting it
<apache2> I'm not smart enough to guess how `utop` works, so I just use the regular ocaml "repl"
<apache2> you almost always want `open`
<apache2> include is for extending your current module with another
darkf has quit [Ping timeout: 248 seconds]
<apache2> open gives you access to the module and its public members
<apache2> you might need to specify the correct search path for your modules if you're attempting to load them in utop
<lewis1711> jesus this is complicated
<apache2> there's a directive called ##require or something like that
<lewis1711> ##require, #load, #use, include, corebuild, .ml, mli, .cma
darkf has joined #ocaml
MrScout has quit [Ping timeout: 248 seconds]
MrScout has joined #ocaml
raboof has quit [Ping timeout: 248 seconds]
<lewis1711> I cannot figure out at all how to load "str.cma" from ocamlbuild on the commandline
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
kushal has quit [Ping timeout: 255 seconds]
manud has quit [Quit: manud]
sp0on has quit [Ping timeout: 265 seconds]
nullcat has joined #ocaml
raboof has joined #ocaml
samrat has quit [Ping timeout: 264 seconds]
kushal has joined #ocaml
hay207 has quit [Ping timeout: 250 seconds]
dvb_ua has quit [Ping timeout: 246 seconds]
MercurialAlchemi has joined #ocaml
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
<dmbaturin> lewis1711: Try "-pkg str"
<dmbaturin> lewis1711: Also, the fun thing about #require is that it's not an OCaml REPL directive. The REPL allows you to install custom directive handlers, and findlib installs one for easy package loading, so #require target is always a findlib package rather individual library.
lewis1711 has quit [Ping timeout: 244 seconds]
lewis1711 has joined #ocaml
<lewis1711> thanks dmbaturin. It seems to be comipiling now, but trying to get multiple files communicating with each other is an issue. I'll see what I can do
<lewis1711> blergh, I can compile it but I can't #use the file I compiled..
<lewis1711> or rather the source of the file I compiled
<dmbaturin> #use is for source files. Try #load "myfile.cma";;
<lewis1711> dmbaturin, I did. "#use "myfile.ml";;
<lewis1711> that gives me an error
<lewis1711> but I can compile the file fine
<dmbaturin> Ah. I interpreted "the file I compiled" as result of compiling the file. What's the error?
mcclurmc has quit [Remote host closed the connection]
<lewis1711> dmbaturin, "Error: Unbound module Primitive "
<lewis1711> so I have to compile with the module
<lewis1711> but there's nothing in the source-code that says "hey, we are using this module"
<lewis1711> it's all done with implicit magic by the compiler
<lewis1711> maybe I am trying use ocaml in a way it's not intended - using the repl too much.
<dmbaturin> lewis1711: Odd. Could you paste the source file?
sp0on has joined #ocaml
<lewis1711> dmbaturin, sure thing
<lewis1711> whoops, wrong file for primitive.ml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<dmbaturin> lewis1711: Ah, well. When you #use it, it doesn't treat it as a module, it just loads all the definitions.
<lewis1711> hmm. so is it possible to do what I want in ocaml?
<dmbaturin> So the definitions are there, but they aren't a part of any module. You could wrap it in "module Primitive = struct ... end".
<lewis1711> ah
<dmbaturin> Then it will be correctly loaded as a module, but from compiler's point of view it would be a nested module. I don't remember if there's a nice way to have both easily.
grouzen has joined #ocaml
mcclurmc has joined #ocaml
swgillespie has joined #ocaml
divyanshu has joined #ocaml
divyanshu has quit [Quit: Textual IRC Client: www.textualapp.com]
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
manud has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
hay207 has joined #ocaml
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
keen__________24 has joined #ocaml
keen__________23 has quit [Ping timeout: 244 seconds]
mort___ has joined #ocaml
samrat has quit [Ping timeout: 240 seconds]
shinnya has joined #ocaml
samrat has joined #ocaml
octachron has joined #ocaml
<octachron> lewis1711, you can use #mod_use to load a .ml file as a module
<dmbaturin> lewis1711: Oh, by the way. Type names must always start with a lowecase letter (while data constructors must always start with a capital letter).
manud has quit [Quit: manud]
MrScout has quit [Ping timeout: 248 seconds]
<dmbaturin> octachron: Oh, good point. I was trying to remember what the directive was but couldn't. :)
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ocaml
<lewis1711> octachron, thanks I will give it a spin. yeah the first gist I accidentally pasted some F#
<lewis1711> so the type names WereCaps
ygrek has joined #ocaml
manud has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
<dmbaturin> I'm not sure what was the motivation for that rule, maybe it makes life easier for the lexer.
<lewis1711> any excuse not to use unreadableCase
ygrek has quit [Ping timeout: 244 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
creichert has quit [Remote host closed the connection]
Kakadu has joined #ocaml
TheLemonMan has joined #ocaml
TheLemonMan has quit [Changing host]
TheLemonMan has joined #ocaml
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
octachron has quit [Ping timeout: 256 seconds]
AltGr has left #ocaml [#ocaml]
<flux> dmbaturin, the F# rule or the OCaml rule?
<dmbaturin> flux: The OCaml rule. I'm not sure what the F# rule is exactly (what's it, by the way?).
<flux> no idea
sh0t has joined #ocaml
<flux> but yes, I think the idea is to make the language completely unambiguous
<flux> so parser can build and AST with only one meaning before going to the sematic level
adrien_ is now known as adrien
<flux> this is probably of great value in particular for writing AST transformations (ie. campl4)
<dmbaturin> SML doesn't have any data constructor name restrictions, but the constructors are essentially functions and if you try to define something else with that name the constructor is shadowed.
<flux> module names as well?
<dmbaturin> Module names can also be arbitrary, but I don't remember how it handles collisions.
<dmbaturin> I just follow the OCaml convention even when it's not enforced. :)
<flux> apparently the OCaml convention is the one used by the SML basis as well, except that instead of camelCase we use snake_case
KDr2 has quit [Ping timeout: 246 seconds]
KDr2 has joined #ocaml
ananas_ has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
<ananas_> Hello guys, ocamldoc doesn't recognize my named section. I declared it with : {3:reference Title} and use it on the next line : Text ({!reference}). It says : Warning: Element reference not found. What did I miss ?
pgomes has joined #ocaml
Haudegen has joined #ocaml
<ananas_> I changed the reference to {!section:reference} but it doesn't work either : Warning: Section reference not found
<ananas_> Here is the full file : (** {3:reference Title} Text ({!section:reference}) *)
Hannibal_Smith has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 246 seconds]
sh0t has quit [Remote host closed the connection]
sh0t has joined #ocaml
jabesed has joined #ocaml
KDr2 has quit [Ping timeout: 264 seconds]
rand000 has joined #ocaml
octachron has joined #ocaml
KDr2 has joined #ocaml
lewis1711 has quit [Ping timeout: 250 seconds]
lewis1711 has joined #ocaml
<lewis1711> if you have a concrete type in the interface, do you need to copy paste it into the implementation?
<lewis1711> I've declared it in the .mli, and the interface complains it doesn't know about it
<theblatte> the .ml doesn't read the .mli
<theblatte> yes you need to redeclare it
octachron has quit [Quit: Leaving]
octachron has joined #ocaml
manud has quit [Quit: manud]
<lewis1711> done
octachron has quit [Ping timeout: 256 seconds]
sh0t has quit [Ping timeout: 246 seconds]
manud has joined #ocaml
xavierm02 has joined #ocaml
<xavierm02> Hi. I have a weird error "Error: This expression has type id#0 but an expression was expected of type id#0, The type constructor id#0 would escape its scope" in this http://pastebin.com/5R7mLywP
octachron has joined #ocaml
<xavierm02> I'm trying to represent finite functions by something and operations on that something (which is a record that I call implementation). For example, the something could be PMap and the implementation would be Pmap.find etc.
<flux> t d a it id ia ot od oa id od d it ot d ia oa
<flux> no I don't have anything useful to contribute :)
<xavierm02> Yesterday, I tried to write an uncurry function for those functions and I ran into a problem: knowing the implementation of A -> (B -> C) doesn't let me get the implementation of B -> C, which I needed. So now I'm trying to package things in a GADT tree that remembers the implementation of all "subtypes".
<xavierm02> It's Drup's fault.He said my code was too verbose :o
<xavierm02> And the types were starting to take two lines
<flux> it's alright :)
<octachron> xavierm02: only two lines? ... does this mean that having 80 lines of type definition for a 20 lines function is insane?
<xavierm02> that's because I started with the trivial function
<xavierm02> get isn't even an actual function, it's just used as a notation, kind of
whirm1 has joined #ocaml
<octachron> what is the exact type of get?
<xavierm02> good question :o
<xavierm02> I might have understood the problem. In get, I expect (i : 'id) but 'id doesn't appear in the type arguments of fri because it's just implicitely linked to 'd by fi.
<xavierm02> So maybe I just have to add 'id somewhere in the type arguments of fi.
<xavierm02> By the way, can a type argument be polymorphic? I'd want to do something like that: type ('input, 'output, 'implem) func = ('input, 'output) 'implem
<octachron> no higher-kinded type in Ocaml unfortunately
<xavierm02> But oviously, tis gievs a syntax error
<xavierm02> ok :(
xificurC has quit [Read error: Connection reset by peer]
mort___ has quit [Quit: Leaving.]
<octachron> there is some ways to go around this limitation: https://github.com/ocamllabs/higher; if gadt are not giving you enough headaches
samrat has joined #ocaml
xificurC has joined #ocaml
<xavierm02> adding another type argument worked http://pastebin.com/FW0FE089
<xavierm02> thank you octachron
grouzen has quit [Ping timeout: 265 seconds]
xificurC has quit [Ping timeout: 256 seconds]
<octachron> so the problem was that you were not exposing 'id and 'od in the external type parameter of fri, this makes sense
<xavierm02> octachron: That's cheating :o It's like using Object.magic.
<xavierm02> yes
<xavierm02> is was implicitly bount to thing in 'd by fi but apparently that wasn't enough
<octachron> by the way, for this kind of type manipulation, I would go for more explicit type names and object type as type-level record
<xavierm02> you mean fi and fri?
<xavierm02> or all the 'thing?
<octachron> and for your type argument/parameter ('input,'output,'data) fi
<xavierm02> I had that yesterday
<xavierm02> but the types take two lines :o
<octachron> or even <input:'i; output:'o; data:'d> fi
<xavierm02> so that would be a class?
<octachron> no, it is a trick to use object type as "type-level record"
<xavierm02> One thing I was thinking of doing was to replace ('a, 'b, 'c) t by 'x t constraint 'x = 'a * 'b * 'c
<xavierm02> because then I can define 'x t2 = 'x t without having to expand everything
<xavierm02> is that a ad idea?
<xavierm02> bad*
<octachron> this is the same thing with object type: type 'a fi ...= constraint 'a = <input:'a;...; data:'d>
<xavierm02> oh
<octachron> I imagine opinions vary on this matter of type verbosity. But I believe it helps readability
<octachron> the advantage is that you can selectively extend your type or have nested "record". For instance, f : <data:'d;.. > -> 'd
<xavierm02> does someone have an idea of a good name for 't, 'a and 'd? For example, 'd = ((x -> y), z) PMap.t, 't = (x -> y) -> z, 'a = (unit -> z)
manud has quit [Quit: manud]
lordkryss has joined #ocaml
<xavierm02> apparently, I can remove 't :o
<xavierm02> so 'd = 'concrete_type and 'a = 'abstract_type should work
manud has joined #ocaml
jabesed has quit [Ping timeout: 246 seconds]
manud has quit [Client Quit]
<Drup> lewis1711: there is #use_mod, which is like #use, but wrap the definition in the module as you would expect
tmtwd has joined #ocaml
<lewis1711> Drup, yeah I have been using that. of course it doesn't respect interfaces
<Drup> of course it doesn't
<Drup> ok, let me tell you my repl workflow, because I feel like you are making your life complicated
<Drup> 1) #require "libraries"
<Drup> libraries are not modules, they are groups of modules
<Drup> you can see the list of libraries with "ocamlfind list"
samrat has quit [Ping timeout: 244 seconds]
<Drup> 2) Create your own library (use whatever build system you want, but use one)
ananas_ has quit [Quit: Leaving]
samrat has joined #ocaml
<Drup> 3) install and load your library, see 1)
<Drup> I basically never use #use #load, and other things
<Drup> only #require, for whole libraries
reynir is now known as bodie
bodie is now known as reynir
<lewis1711> that sounds like it requires more yak-shaving in the form of compiling "libraries"
<Drup> you are going to compile libraries anyway
<Drup> unless you never want to distribute anything, ofc
Haudegen has quit [Ping timeout: 244 seconds]
jabesed has joined #ocaml
tashjash has joined #ocaml
Haudegen has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
dvb_ua has joined #ocaml
Haudegen has joined #ocaml
<xavierm02> How do I write type typ = unit constraint 'a * 'b = unit * unit in a more readable way?
<xavierm02> type typ = unit constraint 'a = unit and 'b = unit
<xavierm02> gives a syntax error
<xavierm02> nevermind
<xavierm02> type typ = unit constraint 'a = unit constraint 'b = unit
tmtwd has quit [Ping timeout: 264 seconds]
samrat has quit [Ping timeout: 252 seconds]
ggole has joined #ocaml
lewis1711 has quit [Ping timeout: 264 seconds]
Haudegen has quit [Ping timeout: 265 seconds]
psy_ has quit [Remote host closed the connection]
Haudegen has joined #ocaml
octachron has quit [Ping timeout: 255 seconds]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
psy_ has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
tmtwd has joined #ocaml
xificurC has joined #ocaml
tmtwd has quit [Remote host closed the connection]
lordkryss has quit [Quit: Connection closed for inactivity]
accidus has quit [Ping timeout: 246 seconds]
whirm has quit [Quit: WeeChat 1.2]
whirm1 is now known as whirm
thegameg has quit [Quit: Bye bye.]
thegameg has joined #ocaml
Haudegen has quit [Ping timeout: 248 seconds]
rand000 has quit [Quit: leaving]
Haudegen has joined #ocaml
Akshay has joined #ocaml
joelr1 has joined #ocaml
<joelr1> good day! i’d like my myocamlbuild.ml to include different *.ml files in the build. any suggestion how to do this?
Akshay has quit [Ping timeout: 248 seconds]
tashjash has quit [Ping timeout: 244 seconds]
romain_ has joined #ocaml
DanielRichman has quit [Quit: leaving]
DanielRichman has joined #ocaml
DanielRichman has quit [Client Quit]
DanielRichman has joined #ocaml
<romain_> how to create an opam package for something that depends on a C++ library that has no system packages (needs a clone from github and a ./configure,make & make install dance) ?
<Drup> yes
<Drup> be careful where you install it, though
Hannibal_Smith has joined #ocaml
<romain_> are there examples I can look at?
dongcarl has joined #ocaml
BitPuffin|osx has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
drmem has quit [Ping timeout: 256 seconds]
joelr1 has quit [Quit: joelr1]
kandu has quit [Ping timeout: 240 seconds]
kandu has joined #ocaml
kandu is now known as Guest35150
<xavierm02> Is it possible to define notations for types?
<xavierm02> type ('a, 'b) (-->) = 'a -> 'b
<xavierm02> or something similar?
<asmanur> I don't think so
<xavierm02> ok, thanks :(
struktured has quit [Ping timeout: 244 seconds]
<xavierm02> I just checked the syntax of type expressions and they speak explicitely of -> and *, so you must be right :/
Akshay has joined #ocaml
lobo has joined #ocaml
<ggole> typeconstr-name::=lowercase-ident
<ggole> So boring names only
<ggole> Consider it a feature :)
IAmGilesCorey has joined #ocaml
<IAmGilesCorey> Hello
<IAmGilesCorey> I haven't used Ocaml in a long while and want to get back into it
<IAmGilesCorey> Is tuareg still the way to go? for emacs integration?
walter|r has joined #ocaml
<Akshay> sublime + cl works fine for me. i'm not a emacs user !!
<flux> so brave :)
<flux> iamgilescorey, tuareg, merlin and ocp-indent
<flux> iamgilescorey, you'll be amaazed with merlin!
<IAmGilesCorey> I see, thank you flux
<flux> iamgilescorey, you know opam, right?
<IAmGilesCorey> another quick question http://ideone.com/xLYTSh It doesn't compile if I use only ; but I thought ;; were only needed inside the interpreter
<IAmGilesCorey> flux: heard of it, it's the package manager right? I don't believe I've used it much, maybe once or twice
<flux> iamgilescorey, yes. it will make it a lot easier to install packages you want to ocaml. also, a lot easier to use a compiler version other than the provided by your operating system (ie. linux distribution)
<IAmGilesCorey> I remember there was a build tool that was a bit of magic, It would figure out dependencies and stuff without you having to configure anything, you could just get in the folder and say the main file and name of your executable (perhaps I am wrong about the usage)
<IAmGilesCorey> well for the first program I plan to do I think I have all I need in the standard library, but as time goes I would sure learn to use it :)
<flux> iamgilescorey, ocaml programs are composed of phrases. a phrase is _either_ a list of top-level statements (definitions in ocaml language), or a single expression. phrases are separated with ;;
<flux> iamgilescorey, well, even if all you 'need' is in the standard library, it can be quite convenient to use other libraries.. even for things like getting the contents of a file as a list of lines.
<IAmGilesCorey> the standard library doesn't have that?
<flux> nope. you open file, read contents, etc, close file
<IAmGilesCorey> that is exactly what I need btw, getting the contents of a file as a list of lines
<flux> so it has the building blocks.
<flux> iamgilescorey, so what you have there is a definition ;; definition ;; expression ;; expression ;; expression ;;
<flux> and that works
<flux> but also this works: definition definition definition definition definition
<flux> you can make an expression a definition with let: let _ = print_string b
<IAmGilesCorey> If I remove all the ;; I get syntax error I think, may be wrong let me check
<IAmGilesCorey> oh
<flux> but a better way in your scenario would be to put all those side-effectful operations within a single definition
<IAmGilesCorey> you discard the output, since it's Unit?
<flux> well, _ matches all types, so yes, it discards unit as well
<flux> let () = print_string b; print_string "hello" works as well
<IAmGilesCorey> I tohught _ was just a name, it has special meaning?
<flux> it has special name but you could call it 'just' a name as well..
<IAmGilesCorey> I take it _ and () are not names,? as in let a = something ?
<flux> except you cannot have a variable called _ :)
<flux> so _ is really a pattern
<flux> let a = .. -- there the a is also a pattern
<flux> but it binds the variable 'a' to the right-hand side of the =
<IAmGilesCorey> like when you do match and use _ for everything else?
<flux> exactly
<flux> let _ = 5 in .. is much like match 5 with _ -> ..
<flux> so let is a one-case pattern matching construct
<IAmGilesCorey> I see, that makes sense to a degree, I always saw let x = as in variable binding
<nicoo> IAmGilesCorey: _ is a non-binding wildcard, in patterns
<IAmGilesCorey> ok, I think I understand now
<IAmGilesCorey> because I never realized that when you do a match you're actually binding local variables
<IAmGilesCorey> and you can use _ inside a match as well, I mean Foo(x,y,_)
<IAmGilesCorey> could you please recommend me a library that would allow me to get a list of lines from a file?
<flux> well, I've recently used Containers
<flux> but batteries and core surely know how to do it as well
<romain_> I don't think you should call them 'variables'
<romain_> (they do not 'vary')
<flux> they in fact do vary
<flux> call-to-call
<flux> let a x = x -> x varies depending on the call, ie. it's not a constant
<romain_> one could argue the next call has a different x
<flux> yet the same exact symbol in the source code
<romain_> it's nitpicking, I agree.
<flux> have you ever heard of mathematics using f(x) and saying x is a variable?-)
<romain_> yes, but a math function is not a code function
<flux> how is it not?
sailorswift has joined #ocaml
<romain_> a function is a certain subset of a product of 2 sets
mcclurmc has joined #ocaml
<ggole> "Variable" is a bit vague but it seems very reasonable to call ocaml's bindings variables.
sailorswift has quit [Read error: Connection reset by peer]
sailorsw_ has joined #ocaml
<romain_> isn't "name" a better way to use?
<ggole> No, because the same name can be several different bindings.
<romain_> and for a the x in a function call "argument"
|jbrown| has joined #ocaml
<def`> what's the point of discussing established vocabulary?!
<IAmGilesCorey> thank you flux I will take a look
hay207 has quit [Ping timeout: 246 seconds]
<romain_> well, it isn't as established as you might think
<def`> lol
<romain_> and also, I have seen people threat them the same way as they did in python: let a = 5 in ............let a = 7 in ............. let a = 9 in ........
<romain_> and then get confused as these things are not assignments of a value to a variable
<def`> poor them
<flux> the confusion will clear soon enough :)
<flux> perhaps even as soon as they learn about :=
<flux> (or <-)
<romain_> well, fwiw, the OCaml manual states "OCaml has no built-in notion of variable"
<Akshay> for me let x = 5 means you cannot change it on runtime, but you can change ref or mutable vars.
<Akshay> n00b++
<romain_> but uses 'identifier' for the left hand side in a let
<flux> the ocaml manual also has the subtitle "Variable pattern" ;)
<flux> (title of a subchapter)
<romain_> ha. it also uses "variable" for names in type definitions
tashjash has joined #ocaml
<flux> identifier itself also refers to most anything :)
sailorsw_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Akshay> are there any good video tutorial on ocaml ?
<flux> I bet it doesn't call the xx in 'type xx' a variable
sailorswift has joined #ocaml
<flux> akshay, I don't know of one, but there are interactive top-levels online that may be of interest..
<flux> but I don't know if there are better ones than that
<Akshay> looks good, thanks
<romain_> the manual even uses 'variable' for the result of a function at some point.
<romain_> now that it has my attention....
<romain_> it mixes 'identifier' 'variable' and 'argument'
<def`> The manual is not formal.
<def`> But anyway, when one refers to the free variables of a term, the meaning is pretty clear
<def`> (up to namespace)
<romain_> yes, most of the time, it's all pretty clear.
<romain_> just things like "thread" are FOOBAR
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
mcclurmc has quit [Remote host closed the connection]
romain_ has quit [Ping timeout: 256 seconds]
ygrek has joined #ocaml
Haudegen has quit [Ping timeout: 265 seconds]
dongcarl has quit [Quit: Leaving...]
MrScout has joined #ocaml
Haudegen has joined #ocaml
kawaii-imouto has quit [Quit: reboot]
<MercurialAlchemi> has anybody tried Jane Street's Incremental?
pyon has joined #ocaml
dongcarl has joined #ocaml
dongcarl has quit [Remote host closed the connection]
dongcarl has joined #ocaml
MrScout has quit [Ping timeout: 248 seconds]
|jbrown| has quit [Ping timeout: 244 seconds]
dongcarl has quit [Quit: Linkinus - http://linkinus.com]
dongcarl has joined #ocaml
dongcarl has quit [Remote host closed the connection]
dongcarl has joined #ocaml
dongcarl has quit [Remote host closed the connection]
dongcarl has joined #ocaml
pgomes has quit [Quit: Leaving]
dongcarl has quit [Ping timeout: 260 seconds]
lobo has quit [Ping timeout: 265 seconds]
lobo has joined #ocaml
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
struktured has joined #ocaml
swgillespie has joined #ocaml
grouzen has joined #ocaml
darkf has quit [Quit: Leaving]
Akshay has quit [Quit: Leaving]
kdas__ has joined #ocaml
struktured has quit [Ping timeout: 248 seconds]
kushal has quit [Ping timeout: 256 seconds]
PM has joined #ocaml
lyxia has quit [Ping timeout: 264 seconds]
ygrek has quit [Ping timeout: 264 seconds]
walter|r has quit [Remote host closed the connection]
PM has quit [Client Quit]
PM has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
PM has left #ocaml [#ocaml]
ygrek has joined #ocaml
ggole has quit [Ping timeout: 240 seconds]
<vbmithr> somebody with a thinkpad x220 and a working microphone ?
<bbc> yes
Hannibal_Smith has joined #ocaml
<flux> mercurialalchemi, I'm not sure if there are so many common tasks that are applicaple to it, even though it does seem interesting :)
<flux> apparently its ui-related applications are mostly covered by the reactive frameworks?
xavierm02 has quit [Quit: Page closed]
jabesed has quit [Ping timeout: 244 seconds]
|jbrown| has joined #ocaml
sailorswift has joined #ocaml
<Maelan> I am a bit puzzled by ocamldep’s behaviour.
<Maelan> According to my experiments, if module A depend on both B and C, where C has no .mli file, then it would generate the dependency rule ‘A.cmo: B.cmi C.cmx [A.cmi]’ (the last item occuring only if A.mli exists, which is logical).
<Maelan> s/cmx/cmo
creichert has joined #ocaml
<Maelan> Although I believe what we are really interested in is nothing the .cmi file of each module, whether they originally have a .mli or not, I understand this feature as C.cmi is actually produced as a side-effect of producing C.cmo in that case.
<Maelan> But what I don’t understand is that for native-code compilation, ocamldep says ‘A.cmx: B.cmx C.cmx [A.cmi]’
<Maelan> with .cmx everywhere, even for modules that do have a .mli.
<Maelan> Why is that?
<Maelan> (*nothing *but* the .cmi)
<Maelan> Actually, I feel quite frustrated with ocamldep, and usually chain it with sed and the like.
<Maelan> ocamldep does not appear to handle the case of different directories for source and object files, so I have a ‘sed’ for that.
jabesed has joined #ocaml
<def`> Maelan: dependencies on .cmx is probably introduced because of inlining
<Maelan> And, as I believe the truly accurate behaviour is not to rely on .cm[ox] but on .cmi — which have to be compiled differently in the presence or absence of a .mli —, I have another ‘sed’ for that (essentially s/.cm[ox]/.cmi/g).
<def`> Removing dependencies on cmx is incorrect because of what I said
<Maelan> That way, deps are not broken if I ‘rm *.cmi’ after having produced the *.cmx.
<Maelan> def`, so it is “only” for the purpose of optimisation?
<def`> yes
<Maelan> And can the optimising compiler actually fail if I give him .cmi instead of .cmx?
<Maelan> I mean, can’t it just decide not to inline things from that module, seeing I am giving him a .cmi?
<def`> The linking will fail if you have recompiled a cmx and not its reverse-dependencies
<def`> If you use ocamlobjinfo on a cmx, you will see two lists of dependencies
<def`> One on interfaces, one on implementations.
<def`> There is maybe a flag to prevent that :'
<def`> I guess -opaque
<def`> It doesn't appear in the manpage, but does in ocamlopt -help
<Maelan> Oh, OK, thanks.
nullcat has joined #ocaml
<Maelan> 21:52 def`│ The linking will fail if you have recompiled a cmx and not its reverse-dependencies → Because code from B.cmx inlined in a A.cmx would not be in sync with the new B.cmx, and A.cmx would not be regenerated because it does not depend on B.cmx?
<def`> Yes.
<Maelan> But if when generating A.cmx, you give B.cmi and never B.cmx to the compiler, can there be such inlining?
<Maelan> Or it means the compiler silently read B.cmx as well?
<Maelan> (as when giving B.cmx, B.o is implicitly read)
<def`> The compiler will silently read
<def`> (but if the file is absent, it won't fail, it will just disable inlining)
<def`> The purpose of -opaque is to prevent this behavior, I think (I did not check and documentation is not helping much, take with a grain of salt)
<Maelan> I will try to make up a test for that, but I am not familiar with inlining. What kind of function I may write to provoke inlining?
<def`> simple accessor for the field of a record
creichert has quit [Read error: Connection reset by peer]
<def`> type t = { a : int } let a x = x.a;;
tashjash has quit [Quit: Leaving]
|jbrown| has quit [Ping timeout: 250 seconds]
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
|jbrown| has joined #ocaml
ygrek_ has quit [Ping timeout: 264 seconds]
SomeDamnBody has joined #ocaml
<SomeDamnBody> Hey I can't install ocamlfind when I'm using ocamljava compiler
<SomeDamnBody> It gives: .opam/ocamljava-2.0-alpha2/lib/ocaml/compiler-libs/toploop.cmi and .opam/ocamljava-2.0-alpha2/lib/ocaml/compiler-libs/parsetree.cmi
<SomeDamnBody> # make inconsistent assumptions over interface Warnings
dvb_ua has quit [Ping timeout: 256 seconds]
swgillespie has joined #ocaml
lewis1711 has joined #ocaml
psy_ has quit [Read error: Connection reset by peer]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
swgillespie has joined #ocaml
psy_ has joined #ocaml
|jbrown| has quit [Ping timeout: 244 seconds]
<Hannibal_Smith> lewis1711, personally I found his message interesting
<lewis1711> He's a famous troll. some day he will fall out of love with F# and troll their groups
Anarchos has joined #ocaml
<Hannibal_Smith> Yes when I was reading something on SO, I remember even reading someone commenting in a Harrop's answer "He is a famous troll, please ignore him"
<lewis1711> he's a good troll though
|jbrown| has joined #ocaml
<Hannibal_Smith> I follow him on Twitter, and I remember some random critics also to F#
badkins has joined #ocaml
<Hannibal_Smith> Primary because the lacks of money that MS spend for F#, and the drop of jobs for it
<lewis1711> I sorely miss my old contract as a lone programmer - primarily because I could choose what I program in, and chose F#
<lewis1711> there's a drop in jobs? that's a real shame
<Hannibal_Smith> Found the tweet I was referring to https://twitter.com/jonharrop/status/544994165147586561
ygrek_ has joined #ocaml
<Maelan> So you were right for -opaque
<lewis1711> 'why do I always have such issues with lines like 31. 'Parse error: ":" or ")" expected after [patt] (in [patt])'
<Maelan> (I eventually used something as simple as ‘let b = 0’ for inlining.)
sailorswift has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Maelan> I said something silly sooner, you do not even pass the .cmi files during the compiling phase, the compiler finds out everything alone. :/
<Maelan> So I should fix my Makefile.
<Maelan> I think I’ll just add a -opaque, that’s the simplest.
<Maelan> And it keeps the same structure as for bytecode compilation.
creichert has joined #ocaml
myam has joined #ocaml
myam has left #ocaml ["Leaving..."]
Aym_C has joined #ocaml
Aym_C is now known as myam
myam is now known as ach__
ach__ is now known as aym_ch
aym_ch is now known as myam
SomeDamnBody has quit [Ping timeout: 246 seconds]
myam has left #ocaml [#ocaml]
Hannibal_Smith has quit [Quit: Leaving]
sivoais has quit [Ping timeout: 244 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
SomeDamnBody has joined #ocaml
sivoais has joined #ocaml
SomeDamnBody has quit [Ping timeout: 255 seconds]
<nullcat> Obj.magic has type 'a -> 'b. I am thinking if one can write an OCaml function that has same type signature.
<nullcat> i mean... a regular expression...
<nullcat> a regular function
<nullcat> maybe my brain just doesn't work and it should be very easy to come up with one...
<def`> let f _ = raise Not_found
<nullcat> ...
<def`> let rec f x = f x;;
<Drup> let rec f x = f x
<Drup> !
<nullcat> cool!
Armael has left #ocaml ["WeeChat 0.4.3"]
<Drup> nullcat: basically, you need one form of unsafeness (exception, non termination, black magic)
<nullcat> that could be an interesting interview question...
<nullcat> i see
<nullcat> black magic
<Drup> No, it's not an interesting interview question
<nullcat> write as many as possible ....
<lewis1711> "| IR.List (IR.procedure p)::args -> apply p args": is there anything obviously wrong with that syntax?
<nullcat> well. ok it's not
<Drup> lewis1711: IP.procedure
<lewis1711> Drup, I would put up with a lot of stupid interview questions if they were actually interested in ocaml
manud has joined #ocaml
<lewis1711> Drup, you can't have modules in a pattern match?
<Drup> lewis1711: it's probably IP.Procedure
<Drup> with a capital leter
<lewis1711> nope
<lewis1711> to be clear it's a syntax error
<lewis1711> not a "dunno what this is error" or a type error
<lewis1711> Parse error: ":" or ")" expected after [patt] (in [patt])
<Drup> I know, my answer still stand
<Drup> "f x" is not a valid pattern
<Drup> "F x" is a valid pattern
<lewis1711> Ohhhhh
<lewis1711> right, the type was procedure. but I was using the wrong... type constructor thing
<lewis1711> that would have taken me all day to figure out on my own, thanks
manud has quit [Quit: manud]
ollehar has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
whirm has quit [Quit: WeeChat 1.2]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
wagle has quit [Read error: Connection reset by peer]
wagle_ has joined #ocaml
walter|r has joined #ocaml
walter|r has quit [Read error: Connection reset by peer]
walter|r_ has joined #ocaml
wagle_ has quit [Read error: Connection reset by peer]
wagle has joined #ocaml
wagle has quit [Ping timeout: 246 seconds]
wagle has joined #ocaml
martinium has quit [Remote host closed the connection]
contempt has quit [Ping timeout: 252 seconds]
|jbrown| has quit [Quit: Client exiting]
Kakadu has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
manud has joined #ocaml
SomeDamnBody has joined #ocaml
systmkor has quit [Quit: Leaving]
sailorswift has joined #ocaml
lobo has quit [Quit: leaving]