gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
lewis1711 has left #ocaml []
ulfdoz has quit [Read error: Operation timed out]
ulfdoz has joined #ocaml
sepp2k has joined #ocaml
emmanuelux has quit [Read error: No route to host]
gnuvince has joined #ocaml
netrino has quit [Quit: Ave!]
struktured has quit [Ping timeout: 264 seconds]
struktured has joined #ocaml
emmanuelux has joined #ocaml
destrius has joined #ocaml
lewis1711 has joined #ocaml
<lewis1711> what do error messages like "Error: This expression has type Lexer/103843.token but an expression was expected of type Lexer/133178.token" mean?
<lewis1711> oh nm wasn't exposing my variant types fully in the module signature
struktured has quit [Ping timeout: 244 seconds]
struktured has joined #ocaml
lusory has joined #ocaml
emmanuelux has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
ankit9 has joined #ocaml
tac-tics[home] has joined #ocaml
dsheets has quit [Read error: Operation timed out]
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
ankit9 has quit [Read error: Connection reset by peer]
<adrien> lewis1711: it means you have definitions of several modules with the same name and using a type from one instead of a type from another one; it can happen when you redefine moduiles
pango is now known as pangoafk
thomasga has joined #ocaml
thomasga has quit [Client Quit]
mika1 has joined #ocaml
cago has joined #ocaml
djcoin has joined #ocaml
osa1 has joined #ocaml
<lewis1711> adrien: yeah that makes sense
edwin has joined #ocaml
edwin1 has joined #ocaml
<adrien> I never thought I could make sense so quickly after waking up :P
<lewis1711> ha!
<lewis1711> http://pastebin.com/pTraNyiV I am trying to think of a pattern for unbalanced brackets (or parentheses), that doesn't involve me explicitly keeping count of them.
<lewis1711> any ideas, or do I just need to start keeping a running total?
edwin1 has quit [Client Quit]
<lewis1711> maybe an inner recurisve function with a couple of int parameters or something
edwin has left #ocaml []
Yoric has joined #ocaml
<adrien> can't say now, have to leave, but you're aware of sexplib?
<lewis1711> I am, but this is an self-educational exercise
<adrien> =)
Sablier has joined #ocaml
Yoric1 has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
<lewis1711> I suppose i could just reject unmatched parentheses in the AST when I come to eval it, I dunno if that's the job of the parser or not though
Sablier has quit [Read error: Connection reset by peer]
Sablier has joined #ocaml
Yoric1 has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
Yoric1 has joined #ocaml
Yoric has quit [Ping timeout: 245 seconds]
silver has joined #ocaml
Yoric1 has quit [Ping timeout: 244 seconds]
<orbitz> lewis1711: usually
tac-tics[home] has quit [Read error: Connection reset by peer]
edwin has joined #ocaml
edwin1 has joined #ocaml
edwin1 has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
ankit9 has joined #ocaml
pangoafk has quit [Ping timeout: 252 seconds]
avsm has joined #ocaml
thomasga has joined #ocaml
struktured has quit [Ping timeout: 264 seconds]
pangoafk has joined #ocaml
beckerb has joined #ocaml
avsm has quit [Quit: Leaving.]
thomasga has quit [Ping timeout: 244 seconds]
thomasga has joined #ocaml
Kakadu has joined #ocaml
avsm has joined #ocaml
Progster has joined #ocaml
Hussaind has joined #ocaml
lewis1711 has left #ocaml []
Hussaind has left #ocaml []
osa1 has quit [Ping timeout: 248 seconds]
Yoric has quit [Ping timeout: 240 seconds]
avsm has quit [Quit: Leaving.]
Sablier has quit [Ping timeout: 245 seconds]
Sablier has joined #ocaml
avsm has joined #ocaml
Yoric has joined #ocaml
destrius has quit [Quit: Leaving.]
ankit9 has quit [Ping timeout: 260 seconds]
Sablier has quit [Read error: Connection reset by peer]
Sablier has joined #ocaml
Sablier has quit [Read error: Connection reset by peer]
Sablier has joined #ocaml
hyperboreean has quit [Ping timeout: 272 seconds]
hyperboreean has joined #ocaml
ankit9 has joined #ocaml
_andre has joined #ocaml
Progster has quit [Ping timeout: 260 seconds]
Kakadu has quit [Quit: Page closed]
lewis1711 has joined #ocaml
gnuvince has quit [Ping timeout: 250 seconds]
<lewis1711> in a list in a pattern match, how can I reperesent a list of one or more things when they have constructors?
<thizanne> _ :: _ ?
<lewis1711> (Bracket Left)::(Value v1)::[(Value v)]
<thizanne> t :: _ -> match t with | Cons1 -> .. | Cons2 -> ...
<lewis1711> except the bit at the end is a one element list
<mrvn> That would be exactly 3, better use [x; y; z] there
<thizanne> (with correct begin and end)
<mrvn> (Bracket Left)::(Value v1)::_
<lewis1711> mrvn: what's the type of _ though?
<mrvn> lewis1711: anything
<thizanne> _ means « anything »
<lewis1711> yeah exactly
<lewis1711> I need it to be a Value
<mrvn> nah, _ means don't complain about not being used.
<mrvn> lewis1711: then Value _
<lewis1711> mrvn: and how many values is that?
<thizanne> anything which types, of course
<mrvn> (Bracket Left)::(Value v1)::(Value v2)::_
<lewis1711> sorry, I should be more clear
<lewis1711> a list of arbitrary length of values
<lewis1711> at the end
<mrvn> x::y matches x against the head and y against the tail. y can be [] or [a] or [a; b] or ...
<mrvn> y is arbitrary length
<thizanne> he wants y to be arbitrary length and to contain only Value variants
edwin has left #ocaml []
<lewis1711> thizanne: yes! sorry I don't know ocaml vary well
<thizanne> I think you cannot lewis1711
<lewis1711> ah
<mrvn> That isn't possible.
<thizanne> you could probably tweak it with gadt
<flux> you can use 'when guard' for that?
<thizanne> but if you don't know well ocaml, forget it
<mrvn> On arbitrary length you can only match the type, not the value.
<lewis1711> mrvn: Value is a type, no?
<thizanne> no
<thizanne> it's a variant of a type
<lewis1711> ah
<mrvn> lewis1711: no, Value is a constructor of the variant type.
<lewis1711> I see the distinction you are making
<thizanne> your type is a thing like `token`
<lewis1711> flux: the syntax extension in batteries?
<thizanne> when is standard
<lewis1711> oh
<thizanne> maybe you think of where ?
<mrvn> flux: like "x::y::z when is_all_values z ->"?
<lewis1711> yes, that'd e the one
<flux> mrvn, yeah
<mrvn> that could be rather slow
<thizanne> you can use the solution of mrvn but it will no be used by the type-checker
<thizanne> and it will be dynamically checked
<mrvn> that too
<lewis1711> dynamically checked!? WHAT IS THIS RUBY
<lewis1711> I'll avoid it:)
<thizanne> dynamically means "when your program is run"
<mrvn> you need a different type to make this a type check
<flux> lewis1711, you may not want to look into exceptions ;)
<lewis1711> thizanne: yeah, I was trying to make a little joke :D
<lewis1711> flux: actually I really quite like ocamls exceptions
<mrvn> lewis1711: I also assume you list is (Bracket Left)::...::(Bracket Right)::... so you would never get a match with just Values.
<lewis1711> I need to experiment with try catching them, but as constructs, I am quite happy
<thizanne> try and catching in ocaml is not particularly special
<lewis1711> I might post some code, and maybe it'll be more clear what's going on
<flux> it would be sort of interesting if ocaml exceptions were extended to support objects
<flux> so you could throw objects and catch by siganture
<flux> I suppose that could be a bit confusing at times..
<thizanne> it would be interesting if the type-checker could check exceptions
<thizanne> and say things like "this function can throw this"
<mrvn> indeed
<lewis1711> thizanne: like with Monads?
<lewis1711> the ones in haskell and scala they use for errors
<mrvn> lewis1711: then you are just reimplementing exceptions manually
<flux> thizanne, that would definitely be interesting. there was ocamlexc, but it's been long abandoned.
<thizanne> I don't know haskell and scala very good, and I ignore this aspect
<lewis1711> ok
<thizanne> yes i was thinking about it
<lewis1711> mrvn: when I implementing exceptions manually?
<flux> thizanne, on the other hand java's checked exceptions aren't that great either, at least the mechanism would need to cover higher order functions etc
<thizanne> (flux)
<thizanne> yes, but java is basically not that great
<mrvn> lewis1711: when you use monads
<lewis1711> mrvn: yeah, and thats what I dislikeda bout it
<thizanne> and exceptions are quite painful in java
<flux> actually polymorphic variants is another possibility to encode exceptions. there was this paper about doing that.. by yoric perhaps?-o
<lewis1711> but in ocaml, can you do something like
<mrvn> flux: isn't that what an exception does?
<lewis1711> try {codeThrowingExceptions) catch (deal with exception) >
<lewis1711> or something similar?
Progster has joined #ocaml
<flux> mrvn, well, the encoding put the ways a function can fail into the type
<lewis1711> and can the catch block just print a message then, without effecting thetype of the function?
<thizanne> lewis1711: you can write `try (your code) with | exc1 -> ... | exc2 -> ... `
<lewis1711> thizanne: can you catch your exception , and theal with it how you please?
<thizanne> yes
<thizanne> but you have to keep your function well-typed
<lewis1711> ohh
<thizanne> ie you cannot write let f () = try 1 + 1 with | _-> "a"
<thizanne> you can write let f () = try 1 + 1 with | _ -> 2
<thizanne> (obviously it's stupid here)
<lewis1711> but the crux of this
<lewis1711> for me
<lewis1711> is does output of the stuff being caught, affect the function
<lewis1711> like if your function was x-> x-> imt
<lewis1711> *like if your function was x-> x-> int
ankit9 has quit [Ping timeout: 260 seconds]
<thizanne> you can do output
<lewis1711> YES
<thizanne> like let f () = try 1 + 1 with | Not_found -> print_string "Not found"; 2
<lewis1711> brillian
<lewis1711> t
<lewis1711> ocaml has functions right for me
<thizanne> lewis1711, print something has no effet of the type of your thing
<thizanne> (except if it's the last thing you do, in this case your return type is unit, like () )
<lewis1711> ahhh
<lewis1711> thizanne: thanks, you've helped explain much :)
<lewis1711> https://gist.github.com/2988212 anyway here was the code I was asking about before
netrino has joined #ocaml
ankit9 has joined #ocaml
emmanuelux has joined #ocaml
gnuvince has joined #ocaml
<lewis1711> any ocaml IDEs you can recommend?
<gasche> I'm happy with Emacs
<gasche> I have seen people use Eclipse; whatever goes
<thizanne> I also use emacs with typerex
<gasche> (or Vim, of course, but that is less shocking)
<lewis1711> I give up with vim
osa1 has joined #ocaml
<lewis1711> using it on and off for two years now
<lewis1711> and I still forget everythinf
<lewis1711> have been shamefully enjoying IDEs recently
<lewis1711> might check out the eclipse one
<gasche> there are two eclipse plugins that people talk about, iirc
<gasche> use any of them that works
iago has joined #ocaml
slash__ has joined #ocaml
Reventlov has joined #ocaml
Reventlov has quit [Changing host]
Reventlov has joined #ocaml
struktured has joined #ocaml
slash__ is now known as slash^
lewis1711 has left #ocaml []
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
smondet has joined #ocaml
Ptival has quit [Read error: Connection reset by peer]
Ptival has joined #ocaml
Qrntz_ has quit [Ping timeout: 265 seconds]
ankit9 has quit [Ping timeout: 260 seconds]
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
nimred has quit [Ping timeout: 265 seconds]
Progster has quit [Ping timeout: 260 seconds]
nimred has joined #ocaml
nimred has quit [Changing host]
nimred has joined #ocaml
fayden has joined #ocaml
Submarine has quit [Ping timeout: 264 seconds]
mika1 has quit [Quit: Leaving.]
tac-tics has joined #ocaml
cago has quit [Ping timeout: 265 seconds]
Sablier has quit [Read error: Connection reset by peer]
osa1 has quit [Quit: Konversation terminated!]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
beckerb has quit [Ping timeout: 272 seconds]
silver has quit [Remote host closed the connection]
Sablier has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
emmanuelux has quit [Ping timeout: 252 seconds]
SanderM has joined #ocaml
oriba has joined #ocaml
avsm has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
hto has joined #ocaml
Progster has joined #ocaml
Submarine has quit [Remote host closed the connection]
sepp2k has quit [Remote host closed the connection]
djcoin has quit [Quit: WeeChat 0.3.2]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
lusory has quit [Read error: Operation timed out]
Yoric has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
Yoric has quit [Ping timeout: 250 seconds]
Qrntz_ has joined #ocaml
lusory has joined #ocaml
<tac-tics> Are functors another name for modules in ML?
<bitbckt> no.
pangoafk is now known as pango
<mrvn> functors return a module though
<tac-tics> Are they related to the category theory notion of functors? Or is that just a coincidence?
<mrvn> no idea what that is
<mrvn> Think of a functor as an abstract algorithm. Given a module as input it creates a new module as output that implements that algorithm.
<tac-tics> ok
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
avsm has joined #ocaml
<adrien> typical example is parameterizing over a Set or Map or...
tac-tics has quit [Ping timeout: 245 seconds]
Kakadu has joined #ocaml
Xizor has joined #ocaml
Yoric has joined #ocaml
Anarchos has joined #ocaml
iago has quit [Ping timeout: 240 seconds]
Yoric has quit [Ping timeout: 245 seconds]
Snark has joined #ocaml
iago has joined #ocaml
tac-tics has joined #ocaml
jknick has quit [Ping timeout: 244 seconds]
jknick has joined #ocaml
Yoric has joined #ocaml
dsheets has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
tbrady has joined #ocaml
Yoric has joined #ocaml
Reventlov has quit [Quit: reboot]
Yoric has quit [Ping timeout: 265 seconds]
Reventlov has joined #ocaml
Tobu has joined #ocaml
gnuvince has quit [Ping timeout: 250 seconds]
_andre has quit [Quit: leaving]
Kakadu has quit [Quit: Konversation terminated!]
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 256 seconds]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
Yoric has joined #ocaml
wmeyer`` has quit [Remote host closed the connection]
slash^ has quit [Quit: Lost terminal]
Yoric has quit [Ping timeout: 265 seconds]
gnuvince has joined #ocaml
Anarchos has quit [Quit: sleep time]
chris_st has joined #ocaml
<chris_st> Hi -- Noob here, I've google'd some for this and haven't found anything particularly good. I'd like to be able to do the "factory" thing, where I give a function a string representing the name of a specific subclass of a superclass, and get back an instance of that subclass. I can do the standard string matching thing, and build each 'new xxx...' by hand, but there must be a more ocaml way to do it!
<orbitz> chris_st: I don't know anyone that uses hte objec tlayer in Ocaml
<chris_st> wow!
<orbitz> but creating a factor is pretty staright forward. just have the moduel register soem kidn fo function iwht it
<Snark> chris_st, second result on a search for "ocaml factory pattern"
<chris_st> Snark: Thanks, I saw that... the "OCaml provides first class citizenship for modules since 3.12 so it is very easy to implement a factory with that" line is interesting, but doesn't provide much actual guidance.
<chris_st> Do you recommend following that advice?
Snark has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
chris_st has quit [Quit: chris_st]
tac-tics has quit [Quit: Page closed]
tbrady_ has joined #ocaml
flx_ has joined #ocaml
tbrady has quit [Read error: Connection reset by peer]
flux has quit [Remote host closed the connection]
flx_ is now known as flux
netrino has quit [Quit: Ave!]
SanderM has quit [Remote host closed the connection]
smondet has quit [Quit: Bye bye]
Xizor has quit [Ping timeout: 260 seconds]
emmanuelux has joined #ocaml
bnwr has quit [Ping timeout: 244 seconds]
bnwr has joined #ocaml
lamawithonel_ has joined #ocaml
lamawithonel has quit [Ping timeout: 244 seconds]
emmanuelux has quit [Ping timeout: 244 seconds]
Progster has quit [Ping timeout: 252 seconds]
Reventlov has quit [Ping timeout: 240 seconds]
Reventlov has joined #ocaml
lamawithonel__ has joined #ocaml
zorun has quit [Ping timeout: 240 seconds]
lamawithonel_ has quit [Ping timeout: 246 seconds]
zorun has joined #ocaml
fraggle_ has quit [Ping timeout: 244 seconds]
dgfitch has quit [Ping timeout: 240 seconds]
fraggle_ has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
iago has quit [Ping timeout: 240 seconds]
svenl has quit [Ping timeout: 240 seconds]
iago has joined #ocaml
svenl has joined #ocaml
ulfdoz has joined #ocaml
dgfitch has joined #ocaml