ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | http://www.ocaml.org | OCaml 4.01.0 announce at http://bit.ly/1851A3R | Logs at http://irclog.whitequark.org/ocaml
<puffie> if I have a pretty good amount of Haskell experience, and only Python/C/Java/etc. otherwise, is it a good idea to spend a little time with SML before learning OCaml?
<Drup> why ?
<Drup> there is no point in SML
<puffie> Drup: I guess I'm debating spending a little time learning it anyway. It seems like an important historical facet of static functional languages, and an elegant subset of the modern ones
<Drup> (except as a theoretical tool for computer scientist working on semantics)
<puffie> but I'm not sure if it's worth it
<Drup> well, it's a bit like saying it's cool to learn B before C because it's an important historical facet.
<Drup> yeah .. maybe ?
<Drup> :)
<Drup> puffie: no seriously, the distance SML -> OCaml is very short. There are some syntactic differences, but not much
<Drup> the main difference is that there is basically no SML community
<puffie> Drup: some people still use SML, though, and certain features are thought to be great
<puffie> does OCaml use SML's module system?
<Drup> OCaml is a strict superset of SML
<puffie> Drup: oh, cool
<Drup> and the difference is pretty large
<Drup> feature wise, not syntax wise
<Drup> (not sure if I'm clear :x)
<puffie> I'm pretty sure I understand what you mean
<Drup> maybe there are some people using SMT, but not much, and there is no tooling and no libraries
<Drup> SML* meh.
<puffie> SML even felt like a really restricted subset of Haskell, during the one day I spent using it
<Drup> (I would say SML's module system is already better than Haskell one :>)
<puffie> I have hope that OCaml may end up being my language of choice. I've lost some faith in Haskell due to the time and space complexity black magic caused by purity/laziness
<puffie> Drup: yeah, I've heard that argument made
<puffie> Haskell definitely does have some not-so-great import rules, like silent redefinitions on unqualified imports, etc
tac-tics has quit [Quit: Leaving]
<papna> I'm always surprised by how few languages have sane import semantics and rules.
puffie has quit [Remote host closed the connection]
<papna> Even newer once.
<papna> ones
<Drup> papna: there are new languages without sum types. Nothing surprises me anymore about language designs.
<Drup> (but lot's of things make me sad, though)
<papna> I understand why much better.
<Drup> ?
<papna> I can inhabit the mindset of why people design languages without sum types
<papna> or with only pathetic sum types.
<Drup> well, I can't, except incompetence.
philtor_ has joined #ocaml
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dapz has joined #ocaml
dapz has quit [Client Quit]
boogie has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
racycle has quit [Quit: ZZZzzz…]
troutwine is now known as troutwine_away
ygrek has joined #ocaml
philtor_ has quit [Ping timeout: 255 seconds]
koderok has joined #ocaml
koderok has quit [Client Quit]
philtor_ has joined #ocaml
dapz has joined #ocaml
thomasga has quit [Quit: Leaving.]
alex_nx_ has quit [Quit: ZNC - http://znc.in]
jprakash has quit [Ping timeout: 240 seconds]
huza has joined #ocaml
tac_ has joined #ocaml
philtor_ has quit [Ping timeout: 240 seconds]
q66 has quit [Quit: Leaving]
boogie has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 250 seconds]
rgrinberg has quit [Ping timeout: 240 seconds]
koderok has joined #ocaml
rgrinberg has joined #ocaml
BitPuffin has quit [Ping timeout: 264 seconds]
tac_ has quit [Quit: Leaving]
koderok has quit [Quit: koderok]
mitchty has joined #ocaml
samrat has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
manizzle has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
huza has quit [Ping timeout: 260 seconds]
tautologico has joined #ocaml
andy has quit [Quit: leaving]
travisbrady has joined #ocaml
jedai has quit [Ping timeout: 246 seconds]
jprakash has joined #ocaml
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
diethyl has quit [Ping timeout: 244 seconds]
andy___ has joined #ocaml
andy___ is now known as Guest70432
Guest70432 has quit [Client Quit]
andy-c has joined #ocaml
diethyl has joined #ocaml
<andy-c> i use #use, but it depends on a generated lexer
<andy-c> I get Error: Unbound module Lexer
rgrinberg has quit [Quit: Leaving.]
<andy-c> I tried to do #use "_build/lexer.ml", but there are more unresolved dependencies
<andy-c> any ideas of how to play with the generated code? it uses the Lexing module and menhir parser generator
jprakash has quit [Ping timeout: 272 seconds]
<andy-c> the command to build it is: ocamlbuild -use-menhir -tag thread -use-ocamlfind -quiet -pkg core test.native
racycle has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
<travisbrady> andy-c: do you seen some cmas in there? #load “lexer.cma” ?
<andy-c> travisbrady: I see lexer.cmi, cmo, and cmx
<andy-c> yeah I actually don't quite understand what those files all are
<andy-c> no cma
koderok has joined #ocaml
badon has joined #ocaml
tac_ has joined #ocaml
<andy-c> maybe I should use ocamlmktop and build in the lexer/parser instead of utop?
<andy-c> not sure what the conventional way is
<andy-c> I just want to call functions on the lexer and see what is returned for some given test input
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
koderok has quit [Quit: koderok]
dapz has joined #ocaml
jao has quit [Ping timeout: 264 seconds]
axiles has joined #ocaml
racycle has quit [Quit: ZZZzzz…]
boogie has quit [Remote host closed the connection]
travisbrady has quit [Quit: travisbrady]
arjunguha has joined #ocaml
travisbrady has joined #ocaml
vfoley has joined #ocaml
<vfoley> Can anyone explain why Hashtbl.find_all returns a list? Wouldn't an option be more appropriate here? (unless I am missing something obvious)
vfoley has quit [Remote host closed the connection]
vfoley has joined #ocaml
vfoley has quit [Changing host]
vfoley has joined #ocaml
dapz has quit [Read error: Connection reset by peer]
travisbrady has quit [Quit: travisbrady]
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arjunguha has joined #ocaml
badon has quit [Ping timeout: 244 seconds]
arjunguha has quit [Client Quit]
badon has joined #ocaml
jprakash has joined #ocaml
jprakash has quit [Client Quit]
vfoley has quit [Remote host closed the connection]
manizzle has joined #ocaml
ebzzry has quit [Remote host closed the connection]
samrat has joined #ocaml
philtor has quit [Ping timeout: 250 seconds]
manizzle has quit [Ping timeout: 250 seconds]
Simn has joined #ocaml
<andy-c> possible answer to my previous question: use utop -I _build/
<andy-c> however I am running into a weird issue where utop doesn't like menhir output, whereas the ocaml compiler seems fine with it
<andy-c> File "_build/parser.ml", line 478, characters 24-31:
<andy-c> Error: This expression has type [ `Deprecated_use_int_module ] but an expression was expected of type int
<andy-c> menhir outputs a .ml file using "max_int", however this is deprecated? https://blogs.janestreet.com/ocaml-core/108.07.00/doc/core/type_Common.html
ygrek has quit [Ping timeout: 250 seconds]
adrien has joined #ocaml
pango has quit [Ping timeout: 244 seconds]
hhugo has joined #ocaml
Hannibal_Smith has joined #ocaml
pgomes has joined #ocaml
arj has joined #ocaml
_0xAX has joined #ocaml
Arsenik has joined #ocaml
ygrek has joined #ocaml
ggole has joined #ocaml
<pgomes> Hi
<pgomes> Is possible to do LISP like interactive development on OCAML toplevel shell ?
<pgomes> to avoid the compile cycles?
<pgomes> at least when one is learning ?
<adrien> the "ocaml" executable is such an environement
<pgomes> or utop?
<adrien> "utop" is a nicer version of it which you'll probably like better
<pgomes> :P
<pgomes> so all that I can do while compiling I can do on the toplevel ?
<pgomes> my question was more, if there are exceptions ?
<pgomes> or limitations. Haskell has them
<pgomes> in the toplevel I mean
eikke__ has joined #ocaml
<adrien> well, the usage is slightly different but it's not much
<pgomes> thanks
Mercuria1Alchemi has joined #ocaml
MercurialAlchemi has joined #ocaml
<pgomes> I have starting learning some Ocaml and just wanted to know what would be the fastest way
<pgomes> for the "development" cycle
eikke__ has quit [Ping timeout: 272 seconds]
locallycompact has joined #ocaml
eikke__ has joined #ocaml
dsheets has joined #ocaml
thomasga has joined #ocaml
sepp2k has joined #ocaml
thomasga has quit [Client Quit]
dapz has joined #ocaml
BitPuffin has joined #ocaml
Kakadu has joined #ocaml
<scriptdevil> pgomes: Even when doing haskell, I generally use :e followed by :l in ghci whenever the code was non-trivial. In OCaml's interactive, you need to put ;; at the end of every compilation unit. The ;; is not needed in most cases when using the compiler.
<scriptdevil> pgomes: For OCaml, I currently use Emacs and tuareg and evaluate the buffer for any non-trivial expression. (Fellow learner here)
BitPuffin has quit [Ping timeout: 240 seconds]
<jerith> I generally use toy programs or a unit test framework for trying stuff out in a new language.
anddam has joined #ocaml
eikke__ has quit [Ping timeout: 260 seconds]
dapz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
lordkryss has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 264 seconds]
<anddam> hi I'm following tutorial http://ocaml.org/learn/tutorials/modules.html but at the very first module example while compiling bmodule.ml I get "Error: Unbound value Amodule.hello"
<anddam> https://gist.github.com/anddam/6f59b5e8d6c4932cee30 files and actual output, this looks like a trivial thing to do, what am I doing wrong?
<pgomes> anddam: That tutorial is fine yes!
<anddam> pgomes: ?
<pgomes> Sorry I y
Mercuria1Alchemi has quit [Ping timeout: 272 seconds]
<pgomes> our were answering me .... then I read until the end I saw I was wrong :P
<pgomes> scriptdevil: Tuareg is quite nice... you even have utop integration for emacs in marmalade
<ggole> anddam: how about you compiling it?
<ggole> *how are
<ggole> Wait, it's right there.
<jerith> anddam: You have "let () =" in amodule.ml and I think you want "let hello () =" instead.
<anddam> it's in the gist
<anddam> jerith: oh right
eikke__ has joined #ocaml
<ggole> Basically you need to pass a .cmo while compiling any file that depends on that module.
<anddam> that's the habit of typing rather than copy&past'ing to get familiar with the stuff
<anddam> thanks for pointing that out, I actually come down from a more complex example, narrowing it down to get the issue
<anddam> and I was misreading it the whole time
<jerith> "let () =" binds (or matches?) a value instead of defining a function.
<anddam> it couldn't get simpler than that
<anddam> yes, it doesn't have arguments
<anddam> would let () () = define an actual function?
_twx_ has quit [Ping timeout: 245 seconds]
<anddam> TIAS
<jerith> anddam: I think you're currently where I was about three weeks ago. :-)
<anddam> i.e. first approach?
<anddam> yes I am
<ggole> No, () is a constructor name. You can't bind constructor names in that way.
<jerith> anddam: I don't think "let () () =" is legal, because you can't rebind () to something of a different type.
<anddam> jerith: it's not in fact
<anddam> I thougt () was "unit", sor of nil value
<anddam> from tutorial 01
<anddam> sort of*
<jerith> anddam: () is the value, unit is the type.
<anddam> anyway I'll try to stick and see if it makes sense later on
<anddam> thanks
<def`> anddam: yes but the shortcut for defining functions is "let name pattern1 pattern2 … = expression"
<def`> () is not a name
<def`> (it's a pattern and an expression, depending on contexts, both of type "unit" as you said)
<gperetin> what's the easiest way to override Core in utop? I'd like to use List from stdlib
<def`> gperetin: Core.Caml exposes the stdlib
<def`> (Core.Std.Caml is fine too, so Core.Std.Caml.List is what you want)
<gperetin> works, thanks!
rand000 has joined #ocaml
<tac_> anddam: () is an object. It's the most boring possible object. Like a class with no members or methods.
thomasga has joined #ocaml
thomasga has quit [Client Quit]
thomasga has joined #ocaml
Hannibal_Smith has quit [Quit: Sto andando via]
locallycompact has quit [Ping timeout: 272 seconds]
<def`> :q
<adrien> no, don't leave us!
<def`> [oops, sorry]
<def`> :)
srcerer has quit [Ping timeout: 240 seconds]
srcerer has joined #ocaml
MercurialAlchemi has joined #ocaml
Mercuria1Alchemi has joined #ocaml
pminten has joined #ocaml
<anddam> most importantly save before leaving
<anddam> :wq
<acieroid> do anyone has a nice solution to this problem? http://paste.awesom.eu/WXXw (using Pervasives.compare on bar would be OK if foo didn't need a particular comparison function)
<acieroid> it can get very messy when bar becomes more complicated (eg. a sum over products)
<anddam> I used () as NOP since I couldn't find anything better, is that correct or is there a more appropriate expression?
<whitequark> acieroid: you can use ppx_deriving if you are OK with your code running only on OCaml 4.02+
<acieroid> indeed I already stumbled upon that, but I was wondering if there were any other solution
<whitequark> not really
<acieroid> ok, I'll then use ppx_deriving, thanks :)
<Mercuria1Alchemi> What's the community opinion on Batteries compared to Core?
<whitequark> there is no single opinion
<Unhammer> http://stackoverflow.com/questions/3889117/what-are-the-pros-and-cons-of-batteries-and-core mentions some pros and cons, but I suppose things have changed in four years
<Mercuria1Alchemi> I found that SO post too :)
<Unhammer> :)
<Unhammer> yeah I was wondering about the same earlier (am pretty new to ocaml); I'm using batteries now just because it made it easier to follow some tutorials and it's packaged for ubuntu so I figure it might make it easier if my boss ever has to compile my stuff =P
<Mercuria1Alchemi> core + core_kernel seems to have more packages using it on opam than batteries
<Mercuria1Alchemi> though of course you don't have that many packages on opam
<Mercuria1Alchemi> I'm a Core man myself, but mostly because it's what they use in Real World OCaml (for obvious reasons)
<Mercuria1Alchemi> seems pretty solid though
<Unhammer> http://permalink.gmane.org/gmane.comp.lang.caml.inria/60874 just to make things even more confusing
thomasga has quit [Quit: Leaving.]
<Mercuria1Alchemi> Oh
<Mercuria1Alchemi> Well
<Mercuria1Alchemi> Maybe it would be a good idea to break up these standard libraries into smaller modules if people fear dependencies so much
<Mercuria1Alchemi> It makes it more difficult to develop library code when you have to cater to 2 or 3 different environments
<Mercuria1Alchemi> You get some of the same in Haskell with the pipes packages
<Unhammer> it also makes it harder to get started with ocaml that you have to make a decision so early on what you want to learn
<Unhammer> not that it's rationally a really big deal
<Unhammer> it's just one of those unnecessary hurdles
locallycompact has joined #ocaml
typedlambda has quit [Ping timeout: 250 seconds]
avsm has joined #ocaml
typedlambda has joined #ocaml
<Mercuria1Alchemi> yes
<Drup> acieroid: you can just use Pervasives.compare too.
BitPuffin has joined #ocaml
<Drup> Mercuria1Alchemi: http://opam.ocaml.org/packages/core/core.111.25.00/ http://opam.ocaml.org/packages/batteries/batteries.2.2.0/ If you remove all the stuff "included" with Core (Core_*, Async_*), they are pretty much equaly used, according to opam
<acieroid> Drup: but Pervasives.compare won't use the comparison function it should on Maps (equivalent Maps may not structurally equal, as their structure depend of the way you insert/remove stuff in them)
<acieroid> may not be*
<Drup> huum
<def`> acieroid: true
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
agarwal1975_ has joined #ocaml
mcclurmc_ has joined #ocaml
milosn has joined #ocaml
sad0ur_ has joined #ocaml
so has quit [Ping timeout: 245 seconds]
Mercuria1Alchemi has quit [Ping timeout: 245 seconds]
dmbaturin has quit [Ping timeout: 245 seconds]
iZsh has quit [Ping timeout: 245 seconds]
mfp has quit [Ping timeout: 245 seconds]
agarwal1975 has quit [Ping timeout: 240 seconds]
milosn_ has quit [Ping timeout: 240 seconds]
pyon has quit [Ping timeout: 240 seconds]
sad0ur has quit [Ping timeout: 240 seconds]
mcclurmc has quit [Ping timeout: 240 seconds]
waneck_ has quit [Ping timeout: 240 seconds]
agarwal1975_ is now known as agarwal1975
so has joined #ocaml
Mercuria1Alchemi has joined #ocaml
mfp has joined #ocaml
pyon has joined #ocaml
waneck_ has joined #ocaml
iZsh has joined #ocaml
dmbaturin has joined #ocaml
nojb has joined #ocaml
ggole has quit [Ping timeout: 272 seconds]
<nojb> Where can I find an example of how to call an OCaml function from JS using js_of_ocaml ?
pyon has quit [Quit: Fiat justitia ruat caelum.]
<Drup> calling ocaml function from js is not super nice, but you can do it with wrap_callback
<Drup> Js.wrap_callback*
<hhugo> http://ocsigen.org/js_of_ocaml/2.3/manual/library : Using OCaml functions from JS
<nojb> Thanks . If I have a function in OCaml that I need to use to compute something - how else can I expose it to the browser-side js ?
<nojb> hhugo: thanks!
agarwal1975 has quit [Quit: agarwal1975]
ggole has joined #ocaml
<companion_cube> Unhammer: beginners could start with just the compiler's standard library, and then choose an extension/replacement of it later
<companion_cube> they're not going to write good production code from day 1
<Unhammer> I'm guessing most beginners now are starting with RWO though
<Unhammer> which assumes you use Core
<companion_cube> yes, that was a good move from janestreet :p
<Unhammer> heh yeah
<Mercuria1Alchemi> yep
<Mercuria1Alchemi> It's pretty good
<Mercuria1Alchemi> Though there are odd blind spots
<Mercuria1Alchemi> (eg, build systems, testing, debugging, deployment)
<Mercuria1Alchemi> the more operational side, which you'd expect from a book starting with Real World (TM)
<Unhammer> ie. a chance for the hypothetical competing BPO (Battery-Powered Ocaml) book
avsm has quit [Quit: Leaving.]
<Drup> which I doubt would happen
nojb has quit [Remote host closed the connection]
nojb has joined #ocaml
<Mercuria1Alchemi> ;)
agarwal1975 has joined #ocaml
<nojb> What is the simplest way to see the plain ocaml code output by a camlp4 extension ?
_andre has joined #ocaml
<Kakadu> you need to apply camlp4 plugin. 'pr_o.cmo' IIRC
tac_ has quit [Quit: Leaving]
<nojb> Kakadu: Thanks. 'camlp4o <syntax.cmo> pr_o.cmo <file>.ml' gives the desired output indeed.
tane has joined #ocaml
claudiuc has quit [Remote host closed the connection]
ruzu2 has quit [Read error: Connection reset by peer]
ruzu has joined #ocaml
nojb has quit [Ping timeout: 260 seconds]
araujo has quit [Ping timeout: 244 seconds]
araujo has joined #ocaml
nojb has joined #ocaml
Thooms has joined #ocaml
nojb has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
arjunguha has joined #ocaml
arjunguha has quit [Ping timeout: 260 seconds]
ygrek has quit [Ping timeout: 272 seconds]
arjunguha has joined #ocaml
nojb has joined #ocaml
arjunguha has quit [Client Quit]
pyon has joined #ocaml
<nojb> I have a linking problem. I have a MetaOCaml program that generates some code and then runs it using Runcode.run. The generated code refers to certain modules, say M. After compiling in the usual manner (just changing ocamlc by metaocamlc), if the file m.cmo is not in the same directory as the resulting executable I get a "Error: unbound module M" when I call Runcode.run. Any ideas? I would like to produce a standalone executa
locallycompact has quit [Ping timeout: 255 seconds]
locallycompact has joined #ocaml
claudiuc has joined #ocaml
claudiuc_ has joined #ocaml
claudiuc has quit [Ping timeout: 272 seconds]
Submarine has joined #ocaml
pgomes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
pgomes has joined #ocaml
mitchty has quit [Remote host closed the connection]
samrat has quit [Quit: Computer has gone to sleep.]
pminten has quit [Quit: KVIrc 4.2.0 Equilibrium http://www.kvirc.net/]
englishm has joined #ocaml
pjdelport has joined #ocaml
jjwatt has quit [Ping timeout: 255 seconds]
arjunguha has joined #ocaml
shinnya has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arjunguha has joined #ocaml
bjorkintosh has quit [Ping timeout: 255 seconds]
avsm has joined #ocaml
_0xAX has quit [Ping timeout: 240 seconds]
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
Haudegen is now known as Guest11878
Thooms has quit [Remote host closed the connection]
nojb has quit [Ping timeout: 250 seconds]
darkf has quit [Quit: Leaving]
_0xAX has joined #ocaml
Kakadu has quit [Quit: Page closed]
<whitequark> ahem. is there someone from FR who can quickly check a certain French law for me?
<whitequark> probably one google search away, if you know the keywords in French
<Drup> hum ?
<whitequark> Drup: the list of drug precursors that are forbidden for possession
Kakadu has joined #ocaml
<Drup> o_o
<adrien> WP
<whitequark> there is a certain chemical that can be used for very easily electroplating PCBs without a lot of expensive and toxic ingredients
<whitequark> but DEA also ruled that it can be used to make meth, in about the same way glassware could be used to make meth
<whitequark> so *some* countries have forbidden it by looking at DEA, and some other did not
<adrien> I know several places which do PCBs so you're probably safe
<adrien> well
<whitequark> adrien: no, that's not it
<adrien> depends on how you'd travel to france though
<whitequark> PCBs can be made with dozen of processes
arj has quit [Quit: Leaving.]
<whitequark> mine isn't very widely used in West, mainly because the chemical is controlled in USA and it's a pain to do the paperwork
<whitequark> and/or because it's just not well-known there. but there is a Russian patent on it, and the process itself is really much better than the alternatives
<whitequark> I know it's also legal in UK, but I could find no info about France
<adrien> give the name
<whitequark> it's NaPO2H2, aka Sodium hypophosphite, aka Sodium hypophosphite
<whitequark> er, aka sodium phosphinate
<whitequark> the law could be possibly phrased as "hypophosphorous acid and its salts"
<whitequark> fwiw, hypophosphites slightly less inert than table salt. and next most innocious process involves a palladium chloride catalyst and a formaldehyde bath. I suppose it is superfluous to explain why that doesn't excite me
<adrien> didn't find something
<adrien> would need to spend some more time on that, so from home
<whitequark> adrien: okay, thanks! I'll ask again later then
<adrien> (but I'll also probably just ask the electrolab)
<whitequark> yes, I was exactly going to bring some to electrolab :p
<whitequark> I have more than a kilo of stuff, it's enough for a hundred hackerspaces
<Drup> can't find anything either
<whitequark> Drup: are you googling by its name, or the complete list of precursors?
<whitequark> it is very possible that it has some even weirder name in french
<adrien> heh, then just ask them over IRC, I'm sure someone will know
<whitequark> oh, which channel is it?
<adrien> dunno, #electrolab? :D
<srax> i find french laws that evoque hypophosphorous acid but only speaking of food security :/
<Drup> (#ocaml-chemistry)
<Drup> (:D)
<whitequark> adrien: yeah that worked
samrat has joined #ocaml
<adrien_oww> :)
<Drup> so, what's the answer ? ^^'
<whitequark> no answer yet
sagotch has joined #ocaml
topher has joined #ocaml
Superpelican_ has joined #ocaml
maattdd has joined #ocaml
<Superpelican_> Hello I am new to OCaml (and SDL too)
<Superpelican_> I am trying to create a simple game in OCaml using Tsdl
<dmbaturin> Is it a game about fighting with computational complexity?
BitPuffin has quit [Ping timeout: 240 seconds]
<Superpelican_> no ;)
<Superpelican_> I currently have the following code: http://pastie.org/9455782
BitPuffin has joined #ocaml
<Superpelican_> But I keep getting “Error: This expression has type int but an expression was expected of type Tsdl.Sdl.uint32 = int32”
<dmbaturin> Which of the expressions?
<Superpelican_> I have tried adding a type annotation: : Sdl.uint32
<Superpelican_> but keep getting it
<Drup> Superpelican_: on line 6 ?
<Superpelican_> yes
<Superpelican_> at least
<jerith> Superpelican_: Maybe you need (Int32.of_int <expr>) instead of just <expr>?
<Superpelican_> that’s what the compiler says
<Drup> position are important :D
<Drup> Superpelican_: replace your literal by "30001l"
<Superpelican_> I know, I was a bit puzzled
<jerith> Oh, is there literal syntax for Int32?
<Drup> jerith: yes, prefix by l
<Drup> and L for int64
<Superpelican_> So if I was trying to compile this on i686 it would work?
<Superpelican_> Because there the native integer size is 32 bit
<Drup> Superpelican_: architecture doesn't matter in this case
<Superpelican_> or does OCaml use 64 bit integers by default?
<Drup> (ocaml's integers are not 32bit on 32bit arch anyway)
<adrien> s/prefix/suffix/
<adrien> # 42L;;
<adrien> - : int64 = 42L
<whitequark> integer constants really can be polymorphic
<whitequark> it could probably be possible to make them polymorphic with ppx and implicits, but that may not be worth it.
<Drup> whitequark: and how do you type "fun x -> x + 1" ? :p
<Superpelican_> This is probably a really dumb question, but what does the ‘l’ suffix mean?
oriba has joined #ocaml
<whitequark> Drup: you could make the function polymorphic too
<whitequark> but as I've said, that's probably not worth it
<whitequark> I think Rust requires you to specify the type explicitly in this case, which makes more sense
<Drup> whitequark: you need typeclass inference for that
<whitequark> yes
<Drup> it's very messy, very quickly
<Kakadu> Superpelican_: l is int32
<whitequark> yes, exactly
<Superpelican_> thanks
<Drup> Kakadu: I think he meant "what does the small l stand for"
<Superpelican_> I just found out by myself ;)
<whitequark> I tried to do something similar to it in Foundry
<whitequark> it was horrible
<Drup> and I have no idea :|
maattdd has quit [Ping timeout: 245 seconds]
<Superpelican_> typing ‘6’ in the toplevel gives me - : int = 6
<dmbaturin> whitequark: Is foundry source still on github or elsewhere?
<Superpelican_> typing ‘6l’ in the toplevel gives me - : int32 = 6
<whitequark> dmbaturin: github.com/evilmartians/foundry
<whitequark> but the code is not very nice
<Drup> Superpelican_: you can try 6L and 6n too
<Superpelican_> and how does one force 64 bit?
<whitequark> you can actually see the polymorphism of numbers in some examples, e.g. https://github.com/evilmartians/foundry/blob/master/examples/breakout.fy#L51-L66
S11001001 has joined #ocaml
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
<Drup> Superpelican_: try them.
<Superpelican_> on a not-64 bit CPU
<Superpelican_> oh
samrat has quit [Read error: Connection reset by peer]
<Drup> whitequark: "@var" ?! x)
<Drup> wtf is this syntax
<Drup> :D
<Superpelican_> Drup: but what exactly are ‘l’, ‘L’ and ’n’?
<Superpelican_> Are they just syntactic sugar for a type annotation?
<Drup> int32, int64 and nativeint (which is "whatever the current plateform is")
englishm has quit [Remote host closed the connection]
<Superpelican_> I understand
<Superpelican_> but
<whitequark> Drup: Ruby, duh
<whitequark> instance variables are @var
topher has left #ocaml [#ocaml]
englishm has joined #ocaml
<Drup> Superpelican_: not really, more like sugar to "Int32.of_int 42"
<Superpelican_> but what is the int type then?
<Drup> whitequark: this syntax looks like fabulously sigily
<Superpelican_> if it isn’t polymorphic
<Drup> Superpelican_: it's an int of size of the plateform - 1
<Superpelican_> but why does the ’n’ exist then?
<whitequark> Drup: it is very similar to Ruby.
<Drup> Superpelican_: well, to have int of the size of the plateform, without the - 1 :p
<Superpelican_> But didn’t you just say that the compiler defaults to the native size?
<Drup> - 1
<Superpelican_> if I type an integer in the toplevel without type annotation
samrat has joined #ocaml
<Superpelican_> it reports that the integer is of type int
<Superpelican_> so why would one want to add an ’n’ to an integer expression then?
<Drup> if you are on a 64 bit architecture
<Drup> (wow, a 64 bit architecture)
<Drup> the size of nativeint is 64
<adrien> I think I'll try to remove that comment
<Drup> the size of int is 63
<adrien> and add one that says "urgh a 32 bit architecture"
<Superpelican_> yes, for the garbage collector, so I read ;)
<Drup> indeed
<Superpelican_> ah wait
<Drup> for whatever reasons, sometime, having access to the "native" int, with the full width, can be handy.
<Superpelican_> so if I type ‘let x = 6’ in the top level
<Superpelican_> x actually is only 63 bits big
<Drup> yes
<Drup> adrien : It's like pink magic, it may be old, but it's still funny
<Superpelican_> but if I type ‘let x = 6n’ I get the actual 64 bit size
<Superpelican_> ok
<Superpelican_> that clears it up :)
* Drup imagines pink sparkles all over his lazy code.
<Drup> purple magic* actually
rwmjones has quit [Ping timeout: 250 seconds]
<adrien> Drup: you want sparkes? easy, try terminology
englishm has quit [Remote host closed the connection]
<Drup> whitequark: not sure you know this one, you will like it : https://github.com/ocaml/ocaml/blob/trunk/stdlib/lazy.ml#L18
englishm_ has joined #ocaml
<whitequark> Drup: yeah, I've read all of stdlib sources once when I was bored
<whitequark> I am extremely uncomfortable using any of the OO features now
<adrien> nah :P
<Superpelican_> ok now I’m getting “Error: This expression has type Tsdl.Sdl.window Tsdl.Sdl.result but an expression was expected of type Tsdl.Sdl.window”
samrat has quit [Read error: Connection reset by peer]
<whitequark> you need to match on the return value of that function
_0xAX has quit [Remote host closed the connection]
<Superpelican_> ?
<Superpelican_> So you can’t ignore the return value?
studybot has quit [Ping timeout: 264 seconds]
jprakash has joined #ocaml
<Superpelican_> apparently not
parcs has quit [Quit: WeeChat 0.4.3]
samrat has joined #ocaml
travisbrady has joined #ocaml
parcs has joined #ocaml
<Superpelican_> I know this isn’t a good idea, but
<Superpelican_> ignore doesn’t seem to work
<adrien> ignore (foo ());
<Superpelican_> never mind
<Superpelican_> I ignore’d the wrong function :)
samrat has quit [Read error: Connection reset by peer]
rand000 has quit [Ping timeout: 250 seconds]
<adrien> :)
<Superpelican_> Ok, so I ended copying almost the complete example
<Superpelican_> and now I have the following code:
<Superpelican_> But I’m getting a Syntax Error
studybot has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
inr_ has joined #ocaml
inr has quit [Ping timeout: 260 seconds]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
pgomes has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
agarwal1975 has quit [Ping timeout: 272 seconds]
mcclurmc_ has quit [Remote host closed the connection]
yomimono has joined #ocaml
oriba has quit [Quit: oriba]
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
ygrek has joined #ocaml
agarwal1975 has joined #ocaml
samrat has joined #ocaml
rand000 has joined #ocaml
jprakash has quit [Ping timeout: 245 seconds]
samrat has quit [Read error: Connection reset by peer]
zarul has quit [Quit: Leaving]
boogie has joined #ocaml
rossberg has quit [Remote host closed the connection]
samrat has joined #ocaml
<andy-c> Does anyone use utop with vim keybindings? It doesn't appear to use the readline library, e.g. which python and R use
<andy-c> readline programs will use .inputrc so you can set vi mode
hhugo has quit [Quit: Leaving.]
<smondet> andy-c: utop uses its own readline replacement
<Drup> utop doesn't use readline, but keybindings are customizable too, using a .lambdaterm-inputrc (iirc)
stevej has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
Superpelican_ has quit [Quit: Superpelican_]
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
<andy-c> hmm does that support modal editing like vi?
<andy-c> i don't think you can express the difference between emacs and vim as a list of keybindings, because vi is modal
<andy-c> thanks for the link. it doesn't appear to mention vi anywhere
sad0ur_ is now known as sad0ur
samrat has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
sagotch has quit [Quit: Leaving.]
samrat has joined #ocaml
maattdd has joined #ocaml
boogie has quit [Remote host closed the connection]
samrat has quit [Read error: Connection reset by peer]
cody__ has joined #ocaml
arjunguha has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tac_ has joined #ocaml
arjunguha has joined #ocaml
arjunguha has quit [Client Quit]
samrat has joined #ocaml
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
cody__ has quit [Quit: Leaving]
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
eikke__ has quit [Ping timeout: 260 seconds]
claudiuc_ has quit [Remote host closed the connection]
boogie has joined #ocaml
bbarker has joined #ocaml
mcclurmc has joined #ocaml
Youri has quit [Quit: Prout.]
samrat has quit [Read error: Connection reset by peer]
racycle has joined #ocaml
samrat has joined #ocaml
avsm has quit [Quit: Leaving.]
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
rwmjones has joined #ocaml
Unhammer has quit [Ping timeout: 264 seconds]
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
yomimono has quit [Ping timeout: 272 seconds]
samrat has quit [Read error: Connection reset by peer]
lpw25 has joined #ocaml
maattdd has quit [Ping timeout: 245 seconds]
samrat has joined #ocaml
english__ has joined #ocaml
englishm_ has quit [Ping timeout: 240 seconds]
arjunguha has joined #ocaml
jwatzman|work has joined #ocaml
philtor_ has joined #ocaml
eikke__ has joined #ocaml
yomimono has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
slash^ has joined #ocaml
eikke__ has quit [Ping timeout: 240 seconds]
samrat has joined #ocaml
rwmjones has quit [Ping timeout: 250 seconds]
sepp2k has quit [Quit: Konversation terminated!]
rwmjones has joined #ocaml
philtor_ has quit [Ping timeout: 250 seconds]
avsm has joined #ocaml
_0xAX has joined #ocaml
parcs has quit [Remote host closed the connection]
samrat has quit [Read error: Connection reset by peer]
yomimono has quit [Ping timeout: 250 seconds]
parcs has joined #ocaml
maattdd has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
Muzer has quit [Excess Flood]
claudiuc has joined #ocaml
samrat has joined #ocaml
Muzer has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
BitPuffin has quit [Ping timeout: 240 seconds]
samrat has joined #ocaml
troutwine_away is now known as troutwine
NoNNaN has quit [Remote host closed the connection]
samrat has quit [Read error: Connection reset by peer]
Simn has quit [Read error: Connection reset by peer]
NoNNaN has joined #ocaml
samrat has joined #ocaml
q66 has joined #ocaml
maattdd has quit [Ping timeout: 264 seconds]
travisbrady has quit [Quit: travisbrady]
samrat has quit [Read error: Connection reset by peer]
Hannibal_Smith has joined #ocaml
samrat has joined #ocaml
lpw25 has quit [Ping timeout: 255 seconds]
maattdd has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
bjorkintosh has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
locallycompact has quit [Ping timeout: 260 seconds]
samrat has joined #ocaml
ygrek has quit [Ping timeout: 260 seconds]
samrat has quit [Read error: Connection reset by peer]
maattdd has quit [Ping timeout: 264 seconds]
philtor_ has joined #ocaml
mcclurmc has joined #ocaml
samrat has joined #ocaml
maattdd has joined #ocaml
Superpelican_ has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
travisbrady has joined #ocaml
ygrek has joined #ocaml
avsm has quit [Quit: Leaving.]
divyanshu has joined #ocaml
stevej has quit [Quit: Computer has gone to sleep.]
troutwine is now known as troutwine_away
samrat has quit [Read error: Connection reset by peer]
fold has quit [Ping timeout: 255 seconds]
<Superpelican_> 14:38 <Superpelican_> http://pastie.org/9455861
<Superpelican_> 14:38 <Superpelican_> But I’m getting a Syntax Error
<Superpelican_> Does anyone know why I’m getting this?
<Superpelican_> Was the example written for an older OCaml version or something like that?
<whitequark> what error exactly do you get?
<Superpelican_> just the syntax error
<def`> This is not the example.
<def`> You copy pasted random piece of codes.
<Superpelican_> def`: I copy pasted a part of the example
<Superpelican_> read: almost everything ;)
<def`> Superpelican_: so you know where to look
<Superpelican_> I mostly understand the code
<Drup> well, if you take a random subset of a valid piece of code, it's not always a valid piece of code ...
<Drup> :)
<def`> There is a pattern matching popping out of nowhere.
<Superpelican_> ah
<Superpelican_> you’re right
<Superpelican_> how stupid of me
<def`> :D
<Superpelican_> I forgot the match with etc.
<Superpelican_> I’m a bit tired today :(
<Superpelican_> And when I am, I tend to miss really stupid things
<Superpelican_> It compiled :D
philtor_ has quit [Ping timeout: 272 seconds]
Kakadu has quit [Quit: Page closed]
<Superpelican_> def`: “match Sdl.init Sdl.Init.video with” Sdl.Init.video is an argument of Sdl.init, right?
S11001001 has joined #ocaml
<Drup> yes
S11001001 has quit [Changing host]
S11001001 has joined #ocaml
<Superpelican_> ok
maattdd has quit [Ping timeout: 250 seconds]
_0xAX has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 250 seconds]
tac_ has quit [Read error: Connection reset by peer]
tac_ has joined #ocaml
fold has joined #ocaml
badon has quit [Ping timeout: 260 seconds]
Algebr has joined #ocaml
arjunguh_ has joined #ocaml
<Algebr> In a pattern match, how can I get a handle on the entire variant being matched? In haskell I would do | h@Foo(a, b, c)
arjunguha has quit [Ping timeout: 272 seconds]
<Drup> Foo (a, b, c) as h
<Algebr> ah, I was gonna try the as but thought..no it can't be that simple
<Drup> :)
jrw has quit [Ping timeout: 240 seconds]
arjunguh_ has quit [Quit: Textual IRC Client: www.textualapp.com]
dsheets has joined #ocaml
slash^ has left #ocaml [#ocaml]
maattdd has joined #ocaml
pyon has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 245 seconds]
Kakadu has joined #ocaml
samrat has joined #ocaml
BitPuffin has joined #ocaml
maattdd has quit [Ping timeout: 264 seconds]
maattdd has joined #ocaml
<gperetin> could somebody help with this snippet? https://gist.github.com/gperetin/1f2e5cfa9c34ae946128
<gperetin> specifically, why is digit_transition called with 2 arguments
<gperetin> and it's defined with one
<Drup> it's defined with two :)
<Drup> "let f = function ..." is equivalent to "let f x = match x with ..."
<gperetin> oooh
<gperetin> but in first definition f is function
<gperetin> this one is called with two arguments, none of them is function
<Algebr> Silly question, but asts, they don't necessarily have to be binary trees right?
<jerith> Algebr: I don't think I've seen many that are binary trees.
<Drup> *binary* trees, certainly not
<Drup> if an AST is not a tree, it's usually already more than an AST (a control flow graph, for example)
<Drup> gperetin: not sure to understand your question, but I advise you to play with "function" in a toplevel
<Drup> you will get it quickly
<Algebr> so would a silly ast be something like type ast = Leaf | Node of node list
<gperetin> you helped enough, I'm just rewriting this from function to match syntax, just to understand it better, thanks!
<Drup> Algebr: note that this is already not a binary tree
<Algebr> or rather type 'a ast = Leaf | Node of a * node list
<Algebr> yea, realized that after I typed it
<Drup> and I would say it's too general for an AST
Unhammer has joined #ocaml
<Drup> You may want something a bit more customized
<ggole> More like type term = Var of symbol | Int of int | Bin of binary_op * term * term | ... and binary_op = Add | Sub | ...
<Algebr> How could I capture top level expressions?
<Algebr> like in ocaml, I can do 1 + 1 without binding to a name
<Drup> Algebr: top_level = Term of term | ...
<Drup> and parser magic.
samrat has quit [Read error: Connection reset by peer]
maattdd has quit [Ping timeout: 245 seconds]
samrat has joined #ocaml
maattdd has joined #ocaml
samrat has quit [Read error: Connection reset by peer]
Superpelican_ has quit [Quit: Superpelican_]
samrat has joined #ocaml
Algebr has quit [Remote host closed the connection]
divyanshu has quit [Quit: Textual IRC Client: www.textualapp.com]
philtor_ has joined #ocaml
cody__ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
BitPuffin has quit [Ping timeout: 255 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
Mercuria1Alchemi has quit [Ping timeout: 260 seconds]
MercurialAlchemi has quit [Ping timeout: 272 seconds]
_andre has quit [Quit: leaving]
oriba has joined #ocaml
ggole has quit []
english__ has quit [Remote host closed the connection]
englishm has joined #ocaml
Thooms has joined #ocaml
sad0ur has quit [Ping timeout: 245 seconds]
englishm has quit [Remote host closed the connection]
englishm_ has joined #ocaml
sad0ur has joined #ocaml
tautologico has joined #ocaml
S11001001 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
axiles has quit [Ping timeout: 245 seconds]
yomimono has joined #ocaml
maattdd has quit [Ping timeout: 255 seconds]
englishm_ has quit [Quit: Leaving...]
jrw has joined #ocaml
philtor_ has quit [Ping timeout: 245 seconds]
englishm has joined #ocaml
jwatzman|work has joined #ocaml
sad0ur has quit [Ping timeout: 250 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
jprakash has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
q66_ has joined #ocaml
q66 has quit [Ping timeout: 260 seconds]
BitPuffin has joined #ocaml
englishm has quit [Remote host closed the connection]
englishm has joined #ocaml
Guest11878 is now known as Haudegen
lordkryss has quit [Quit: Connection closed for inactivity]
englishm has quit [Ping timeout: 246 seconds]
lordkryss has joined #ocaml
jprakash has quit [Ping timeout: 272 seconds]
tane has quit [Quit: Verlassend]
boogie has quit [Remote host closed the connection]
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yomimono has quit [Ping timeout: 245 seconds]
tobiasBora has joined #ocaml
philtor_ has joined #ocaml
BitPuffin has quit [Ping timeout: 272 seconds]
Arsenik has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
q66_ is now known as q66
agarwal1975 has quit [Quit: agarwal1975]
dorei has joined #ocaml
ousado has quit [Ping timeout: 272 seconds]
jprakash has joined #ocaml
tautologico has joined #ocaml
fold has quit [Ping timeout: 255 seconds]
maria2 has joined #ocaml
<maria2> HELO
<maria2> HELLO
<maria2> HELO
<maria2> HOLA
<maria2> ALGUIEN AQUI
<dorei> hi
<maria2> AQUI ESPANOL
<maria2> HABLA EN ESPASOL
jprakash has quit [Ping timeout: 255 seconds]
jprakash has joined #ocaml
<maria2> SI
<maria2> AQU
jao has quit [Ping timeout: 250 seconds]
<maria2> ME VOY ESTA POR QUERIA
maria2 has left #ocaml [#ocaml]
tobiasBora has quit [Quit: Konversation terminated!]
anddam has left #ocaml ["WeeChat 0.4.3"]
agarwal1975 has joined #ocaml
ousado has joined #ocaml
araujo has quit [Read error: Connection reset by peer]
Kakadu has quit [Quit: Konversation terminated!]
araujo has joined #ocaml
shinnya has joined #ocaml
tac_ is now known as tac-tics
SethTisue has joined #ocaml
pyon has joined #ocaml
fold has joined #ocaml
parcs has quit [Remote host closed the connection]
travisbrady has quit [Quit: travisbrady]
parcs has joined #ocaml
cody__ has quit [Quit: Leaving]
Thooms has quit [Ping timeout: 245 seconds]
tautologico has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
madroach has quit [Ping timeout: 250 seconds]
darkf has joined #ocaml
darkf has quit [Changing host]
darkf has joined #ocaml
madroach has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
travisbrady has joined #ocaml
yomimono has joined #ocaml
dorei has quit []
tac-tics has quit [Quit: Leaving]