<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…]
<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"
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+
<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)
<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
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]
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
<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?
<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?