adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
benmachine has quit [Remote host closed the connection]
sw2wolf has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.9.2]
milosn_ has joined #ocaml
milosn has quit [Ping timeout: 248 seconds]
lolcathost has quit [Ping timeout: 255 seconds]
mattrepl has joined #ocaml
mattrepl has quit [Client Quit]
lolcathost has joined #ocaml
doomrobo has joined #ocaml
<doomrobo> hey, there
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
mattrepl has joined #ocaml
mattrepl has quit [Client Quit]
cdidd has quit [Ping timeout: 248 seconds]
weie has joined #ocaml
cdidd has joined #ocaml
doomrobo is now known as doomrobo|away
lolcathost is now known as Automorphism
sw2wolf is now known as sw2wolf{away}
Automorphism has quit [Ping timeout: 260 seconds]
lolcathost has joined #ocaml
doomrobo|away has quit [Quit: Leaving]
cdidd has quit [Read error: Connection reset by peer]
cdidd has joined #ocaml
Submarine has quit [Ping timeout: 264 seconds]
loy has joined #ocaml
lolcathost is now known as Automorphism
loy has quit [Remote host closed the connection]
sw2wolf{away} is now known as sw2wolf
cdidd has quit [Read error: Connection reset by peer]
weie has quit [Quit: Leaving...]
Yoric has joined #ocaml
sw2wolf is now known as sw2wolf{away}
adotbrown has quit [Ping timeout: 265 seconds]
ttamttam has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
thomasga has joined #ocaml
Automorphism has quit [Ping timeout: 276 seconds]
Demitar has quit [Ping timeout: 276 seconds]
lolcathost has joined #ocaml
ftrvxmtrx_ has joined #ocaml
adrien_o1w has joined #ocaml
adrien_oww has quit [Ping timeout: 265 seconds]
thomasga has quit [Quit: Leaving.]
chambart has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
weie has joined #ocaml
Yoric has joined #ocaml
mika1 has joined #ocaml
adotbrown has joined #ocaml
cago has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
djcoin has joined #ocaml
thomasga has joined #ocaml
adrien_o1w is now known as adrien_oww
mye has joined #ocaml
gour has joined #ocaml
ontologiae has joined #ocaml
RagingDave has joined #ocaml
fusillia has joined #ocaml
adotbrown has quit [Ping timeout: 264 seconds]
adotbrown has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
myx has joined #ocaml
gour has quit [Disconnected by services]
gour_ has joined #ocaml
sw2wolf{away} has quit [Remote host closed the connection]
adotbrown has quit [Ping timeout: 260 seconds]
_andre has joined #ocaml
adotbrown has joined #ocaml
adotbrown has quit [Ping timeout: 264 seconds]
Kakadu has joined #ocaml
Kakadu has quit [Client Quit]
Kakadu has joined #ocaml
mika1 has quit [Quit: Leaving.]
mika1 has joined #ocaml
mika1 has quit [Client Quit]
hkBst has quit [Read error: Connection reset by peer]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
dwmw2_gone is now known as dwmw2
weie has quit [Quit: Leaving...]
thizanne has quit [Ping timeout: 264 seconds]
fusillia has quit [Read error: Connection reset by peer]
cago has quit [Ping timeout: 252 seconds]
invariant has joined #ocaml
cago has joined #ocaml
<invariant> How can I execute a command for every file in a directory? Is there a library which doesn't require me to write a loop is mostly what I want to know.
<asmanur> Array.map (fun s -> ...) (Sys.readdir "directory")
<Kakadu> Does somebody understand what they want to get there? http://www.cl.cam.ac.uk/projects/ocamllabs/projects/ocamldoc.html
<invariant> Why doesn't it return an array of filenames instead of an array of strings?
<invariant> OCaml is a strongly typed language and this is one of those areas where that could have been applied.
<asmanur> what is a filename ?
chambart has quit [Ping timeout: 246 seconds]
<Qrntz> excuse my ignorance, but how is a filename different from a string?
<invariant> asmanur, what is going to happen when I do Array.map (fun s -> remove s) (Sys.readdir "directory") for example?
leoncamel has joined #ocaml
answer_42 has joined #ocaml
<invariant> Will that delete the file in the cwd?
<invariant> Or the file in the directory being processed.
<adrien_oww> invariant: ocaml-fileutils
<asmanur> file being processed
<asmanur> probably
<asmanur> directory*
<invariant> asmanur, 'probably' is not what I want to hear of course :)
<asmanur> i believe readdir only returns file names and not full path
<adrien_oww> ocaml-fileutils
<invariant> asmanur, yes, it only returns the file name.
<invariant> adrien_oww, yes, thank you.
<invariant> Who maintains ocamlcore.org? The certificates are failing.
<Kakadu> invariant: famous issue
<adrien_oww> it works for me
<adrien_oww> you or your browser probably doesn't trust it
<adrien_oww> that's another matter
<Kakadu> I aways run wget --dont-check-certificate
<invariant> adrien_oww, wget in this case.
<adrien_oww> same
<adrien_oww> it's the whole HTTPS thing
ski has quit [Ping timeout: 264 seconds]
ski has joined #ocaml
<invariant> What's the relation between directories and module names, if any?
<invariant> foo.ml => module Foo dir/foo.ml => Dir.Foo?
<Qrntz> folders don't affect the module hierarchy, which is mostly plain
<Qrntz> if you have foo.ml and dir/foo.ml you're going to have two «Foo» modules in different directories
<invariant> How can I introduce a module like Abc.Foo then?
<Qrntz> there are the -pack and -for-pack options to the compiler, but I honestly have never used them
<Qrntz> you can define it explicitly in abc.ml
<Qrntz> or use packing
<Qrntz> depends on what you aim for, really
ttamttam has quit [Quit: ttamttam]
<invariant> It is a closed issue, but it doesn't say that it has been fixed.
* Qrntz shrugs
tane has joined #ocaml
justdit has joined #ocaml
Yoric has joined #ocaml
mika1 has joined #ocaml
tane has quit [Quit: Verlassend]
chambart has joined #ocaml
mika1 has quit [Quit: Leaving.]
mika1 has joined #ocaml
mika1 has quit [Quit: Leaving.]
mika1 has joined #ocaml
Yoric has quit [Ping timeout: 252 seconds]
adotbrown has joined #ocaml
Tobu has joined #ocaml
adotbrown has quit [Ping timeout: 246 seconds]
Demitar has joined #ocaml
RagingDave has quit [Quit: Ex-Chat]
Yoric has joined #ocaml
elixey has quit [Ping timeout: 276 seconds]
elixey has joined #ocaml
Snark_ has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
mye has quit [Quit: mye]
hkBst has quit [Quit: Konversation terminated!]
thizanne has joined #ocaml
justdit has quit [Ping timeout: 255 seconds]
RagingDave has joined #ocaml
xavierm02 has joined #ocaml
ousado has joined #ocaml
ousado has quit [Changing host]
ousado has joined #ocaml
<xavierm02> I'm trying to start using emacs
<xavierm02> and it kind of works
<xavierm02> but I can't get it to build and evaluate with just one command
<xavierm02> I used
<xavierm02> ocamlbuild %f.byte --
<xavierm02> but here apparently it just gives the filename as an argument so it fails T.T
mattrepl has joined #ocaml
q66 has joined #ocaml
<invariant> val make_filename : string list -> filename == Make a filename from a set of strings. Since when does this count as documentation?
<thelema> xavierm02: I just use C-c C-C and then type out my build command: make foo - makfiles become a simple scripting language
<thelema> invariant: in batteries' pathgen?
<invariant> I really wonder what someone moves to write documentation like that.
<adrien_oww> it concatenates the path components
<mk270> is there some ocaml-related meeting in cambridge tonight?
<invariant> I mean: either don't write it, or write something good.
<thelema> invariant: I'm bettng that it concatenates with "/" as separator
<invariant> thelema, yes, that was also my guess.
<mk270> i don't think it's socially responsible to invite people to think that there may be other pathname separators
<asmanur> invariant: submit a patch to the documentation then :)
<invariant> Programming is an exact business; if you have to guess, correctness is going to depend on a sequence of guesses.
<adrien_oww> the types matter a lot here and give a lot of meaning
<mk270> how do you submit a patch to the documentation?
<invariant> I wouldn't mind fixing the documentation by clicking on that website and making it better.
<invariant> But sending out a patch would mean setting up a patch infrastructure.
<thelema> invariant: easier than that; submit a bug report with better text.
<invariant> Who controls ocamlcore.org?
<thelema> sylvain, the author of ocaml-fileutils
<thelema> (coincidentally)
atoll has joined #ocaml
ArthurD has joined #ocaml
<xavierm02> I want to have a program
<xavierm02> that builds automata
<xavierm02> so I want to use the set representations of automata
<xavierm02> is there any way I could do a type
<xavierm02> type ('state, 'letter) automaton
<xavierm02> ?
<flux> sounds the way it would normally be done?
<xavierm02> yeah
<xavierm02> well
<flux> ah, so you're asking if you can have Set based on a polymorphic type
<xavierm02> the things I saw were using functions
<xavierm02> yes
<xavierm02> and apparently I can't :(
<xavierm02> aide from doing my own unefficient set structure
<xavierm02> aside*
<xavierm02> oh wait
<xavierm02> I have to use a functor
<xavierm02> right?
<flux> I think it's possible to use the Set here, thanks to the newish type binding feature
<flux> yes, and you use functor on that
<xavierm02> what "newish type binding feature"?
<flux> I think it was introduced in 3.12.1, it works like:
<flux> let foo (type a) a = let module S = Set.Make(struct type t = a let compare = compare) in S.singleton a
<flux> or something
<flux> figured that it wouldn't work (besides the missing 'end') due to type escape issue
<flux> but you can do everything else but return values of type S.t
<flux> so what you do is that you have a record of operations and you return such a record from that function
<flux> xavierm02, but maybe a better approach is to functorize your state machine as well
<flux> xavierm02, I mean, what if I want to use custom records for state and input?
<xavierm02> you lost me
tane has joined #ocaml
<xavierm02> I'll just try doing it with functions
<flux> where did I lose you?
<xavierm02> and show you and you tell me what I did wrong
<xavierm02> last 3 posts
<djcoin> flux: is S.singleton part of some std lib ? and also what does let foo (type a) a is supposed to mean ? (i'm sorry I don't use ocaml frequently and I often missed some features)
<flux> djcoin, Set.S.singleton is part of std lib, so it becomes part of the local S module as well
<flux> djcoin, (type a) means somewhere there is a type called 'a' that is the same during the definition of that function
<flux> in this case the variable 'a' gets bound to that type 'a'. maybe I shouldn't have used the same name :)
<flux> untested: let mk_set (type a) () = let module S = Set.Make(struct type t = a let compare = compare) in let s = ref S.empty in let add x = s := S.add x !s in let mem x = S.mem x !s in (add, mem)
<flux> I'm uncertain how to make that functional, though. ideas?
teamon has left #ocaml []
<flux> (and again I missed 'end' in "compare)")
<djcoin> It is like extracting/factorizing a type constraint on top of the function ?
<flux> djcoin, sort of. it's giving a name to a type. you could write: let foo (type a) (x : a) = ..
<djcoin> like a let definition but for a type in a sense ?
<flux> and when you have a name to the type, you can then create modules referring to that name
<flux> and you could use those modules with functors
<djcoin> Ok, thanks for the explanation didn't know this feature
<djcoin> :)
<xavierm02> oh
<flux> I imagine many people have tried this but failed, before that feature was implemented: let foo (a : 'a) = let module M = struct type t = 'a ..; but that of course fails due to 'a not being anymore in the scope
<flux> so it sort of is an enlargened scope for type variables (with name)
<xavierm02> any idea where I could find ORDERED_SET
<xavierm02> module type ORDERED_TYPE =
<xavierm02> sig
<xavierm02> type t
<xavierm02> val compare: t -> t -> comparison
<xavierm02> end;;
<xavierm02> ?
zorun has joined #ocaml
<xavierm02> because I need to use the one used by Set
<xavierm02> right?
<flux> xavierm02, I created those in my examples :)
<xavierm02> I can't just redefine a new one
<flux> the struct-part
<flux> why not?
<xavierm02> O_O
<xavierm02> Well... Last time I defined the exact same type in two different modules I get very strange errors
<flux> try this: module S = Set.Make(struct type t = int let compare = Pervasives.compare end);;
<xavierm02> so I thought I had to reference it somehow
<flux> you can give it a name if you want..
<flux> batteries comes with modules Int etc that are compatible with that signature
mgodshall has joined #ocaml
<xavierm02> ok
mye has joined #ocaml
<zorun> hi
<xavierm02> ty
<zorun> I have a collection of modules, all with the same signatures
<zorun> I'd like to bind a module name to point to one of them, depending on some condition
<flux> you can use first class module support for that
<zorun> I haven't found any way to do that, since you can't really manipulate modules
<zorun> oh, right
<zorun> oh, that was the new feature from ocaml 3.12 \o/
<xavierm02> open Set;;
<xavierm02> module Automaton =
<xavierm02> functor (Elt: ORDERED_TYPE) ->
<xavierm02> struct
<xavierm02> type q = int
<xavierm02> end
<xavierm02> ;;
<xavierm02> ORDERED_TYPE
<xavierm02> Error: Unbound module type ORDERED_TYPE
<xavierm02> do I really just add the definition and it works?
<zorun> do you want to define a functor, or to simply use an existing one?
<flux> the module type is actually OrderedType.. it's only called ORDERED_TYPE when it's the parameter..
<xavierm02> well
<flux> where did you pick that ORDERED_TYPE?
<xavierm02> I'll have my Automaton functor use the Set functor
<xavierm02> and the Set functor needs modules of type ORDERED_TYPE
<xavierm02> so it must be defined somewhere in Set :/
<flux> according to what reference?
<xavierm02> ok don't mind me
<xavierm02> I'm stupid
<xavierm02> it's OrderedType
<xavierm02> I just had
<xavierm02> an old page apparently
<xavierm02> >_<
wossname has joined #ocaml
<xavierm02> open Set;;
<xavierm02> module Automaton =
<xavierm02> functor (Elt: OrderedType) ->
<xavierm02> struct
<xavierm02> type q = Set.Make(Elt)
<xavierm02> end
<xavierm02> ;;
<xavierm02> How do I do that?
<flux> you know, you could just compress those to oneliners or use a paste site.. ;)
<flux> type q = Set.Make(Elt) is the problem, right?
<xavierm02> yes
<xavierm02> Syntax error
<flux> I think you probably want to do
<flux> module MySet = Set.Make(Elt) instead
<flux> and possibly type q = MySet.t
<flux> unless you intend to use the first class module support
<flux> then I'm not sure of the syntax, but you can read all about it here: http://www.math.nagoya-u.ac.jp/~garrigue/papers/ml2010-show.pdf
Snark_ is now known as Snark
<xavierm02> ty :)
<flux> btw, I don't think you -need- first class module support for this particular task
<flux> (unless you wish to defunctorize it at some point)
<xavierm02> O_O
<xavierm02> searching for the meaning of defunctorize I found out there were polymorphic sets
<xavierm02> although I don't understand how it's not as good for type safety
<flux> you have have sets of the same data but differente comparison function
<flux> if you combine those sets somehow, you may end up breaking things
<flux> and the type system won't stop you
<xavierm02> oh
<flux> in fact those sets have been, well, neutered in batteries2
cdidd has joined #ocaml
<flux> in batteries 2.0.1 they can only use the polymorphic comparison function
<flux> this ensures all sets of the same type use the same comparison function
<flux> it would still work pretty nice for your use case, though, and I imagine many other cases as well
atoll has quit [Ping timeout: 248 seconds]
<thelema> yes, you should use the polymorphic sets
<thelema> in batteries.
<thelema> flux: the un-neutered version is still available as Set.PSet
<xavierm02> ok
<xavierm02> Just before letting the functor thing go
<xavierm02> why is it I can't open the Tuple module
<xavierm02> Tuple doesnt work
<xavierm02> BatTuple doesnt
<xavierm02> I'd have though it was new
<xavierm02> but apparently it's at least 1yo
RagingDave has quit [Quit: Ex-Chat]
ftrvxmtrx_ has quit [Quit: Leaving]
<thelema> Ah, the tuple submodules are directly added to the toplevel namespace
RagingDave has joined #ocaml
<thelema> so just do Tuple2.map1, etc.
<thelema> I thought that Tuple.Tuple2.map1 should also work.
<thelema> yes, that should also work...
<xavierm02> ah >_<
<invariant> xavierm02, there are highly optimized automata implementations. Implementing your own is likely not a smart idea.
<xavierm02> Except that I have a contest where I need to use ocaml at the end of the year
<xavierm02> and that the better I understand it
<xavierm02> the less likely I'll get stuck with somethign stupid like Array.make n (Array.make m init)
<xavierm02> so I use the structures that I kno will be there
<xavierm02> Sets etc.
<xavierm02> but nothing more
<xavierm02> module Transition = Tuple3.Ord State Letter State
<xavierm02> why doesn't this work?
<thelema> functors aren't applied with spaces, but with ( , )
<flux> (State)(Letter)(State)
<thelema> or rather ()()()
<xavierm02> ty :)
<xavierm02> module Transition = Tuple.Tuple3.Ord (State) (Letter) (State)
<xavierm02> module Transition = Tuple3.Ord (State) (Letter) (State)
<xavierm02> both tell me module doesn';t exists >_<
<thelema> xavierm02: is the rest of batteries available?
<xavierm02> yes
dwmw2 has quit [Ping timeout: 260 seconds]
<xavierm02> i think
<xavierm02> wait
<xavierm02> maybe I'm stupid and just use the default lib
<xavierm02> without noticing >_,
<thelema> :)
<xavierm02> I'll doublecheck
mye has quit [Ping timeout: 248 seconds]
dwmw2_gone has joined #ocaml
<xavierm02> I have this
<xavierm02> ocamlbuild -use-ocamlfind -r Automaton.byte --
<xavierm02> and a _tags with this: <*>: package(batteries), thread;
weie has joined #ocaml
cago has left #ocaml []
<xavierm02> ocamlfind batteries/ocaml works
<xavierm02> so I guess I could call ocamlbuild with many arguments so that it uses batteries's binaries
<xavierm02> but isn't there something simpler?
hto has quit [Read error: Connection reset by peer]
mika1 has quit [Quit: Leaving.]
<thelema> ocamlbuild -use ocamlfind -tag "package(batteries)" Automaton.byte ?
djcoin has quit [Quit: WeeChat 0.3.9.2]
Yoric has quit [Quit: Instantbird 1.4a1pre -- http://www.instantbird.com]
<xavierm02> I can always open Set and BatSet (with our without the -tag)
<xavierm02> but in both cases
<xavierm02> Tuple isnt defined
<thelema> you shouldn't be able to access BatSet without telling ocamlfind about batteries
<xavierm02> I tell it
<xavierm02> with the _tags file
<thelema> ok, tags file is good.
<xavierm02> but
<xavierm02> I though Set was replaced with BatSet
<xavierm02> when we did that
<xavierm02> but Set.of_list isnt defined
<xavierm02> where BatSet.of_list is
<thelema> If you do 'open Batteries' it does the module inlining
<xavierm02> Reference to undefined global `Batteries'
<xavierm02> >_<
<thelema> it shadows all the builtin modules with new ones constructed from merging the two
<thelema> are you using batteries 1.x? if so, then do 'open Batteries_uni'
<xavierm02> i think so
<xavierm02> ok
<xavierm02> now Set has of_list
leoncamel has quit [Ping timeout: 252 seconds]
<xavierm02> module A = Tuple3;; works
<xavierm02> wut
<xavierm02> I can't find Tuple3.Ord in the doc now
<thelema> hmm, I just updated the docs, it shouldn't have disappeared...
dwmw2_gone has quit [Ping timeout: 245 seconds]
dwmw2_gone has joined #ocaml
<thelema> xavierm02: ah, the hdoc/ folder is for 1.x
<thelema> oh yeah, you're using 1.x
<thelema> hmm, I wonder when that was last updated...
<thelema> It's probably not up to date for 1.5...
<xavierm02> I have 1.4.3
<xavierm02> T.T
<thelema> xavierm02: any chance of upgrading?
<xavierm02> well
<xavierm02> I'm kind of a noob
<xavierm02> so I don't like installing things without the package manager
<xavierm02> i'll check testing and sid
<xavierm02> see if there are newer versions
<thelema> 2.0 is very unlikely to be available there.
<thelema> is there an ocaml-batteries-doc package? that doc should be up to date.
<xavierm02> but the Ord thing
<xavierm02> didn't come in 2.0, did it?
<thelema> may have.
<xavierm02> :/
<thelema> it's not difficult to write your own compare function for a 3-tuple
mye has joined #ocaml
<xavierm02> yeah
<xavierm02> I was doing this
<xavierm02> when I found out tuple things existed
<thelema> it sounds like you'll have to go back to that.
<xavierm02> same version in sid :(
mattrepl has quit [Quit: mattrepl]
mye has quit [Ping timeout: 276 seconds]
thomasga has quit [Quit: Leaving.]
jamii has joined #ocaml
<xavierm02> here is the current code: http://pastebin.com/DAky0UVt please let me know if I did anything stupid :)
<thelema> "local"?
<thelema> hmm, odd. I got a totally different paste somehow...
<thelema> anyway, found your paste
<thelema> that'll work. I hope you're not being graded on speed
<thelema> also, you'll need a Set.find for the use of Set to work.
<thelema> batteries doesn't have this, and the stdlib only just added this
<thelema> (which means batteries will have to add this in 2.1)
<xavierm02> O_O
<xavierm02> I assumed there was a find function
<thelema> nope, just mem.
<thelema> which returns a boolean saying whether the given element is in the set
<xavierm02> okay
<xavierm02> so I need the alphabet too
<thelema> you want a Map for this anyway
<xavierm02> for this thing to work
<xavierm02> why?
<thelema> because automaton is (q, sigma) -> {q}
<xavierm02> no
<xavierm02> that's deterministic
<thelema> {q} - set of states
<xavierm02> ah
<xavierm02> didn't think of it that way :o
<xavierm02> I'll do that
<xavierm02> ty :)
<thelema> n/p
* thelema goes back to his automata theory research
<xavierm02> when you said you hoped I wasn't graded on speed, was it because I used a set to represent transitions?
<thelema> yes
<xavierm02> k
Demitar has quit [Ping timeout: 255 seconds]
<thelema> fastest is to use array for transition table
<thelema> this takes up lots of ram for large automata
<xavierm02> "this" = Map?
<thelema> array
<xavierm02> :o
<xavierm02> oh
<xavierm02> 2D array?
<thelema> yes
myx has quit [Ping timeout: 248 seconds]
mye has joined #ocaml
smondet has joined #ocaml
<xavierm02> but that implies having states and letters as ints
milosn has joined #ocaml
<thelema> true. states as ints is generally pretty easy, and letters all have ascii codes
<thelema> the trick is knowing the number of states before constructing the array
milosn_ has quit [Ping timeout: 248 seconds]
<xavierm02> type automaton = {
<xavierm02> number_of_states: int;
<xavierm02> transitions: IntSet.t array array;
<xavierm02> start_states: IntSet.t;
<xavierm02> end_set: IntSet.t
<xavierm02> }
<xavierm02> so this is the efficient implementation?
tane has left #ocaml []
<thelema> yes, although hard to build directly; you'll need a flexible number of states to build the automaton, but this is more efficient for parsing speed than before
<thelema> I shouldn't have distracted you with efficiency; go back to StateSet.t and StateSet.t StateLetterMap.t
<thelema> it'll make your life easier; after you have everything else working you can optimize.
<xavierm02> I haven't removed it
<xavierm02> now I have math_automaton
<xavierm02> and fast_automaton :)
<thelema> ok
<xavierm02> so I'll do reduction etc. on math_automaton
<xavierm02> and then go to fast_automaton to check if works are recognized
<xavierm02> words*
<thelema> ok, have fun
mye has quit [Ping timeout: 255 seconds]
<thelema> btw, you may not notice any difference in parsing speed depending on how long the text you're matching is.
pango_ has joined #ocaml
pango has quit [Ping timeout: 264 seconds]
jamii has quit [Read error: No route to host]
pango_ is now known as pango
thomasga has joined #ocaml
mye has joined #ocaml
weie has quit [Quit: Leaving...]
mye_ has joined #ocaml
Yoric has joined #ocaml
mye has quit [Ping timeout: 276 seconds]
mye_ has quit [Ping timeout: 265 seconds]
ontologiae has quit [Ping timeout: 252 seconds]
<xavierm02> Error: The record field label transitions belongs to the type fast_automaton
<xavierm02> but is mixed here with labels of type math_automaton
<xavierm02> O_O
<thelema> can't use the same record field labels
<xavierm02> oh wait
<thelema> at least not in the same module
<xavierm02> I wrote end_states
<xavierm02> instead of final_states
<xavierm02> still doesnt work
<xavierm02> hm
<xavierm02> so
<xavierm02> ok ty, I'll change the names :)
ski has quit [Quit: leaving]
mye has joined #ocaml
ski has joined #ocaml
jbrown has quit [Quit: Client exiting]
mye has quit [Ping timeout: 276 seconds]
<xavierm02> type 'a t = {
<xavierm02> b: 'a
<xavierm02> } contraint 'a = int;;
<xavierm02> how do I put a constraint on a sum type?
<xavierm02> just after the } or just before it both fail
<xavierm02> :/
<adrien> which one would you do?
<xavierm02> I don't understand your question
<xavierm02> type 'a t = {
<xavierm02> b: 'a
<xavierm02> } contraint 'a = int;;
<xavierm02> fails
<xavierm02> type 'a t = {
<xavierm02> b: 'a contraint 'a = int
<xavierm02> };;
<xavierm02> fails too
<xavierm02> so I have no idea how to do it
<adrien> which type would you want?
<adrien> I'd personally write that : type t = { b : int }
<adrien> so...
<xavierm02> -.-
<xavierm02> it's an oversimplified example
<xavierm02> I have two sum types
<xavierm02> that are quite close
<adrien> I don't think I've ever seen constraints on records (but that doesn't mean they don't exist)
hongboz has joined #ocaml
<xavierm02> in fact they only have one type that is different
<xavierm02> so instead of having to change all my labels
<xavierm02> I wanted to regroup both sum types into one
<xavierm02> and put that one type that changes as a parameter
<adrien> type math_automaton = { automaton : automaton; field1: int; field2: int }
<adrien> these aren't sum types, they are records
<xavierm02> ok
<xavierm02> records
<adrien> can you show them?
<xavierm02> type math_automaton = {
<xavierm02> number_of_states: int;
<xavierm02> transitions: transition_set;
<xavierm02> start_states_m: state_set;
<xavierm02> final_states_m: state_set
<xavierm02> };;
<xavierm02> type fast_automaton = {
<xavierm02> number_of_states: int;
<xavierm02> transitions: state_set array array;
<xavierm02> start_states_f: state_set;
<xavierm02> final_set_f: state_set
<xavierm02> };;
<xavierm02> without the _m and _f
<hongboz> xavierm02: you can paste the code in some website, and post a link here :-)
<xavierm02> so I wanted
<adrien> type automaton = { number_of_states: int; transitions: state set array array; start_states: state_set }
<adrien> type math_automaton = { automaton : automaton; final_states: state_set }
<adrien> type fast_automaton = { automaton: automaton; final_set: state_set }
<xavierm02> yeah
<xavierm02> but if I do that
<adrien> and then use v.automaton.number_of_states?
<xavierm02> I can't have a function
<xavierm02> get_states
<xavierm02> that works for both
<xavierm02> etc.
<xavierm02> or
<xavierm02> can I?
<adrien> actually both have a field named "automaton" too :-)
* adrien is a bit tired
<adrien> that would work if you have two namespaces and pass the "automaton" field instead
<adrien> but I'm sorry, I'm way too tired to think about type design
RagingDave has quit [Quit: Ex-Chat]
<xavierm02> ok, ty :)
mye has joined #ocaml
Anarchos has joined #ocaml
mye has quit [Ping timeout: 255 seconds]
<xavierm02> I know I can just use \r\n
<xavierm02> but our of curiosity, is there some way to know what the current system uses to represent newlines?
<xavierm02> out*
chambart has quit [Ping timeout: 264 seconds]
answer_42 has quit [Ping timeout: 276 seconds]
ontologiae has joined #ocaml
<Anarchos> xavierm02 compare the output of print_endline() ?
<xavierm02> but how do I do that from inside ocaml?
<xavierm02> because if it gets printed, I can't get it in a string
<adrien> well actually you should just use "\n"
<adrien> simply avoid "\r\n"
<xavierm02> :o
<xavierm02> I thought \r\n was better
<xavierm02> doesn't \n fail on Mac/Windows?
_andre has quit [Quit: leaving]
mye has joined #ocaml
hongboz has quit [Ping timeout: 264 seconds]
<adrien> mac os used \r
<adrien> that was mac os, not mac os x
<adrien> as for windows if you open the file in so-called "text mode", \n will be translated to \r\n when you write
<adrien> and \r\n will be translated to \n when you read
<adrien> but you should simply not care about it since basically all applications handle \n
mye has quit [Ping timeout: 264 seconds]
ontologiae has quit [Ping timeout: 244 seconds]
Demitar has joined #ocaml
mye has joined #ocaml
metasyntax has quit [Quit: Leaving]
<xavierm02> ok, ty :)
mye has quit [Ping timeout: 244 seconds]
chambart has joined #ocaml
Snark has quit [Quit: Quitte]
gnuvince_ has quit [Quit: reboot]
<gour_> ocamldoc is not meant to serve as reST/Sphinx where one can annotate source code as well as write general documentation like user manual in the same markup?
gour_ is now known as gour
Cyanure has joined #ocaml
mye has joined #ocaml
<thelema> gour: you can annotate source code, but the usual way to use it is to annotate the .mli file that has the public interface; when used this way, code isn't kept in the output.
<gour> thelema: ok..but still means ocamldoc is used for documenting e.g. API and not writing general docs like manuals, right?
<thelema> It could be used for general docs like manuals; although I always see it for documenting API.
<gour> i wonder what kind of markup is available for writin general docs
gnuvince has joined #ocaml
ulfdoz has joined #ocaml
mye_ has joined #ocaml
mye has quit [Ping timeout: 260 seconds]
mye_ is now known as mye
nimred has quit [Quit: Lost terminal]
gour has quit [Quit: WeeChat 0.3.8]
fraggle_ has quit [Ping timeout: 264 seconds]
fraggle_ has joined #ocaml
lolcathost is now known as lolcathots
Yoric has quit [Ping timeout: 246 seconds]
lolcathots is now known as Automorphism
Reventlov has quit [Quit: leaving]
nimred has joined #ocaml
nimred has quit [Quit: Lost terminal]
wossname has quit [Ping timeout: 240 seconds]
gnuvince has quit [Quit: Remember when men were men and regular expressions recognized regular languages?]
gnuvince has joined #ocaml
sad0ur has quit [Ping timeout: 244 seconds]
Automorphism has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
sad0ur has joined #ocaml
Playground has joined #ocaml
mye has quit [Ping timeout: 248 seconds]
nimred has joined #ocaml
Cyanure has quit [Remote host closed the connection]
xavierm02 has quit [Quit: Leaving]
jbrown has joined #ocaml
ontologiae has joined #ocaml
ontologiae has quit [Ping timeout: 264 seconds]
Playground has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
pkrnj has joined #ocaml
lolcathost has quit [Client Quit]
Playground has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
smondet has quit [Ping timeout: 255 seconds]
doomrobo has joined #ocaml
Playground has quit [Ping timeout: 248 seconds]
Playground has joined #ocaml