lapinou 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 | Public logs at http://tunes.org/~nef/logs/ocaml/
boogie has joined #ocaml
<tautologico> whitequark: I think that what the book is saying is that because ocaml strings are not null-terminated, they can contain 0s
<penryu> is there an ocaml equiv of hoogle? because I need a function ('a option list) -> ('a list), or catMaybes
shinnya has joined #ocaml
<penryu> writing one is simple enough, but I can't help but think something in JS Core or similar already has something.
<whitequark> tautologico: that's an independent statement.
<Drup> penryu: it's not very precised, though
<penryu> Drup: thanks.
tlockney is now known as tlockney_away
<penryu> Drup: what do you mean?
<whitequark> take a look at the graph below. either the last word in the string contains filler \0's, or it only contains the number of such filler \0's, which is 0, and so it ends with \0 anyway.
<Drup> try it, you will see
<penryu> oic. it doesn't find an identical signature
<Drup> it does
<Drup> filter_all is correct
<tautologico> whitequark: actually it seems strings are null-terminated
pango has quit [Quit: ZNC - http://znc.in]
<Drup> penryu: but the others are not
<penryu> I see List.filter_opt
<Drup> penryu: filter_opt*
<penryu> ah. :)
<penryu> yep, that's exactly what I was looking for.
<penryu> on both counts :)
<whitequark> tautologico: exactly
<whitequark> it's a very clever trick actually
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<tautologico> according to what I can make from caml_alloc_string in byterun/alloc.c it sets the last word to 0
<tautologico> and then something else happens at the last byte
ollehar has quit [Ping timeout: 240 seconds]
jonludlam has quit [Ping timeout: 240 seconds]
q66 has quit [Ping timeout: 252 seconds]
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
punrye has joined #ocaml
acieroid` has joined #ocaml
flx_ has joined #ocaml
__marius____ has joined #ocaml
termos_ has joined #ocaml
flx_ is now known as Guest96741
bartbes_ has joined #ocaml
Valda has joined #ocaml
adrien_o1w has joined #ocaml
wormphle1m has joined #ocaml
cow-orke1 has joined #ocaml
companion_square has joined #ocaml
nickmeha1ry has joined #ocaml
alex_nx has quit [Ping timeout: 265 seconds]
Valdo has quit [Ping timeout: 265 seconds]
amiller has quit [Ping timeout: 265 seconds]
__marius___ has quit [Ping timeout: 265 seconds]
Khady has quit [Ping timeout: 265 seconds]
strmpnk has quit [Ping timeout: 265 seconds]
adrien_oww has quit [Ping timeout: 265 seconds]
cdidd has quit [Ping timeout: 265 seconds]
cow-orker has quit [Ping timeout: 265 seconds]
wormphlegm has quit [Ping timeout: 265 seconds]
termos has quit [Ping timeout: 265 seconds]
penryu has quit [Ping timeout: 265 seconds]
morolin has quit [Ping timeout: 265 seconds]
companion_cube has quit [Ping timeout: 265 seconds]
acieroid has quit [Ping timeout: 265 seconds]
nickmeharry has quit [Ping timeout: 265 seconds]
zarul has quit [Ping timeout: 265 seconds]
bartbes has quit [Ping timeout: 265 seconds]
flux has quit [Ping timeout: 265 seconds]
Valda is now known as Valdo
studybot_ has quit [Read error: Connection reset by peer]
__marius____ is now known as __marius___
alex_nx has joined #ocaml
cdidd has joined #ocaml
termos_ is now known as termos
Khady has joined #ocaml
Guest96741 is now known as flux
strmpnk has joined #ocaml
punrye is now known as penryu
morolin has joined #ocaml
nikki93_ has joined #ocaml
amiller_ has joined #ocaml
nikki93 has quit [Remote host closed the connection]
zarul[afk] has joined #ocaml
watermind has quit [Write error: Broken pipe]
penryu has quit [Changing host]
penryu has joined #ocaml
watermind has joined #ocaml
tidren has joined #ocaml
boogie has quit [Remote host closed the connection]
jao has quit [Ping timeout: 276 seconds]
michael_lee has joined #ocaml
ousado_ has joined #ocaml
ousado has quit [Ping timeout: 276 seconds]
ToTheInternet has quit [Ping timeout: 240 seconds]
jwatzman|work has joined #ocaml
claudiuc has quit [Remote host closed the connection]
studybot_ has joined #ocaml
<whitequark> mrvn: suddenly I stumble upon your libzmq patch! (https://github.com/mrvn/libzmq/commit/bdc7e633a4bf46e1609c0746667d99ea43ce4e17)
<whitequark> world is truly tiny.
zzing has quit [Quit: Textual IRC Client: www.textualapp.com]
zpe has joined #ocaml
ousado_ has quit [Ping timeout: 252 seconds]
zpe has quit [Ping timeout: 250 seconds]
nikki93_ has quit [Remote host closed the connection]
nikki93 has joined #ocaml
ousado_ has joined #ocaml
ygrek has joined #ocaml
boogie has joined #ocaml
watermind has quit [Quit: Konversation terminated!]
tidren has quit [Remote host closed the connection]
amiller_ is now known as amiller
amiller is now known as Guest89113
ebzzry has joined #ocaml
tidren has joined #ocaml
shinnya has quit [Ping timeout: 252 seconds]
WraithM has quit [Remote host closed the connection]
manizzle has joined #ocaml
Topher has left #ocaml []
aurynj has quit [Quit: Leaving]
Guest89113 is now known as amiller_
yacks has joined #ocaml
<ruzu> o caml, my caml
<whitequark> idea for writing a very portable application with an OCaml functional core and pluggable native GUIs: ask ocamlopt to produce an object file, then invoke caml_main(), which would spawn a separate thread, in which everything interesting would happen
<whitequark> the GUI communicates with OCaml core via zeromq
<whitequark> basically, this can be integrated in every single platform I'm aware of, without imposing any requirements whatsoever on the language used for implementing the GUI
tidren has quit [Remote host closed the connection]
so has joined #ocaml
knz has quit [Ping timeout: 246 seconds]
rta has quit [Ping timeout: 246 seconds]
knz has joined #ocaml
nikki93 has quit [Remote host closed the connection]
amiller_ is now known as amiller
amiller has quit [Changing host]
amiller has joined #ocaml
tidren has joined #ocaml
lostcuaz has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
nikki93 has joined #ocaml
divyanshu has joined #ocaml
iorivur_ has joined #ocaml
iorivur has quit [Ping timeout: 252 seconds]
boogie has quit [Remote host closed the connection]
pencilk has joined #ocaml
aquinas has joined #ocaml
pencilk has quit [Remote host closed the connection]
aquinas has quit [Quit: leaving]
jk_ has joined #ocaml
<tautologico> whitequark: people have done this kind of thing but using "standard" sockets
manizzle has quit [Ping timeout: 276 seconds]
jao has joined #ocaml
jao has quit [Changing host]
jao has joined #ocaml
|jbrown| has joined #ocaml
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jbrown has quit [Ping timeout: 246 seconds]
|jbrown| has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
iorivur_ has quit [Ping timeout: 240 seconds]
jonludlam has joined #ocaml
rta has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
iorivur has joined #ocaml
tlockney_away is now known as tlockney
morolin has quit [Ping timeout: 276 seconds]
jonludlam has quit [Ping timeout: 240 seconds]
yacks has quit [Ping timeout: 250 seconds]
axiles has joined #ocaml
morolin has joined #ocaml
ggole has joined #ocaml
michel_mno_afk is now known as michel_mno
tlockney is now known as tlockney_away
tidren has quit [Remote host closed the connection]
tidren has joined #ocaml
yacks has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
boogie has joined #ocaml
ygrek has quit [Ping timeout: 276 seconds]
iorivur has quit [Quit: No Ping reply in 180 seconds.]
iorivur has joined #ocaml
siddharthv_away is now known as siddharthv
caligula has joined #ocaml
nikki93 has quit [Remote host closed the connection]
<ggole> Hmm, Haskell is getting abstraction over patterns
<ggole> Do want
nikki93 has joined #ocaml
boogie has quit [Remote host closed the connection]
pyon has quit [Ping timeout: 240 seconds]
zpe has joined #ocaml
Kakadu has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
Simn has joined #ocaml
Kakadu_ has joined #ocaml
Kakadu has quit [Ping timeout: 240 seconds]
tidren has quit [Remote host closed the connection]
<def-lkb> ggole: do you have a link about this feature?
tlockney_away is now known as tlockney
michael_lee has quit [Quit: Ex-Chat]
Vinnipeg has joined #ocaml
ygrek has joined #ocaml
tlockney is now known as tlockney_away
tautologico has quit [Quit: Connection closed for inactivity]
elfring has joined #ocaml
ikaros has joined #ocaml
companion_square is now known as companion_cube
yacks has quit [Ping timeout: 252 seconds]
yacks has joined #ocaml
ygrek has quit [Ping timeout: 250 seconds]
adrien_o1w is now known as adrien_oww
<def-lkb> ok, thanks ggole. Interesting, I think I'd prefer views over synonyms first
<ggole> Other way for me, but that may be because I've recently written some code that would have benefited greatly from synonyms.
<ggole> (Had a good whinge about it, too.)
zpe has joined #ocaml
nikki93 has quit [Remote host closed the connection]
tlockney_away is now known as tlockney
jbrown has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
tlockney is now known as tlockney_away
ocp has joined #ocaml
ollehar has joined #ocaml
ygrek has joined #ocaml
iorivur has quit [Ping timeout: 252 seconds]
vbmithr has quit [Quit: Lost terminal]
vbmithr has joined #ocaml
jbrown has quit [Ping timeout: 252 seconds]
nikki93 has joined #ocaml
avsm has joined #ocaml
studybo__ has joined #ocaml
studybot_ has quit [Ping timeout: 240 seconds]
nojb has joined #ocaml
tlockney_away is now known as tlockney
jao has quit [Ping timeout: 250 seconds]
nojb has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
tlockney is now known as tlockney_away
Hannibal_Smith has joined #ocaml
nojb has joined #ocaml
nojb` has joined #ocaml
nojb` has quit [Client Quit]
nojb` has joined #ocaml
nojb has quit [Ping timeout: 276 seconds]
AltGr has joined #ocaml
jbrown has joined #ocaml
Drosophila has joined #ocaml
<Drosophila> hello
Drosophila is now known as ente
ente has quit [Changing host]
ente has joined #ocaml
<ente> I've been trying to build omake but it fails with "unbound variable: public.dir"
<ente> any ideas how to resolve this?
tlockney_away is now known as tlockney
<ente> the relevant section from OMakeroot from the omake distribution is this:
<ente> PATH[] +=
<ente> $(dir ocamldep)
nojb` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
nojb has joined #ocaml
tlockney is now known as tlockney_away
_andre has joined #ocaml
nojb has quit [Ping timeout: 240 seconds]
nojb has joined #ocaml
michel_mno has quit [Quit: _o<]
michel_mno has joined #ocaml
studybo__ is now known as studybot
mort___ has joined #ocaml
<thorsten`> what's the most common way to build ocaml projects (using pure ocaml & the native interface)? I have some large Makefile here becoming messy
<johnelse> thorsten`: oasis is pretty much the standard
jonludlam has joined #ocaml
tlockney_away is now known as tlockney
nojb has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<thorsten`> oasis' ini-style config file reminds me of the haskell build system :)
ygrek has quit [Ping timeout: 252 seconds]
tlockney is now known as tlockney_away
tidren has joined #ocaml
avsm has quit [Quit: Leaving.]
Thooms has joined #ocaml
mort___ has quit [Quit: Leaving.]
<adrien_oww> there's probably a reason ;p
iorivur has joined #ocaml
AltGr has left #ocaml []
AltGr has joined #ocaml
<Drup> thorsten`: oasis is very inspired by the cabal build system, which is a good thing
<elfring> Would you like to start any software development experiments with another class library?
<Drup> and it avoids being inspired by the terrible "package manager" part of cabal.
<companion_cube> elfring: many people don't use objects in OCaml
<adrien_oww> s/many/99.9% of/
<flux> well I think more than 0.1% of ocaml users use OcamlNet..
<companion_cube> is 0.1% of all users bigger than 1 ? :D
jonludlam has quit [Ping timeout: 252 seconds]
<hyPiRion> there are 190 nicks in this channel, so presumably yes
<adrien_oww> companion_cube: well, there's at least elfring and Guarigues :P
<companion_cube> :)
<adrien_oww> and Gerd!
<Drup> we need to distinguish people that use type system hacks that uses objets (js_of_ocaml, for example) and people that really use objects
jonludlam has joined #ocaml
<adrien_oww> but isn't the whole point of objects to get a typing that is different from usual?
studybot has quit [Remote host closed the connection]
Vinnipeg has quit [Remote host closed the connection]
<Drup> adrien_oww: and open recursion
<Drup> I use them for that in lilis
<Drup> I will eventually get rid of them, but it was the easiest implementation with inheritence + recursion
<gasche> the reason why elfring insists on using objets is silly: he found a library that encapsulates references over immutable maps, and prefers it to using references on immutable maps directly
<jpdeplaix> Drup: open recursion can be done with recursive modules.
<Drup> jpdeplaix: it can be done, indeed
<Drup> even with high order function + record, yes
<Drup> it's not the easiest :)
<Drup> gasche: such courage, you are still trying :)
<jpdeplaix> :D
<companion_cube> jpdeplaix: arghhhhh
<jpdeplaix> Drup: Personally I'd prefer recursive modules over objects if the main need is open recursion
<Drup> blargh.
<Drup> with inheritence, it's just painful to use
<Drup> possible
<Drup> but painful
<elfring> gasche: OTCL supports mutable and immutable processing styles for OCaml.
<adrien_oww> a common pattern in ocaml is to be very flat, i.e. have few layers
<adrien_oww> and be very explicit about which data structures are being used
<jpdeplaix> Drup: oh well, my bad. I wasn't aware that it requires explicit type for the module
<Drup> yeah
<jpdeplaix> so ok. Object is a good deal there :D
<Drup> :D
iorivur has quit [Ping timeout: 245 seconds]
<Drup> in my specific case, with a bit of work, I could get rid of the recursion and then I just use records
divyanshu has quit [Quit: Computer has gone to sleep.]
jonludlam has quit [Ping timeout: 276 seconds]
siddharthv is now known as siddharthv_away
aurynj has joined #ocaml
studybot has joined #ocaml
studybot has quit [Remote host closed the connection]
studybot has joined #ocaml
<def-lkb> jpdeplaix: I think that recursive modules do not provide you with open recursion, unless you encode an object model above using functors
tobiasBora has joined #ocaml
tlockney_away is now known as tlockney
avsm has joined #ocaml
jk_ has quit [Remote host closed the connection]
tlockney is now known as tlockney_away
darkf has quit [Quit: Leaving]
jonludlam has joined #ocaml
divyanshu has joined #ocaml
shinnya has joined #ocaml
tidren has quit [Remote host closed the connection]
tidren has joined #ocaml
iorivur has joined #ocaml
<pippijn> Drup: yellow on yellow, brilliant
Nevor_ has joined #ocaml
troydm has quit [Ping timeout: 252 seconds]
tidren has quit [Ping timeout: 276 seconds]
Hannibal_Smith has quit [Quit: Sto andando via]
ikaros has quit [Quit: Ex-Chat]
ygrek has joined #ocaml
hyPiRion has quit [Ping timeout: 245 seconds]
ikaros has joined #ocaml
hyPiRion has joined #ocaml
lpw25 has joined #ocaml
ebzzry has quit [Read error: Connection reset by peer]
Thooms has quit [Quit: WeeChat 0.3.8]
ebzzry has joined #ocaml
_andre has quit [Quit: leaving]
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
tobiasBora has quit [Read error: Connection reset by peer]
Nevor_ has quit [Ping timeout: 240 seconds]
tobiasBora has joined #ocaml
mort___ has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
rand000 has joined #ocaml
troydm has joined #ocaml
testcocoon has quit [Client Quit]
testcocoon has joined #ocaml
elfring has quit [Remote host closed the connection]
aurynj has quit [Ping timeout: 245 seconds]
iorivur has quit [Ping timeout: 276 seconds]
shinnya has quit [Ping timeout: 252 seconds]
tlockney_away is now known as tlockney
tane has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
lostcuaz has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
WraithM has joined #ocaml
michel_mno is now known as michel_mno_afk
zpe has joined #ocaml
iorivur has joined #ocaml
sgnb has left #ocaml []
sgnb has joined #ocaml
<sgnb> can someone with proper privileges fix all links under http://gallium.inria.fr/~pouillar/ in ocamlbuild wiki?
rta has quit [Ping timeout: 252 seconds]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe_ has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
rta has joined #ocaml
ebzzry has quit [Ping timeout: 258 seconds]
boogie has joined #ocaml
chichimaru has joined #ocaml
tobiasBora has quit [Ping timeout: 246 seconds]
axiles has quit [Ping timeout: 252 seconds]
Hannibal_Smith has joined #ocaml
axiles has joined #ocaml
chichimaru_ has joined #ocaml
chichimaru has quit [Ping timeout: 258 seconds]
AltGr has left #ocaml []
ikaros has quit [Quit: Ex-Chat]
iorivur has quit [Ping timeout: 252 seconds]
ebzzry has joined #ocaml
Kakadu_ has quit [Quit: Page closed]
chichimaru__ has joined #ocaml
chichimaru_ has quit [Ping timeout: 240 seconds]
chichimaru__ has quit [Ping timeout: 250 seconds]
tidren has joined #ocaml
justinfront has joined #ocaml
<justinfront> does anyone know much about doing textfields with liblgl
mort___ has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
ebzzry has quit [Ping timeout: 245 seconds]
julm has quit [Quit: bye]
q66 has quit [Ping timeout: 252 seconds]
araujo has quit [Ping timeout: 255 seconds]
q66 has joined #ocaml
q66 has quit [Changing host]
q66 has joined #ocaml
nikki93 has quit [Ping timeout: 276 seconds]
<smondet> justinfront: I did that very long ago, just find an OpenGL + TTF tutorial, and translate to OCaml (bindings are pretty thin) (for TTF you have Sdl_ttf)
<smondet> there was also quick & dirty way of getting text with bitmap fonts
Kakadu has joined #ocaml
tlockney is now known as tlockney_away
tlockney_away is now known as tlockney
lpw25 has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
tidren has quit [Remote host closed the connection]
tidren has joined #ocaml
lordkryss_ has joined #ocaml
Watcher7 has quit [Quit: h]
tlockney is now known as tlockney_away
nikki93 has joined #ocaml
tidren has quit [Remote host closed the connection]
jonludlam has quit [Ping timeout: 240 seconds]
avsm has joined #ocaml
tlockney_away is now known as tlockney
divyanshu has quit [Quit: Computer has gone to sleep.]
claudiuc has joined #ocaml
lordkryss_ is now known as lordkryss
tidren has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
tidren has quit [Remote host closed the connection]
divyanshu has joined #ocaml
hellome has quit [Ping timeout: 240 seconds]
ocp has quit [Ping timeout: 252 seconds]
tlockney is now known as tlockney_away
tane has quit [Quit: Verlassend]
tlockney_away is now known as tlockney
divyanshu has quit [Quit: Computer has gone to sleep.]
divyanshu has joined #ocaml
jonludlam has joined #ocaml
acieroid` is now known as acieroid
Hannibal_Smith has quit [Quit: Sto andando via]
nikki93 has quit [Remote host closed the connection]
nikki93 has joined #ocaml
justinfront has quit [Ping timeout: 240 seconds]
nikki93 has quit [Ping timeout: 240 seconds]
petterw has quit [Quit: leaving]
nikki93 has joined #ocaml
divyanshu has quit [Quit: Computer has gone to sleep.]
boogie has quit [Quit: Leaving...]
divyanshu has joined #ocaml
avsm has quit [Quit: Leaving.]
divyanshu has quit [Client Quit]
WraithM has quit [Quit: Lost terminal]
sgnb has quit [Read error: Connection reset by peer]
divyanshu has joined #ocaml
sgnb has joined #ocaml
divyanshu has quit [Client Quit]
<whitequark> how do I enable a syntax extension via oasis?
Topher has joined #ocaml
ggole has quit []
petterw has joined #ocaml
nikki93 has quit [Remote host closed the connection]
nikki93_ has joined #ocaml
<whitequark> nevermind
iZsh has quit [Quit: ZNC - http://znc.in]
iZsh has joined #ocaml
tidren has joined #ocaml
rand000 has quit [Quit: leaving]
Simn has quit [Quit: Leaving]
ocp has joined #ocaml
Rota has joined #ocaml
<Rota> A question about type and type names. What is the difference.
<companion_cube> what do you mean by type name ?
poarks has quit [Quit: leaving]
lordkryss has quit [Quit: Connection closed for inactivity]
Submarine has quit [Quit: Leaving]
bjkeller has joined #ocaml
tautologico has joined #ocaml
axiles has quit [Remote host closed the connection]
Kakadu has quit [Quit: Konversation terminated!]
<Rota> In this case: type card = Heart | Club| Spade | Diamond
<Rota> card it the typename , and Heart Club Spade Diamond are types.
<Drup> No.
<Rota> But, is card also a type?
<Drup> card is a type, Heart, Club, Spade and Diamond are *constructors* for the type card
<Drup> constructors aren't type, they are values
<whitequark> Topher: yeah, thanks
<Rota> OK
<mrvn> and it is type kind = Heart | Club| Spade | Diamond type value = int type card = kind * value
<Rota> type kind = Heart | Club| Spade | Diamond of int
<Rota> let a=Diamond 10;;
<Rota> When I run these 2 lines code
<Rota> toplevel said,
<Rota> val a : kind = Diamond 10
<Drup> seems right.
nikki93_ has quit [Remote host closed the connection]
<Rota> Then "a" is a value, kind is a type, what is Diamond here ?
<mrvn> Rota: but not: let a = Heart 10;;
<mrvn> Rota: Diamond is a constructor, one with an integer argument
<Drup> Rota: a is the name of the variable, which value is "Diamond 10"
<mrvn> Drup: there are no variables.
<mrvn> a is the name of the binding
<Drup> whatever the name you give them
<Rota> that's ok.
bjkeller has quit [Remote host closed the connection]
<Drup> it's called variable in all the litterature, it's called variable in math, it's called variable in the standard ocaml manual
nikki93 has joined #ocaml
<Rota> Is the concept of *constructor* appear in other places than type definition?
<mrvn> Drup: it's called a binding in the litterature abot functional programming
<Drup> Rota: no
<Drup> a constructor is a constructor *of a type*
shinnya has joined #ocaml
bjkeller has joined #ocaml
ocp has quit [Ping timeout: 252 seconds]
<Rota> OK.Thanks. Another question is how we should understand "of" in the type definition.
<tautologico> "variable" is fine
lostcuaz has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Drup> Rota: "Foo of bar" means "A constructor Foo, which takes some value of type bar as argument"
<mrvn> Drup: from the manual: "Caml has no built-in notion of variable - identifiers whose current value can be changed by assignment. (The let binding is not an assignment, it introduces a new identifier with a new scope.) ... Variables can then be emulated by let-binding a reference.". But it calles them variables too some places. Kind of a bug.
<companion_cube> well it's a variable in the mathematical acception
<Drup> mrvn: there was a thread in the caml list about this
<mrvn> usualy with variable you mean something that can be changed.
<Drup> I consider this discussion completly in interesting.
<Drup> uninteresting*
<Drup> Most people understand variable perfectly fine, only people who already now the various meaning nitpick about it.
<companion_cube> mrvn: not in mathematics
jens has joined #ocaml
<companion_cube> and OCaml authors are pretty mathematics-oriented people
<mrvn> companion_cube: true
jens is now known as Guest32890
Guest32890 has quit [Client Quit]
<tautologico> as are functional programming people
<mrvn> But people that come from a C (or similar imperative language) background hear variable and get verry confused that they don't behave like a variable in C.
<tautologico> the notion of "variable" in mathematics is the same as variables in pure FP
NoNNaN has quit [Ping timeout: 272 seconds]
<mrvn> hence the naming of type variables and let bindings.
<penryu> doesn't the C usage of variable extend Computer Science's bastardization of the term "variable" in the first place?
<companion_cube> mrvn: well they can learn ;)
NoNNaN has joined #ocaml
<tautologico> I think it's only a minor problem for beginners... once they understand the difference, it's ok
<tautologico> we use a lot of "overloaded" terms everywhere
<companion_cube> but you can't rename well-defined mathematical objects because their definition is "overloaded" by some other community
<penryu> sure you can.
<companion_cube> in theory yes, but that's not a good idea
<companion_cube> I had an argument recently with people who thought "lambda" was a frightening term for many people
<mrvn> I think binding also better reflects that "let a = b" does not create a new variable. Only binds a new name.
<companion_cube> and that people would turn around and not learn what it means
<companion_cube> :(
<penryu> tell them to watch "Revenge of the Nerds"; that'll stop
<mrvn> companion_cube: they do and that is a good thing.
<companion_cube> :)
<mrvn> scare of the weaklings
<companion_cube> stop that elitism now!
<companion_cube> good night folks
<Drup> companion_cube: there was the same thing about monads in rust :)
<tautologico> F# has syntactic support for monads but they call them "computation expressions" :)
<Rota> Can I say something like 'type kind = Heart | Club| Spade | Diamond of (int|float)'
dkg has quit [Quit: leaving]
<Rota> type kind = Heart | Club| Spade | Diamond of (int|float)
<Drup> no
<penryu> so F# takes the same mathematical concept and binds it to an additional name.
<Drup> Rota: you can't have untagged unions
<Drup> you can do : "type foo = Int of int | Float of float"
<mrvn> you can't have untagged anything
<mrvn> Rota: you can say something like "of (int|float)" but that type is not populated. You can not create a value of that type.
tobiasBora has joined #ocaml
<Rota> why we disallow untagged things? any reason when designed?
<mrvn> Rota: such types only make sense with classes where an object can be multiple types at the same time.
<Drup> Rota: what operators can you apply to something of type "int|float" ?
<mrvn> Rota: untagged things would onfuse the GC.
<Drup> can you apply a float only operators ?
<mrvn> s/onfuse/confuse/
<Drup> What is going to happen if you try to take the length of an element of type "string|float" ?
<mrvn> Rota: for every value the GC needs to know if it is a pointer or integer.
<Drup> you see very quickly that it's very unsafe in a langage without runtime type checks
<Drup> well, very unsafe at all, actually
<Rota> OK. Thanks. You mean all the type checkings are static in OCaml, right?
<Drup> exactly
<mrvn> Rota: means you get the type errors before you ship your programm to users.
<penryu> maybe you can somehow integrate an (int, float) either type into the kind constructor?
<mrvn> penryu: type intfloat = Int of int | Float of float
<Rota> Yes.
<penryu> mrvn: right.
<penryu> missed that.
<penryu> assuming this question in the context of playing cards is purely academic...
<Rota> Now I have,
<Rota> type number = Intnumber of int | Floatnumber of float
<Rota> type kind = Heart | Club| Spade | Diamond of number
<Rota> let f = function Heart -> 1 |Club -> 2 |Spade -> 3 | Diamond Floatnumber y -> 4 | Diamond Intnumber x -> x;;
<Drup> and then the compiler tell you that x is not an int :)
<Drup> oh, nevermind, skip a word
<Drup> it tels you that the pattern matching is incomplete
<Rota> but I cannot do this
<nicoo> Drup: How so ?
<Rota> f(Diamond Floatnumber 10)
<Rota> or f(Diamond Floatnumber 10.0)
<nicoo> Rota: Use 10.
<Drup> or I'm just tired and can't play the typechecker anymore x)
<nicoo> Drup: Go sleep
<mrvn> Rota: f(Diamond (Floatnumber 10.))
<Rota> Drup: Good night. Thanks for your help.
<Rota> Yes. That works.
<Rota> Cool.
<mrvn> Rota: Diamond Floatnumber 10.0 would mean Diamond takes 2 arguments. But constructor always take one argument, potentially a tuple.
nk0 has quit [Ping timeout: 240 seconds]
nk0 has joined #ocaml
<Rota> Can I consider a constructor a function taking a type and output a type/value?
<mrvn> Just FYI: let f (`Foo (x : int)) = 0 let g (`Foo (x : float)) = 0 let h x = f x + g x;;
<mrvn> val h : [< `Foo of float & int ] -> int = <fun>
<mrvn> Rota: no. it takes a module.
<mrvn> and outputs a module
<Rota> You mean functor?
<mrvn> A module is a collection of types and values (which includes functions)
<Drup> mrvn: you need to learn to hide advanced and complicated feature to confused beginners.
<nicoo> mrvn: Why did you start talking about modules ?
<mrvn> Drup: that was for you. Not nk0 [~nk0@ks.nk0.fr] has quit [Ping timeout: 240 seconds]
<mrvn> 00:06 -!- nk0 [~nk0@ks.nk0.fr] has joined #ocaml
<mrvn> not Rota
<Rota> OK, I can follow.
<Drup> mrvn: I know this stuff, don't worry about me
<mrvn> nicoo: ups. I read "Functor" instead of "constructor"
<mrvn> Rota: ignore me. I'm tired.
<Rota> Thanks for your help, mrvn.
<Drup> Rota: yes, a constructor is pretty much like a function
<Drup> actually, it's even a requested feature that constructor should be exactly like regular functions
<mrvn> Rota: you can thing of a constructor as a kind of function. There is a branch of the ocaml compiler that makes them real functions. With currying and all that implies. So maybe one day soon they truely are functions.
<Drup> it's not the case in ocaml has it is, unfortunately.
<Drup> as*
<Rota> How I call the function h , in let f (`Foo (x : int)) = 0 let g (`Foo (x : float)) = 0 let h x = f x + g x;;
<Rota> both h(10) or h(10.0) not work
<Drup> that's normal
<mrvn> Rota: you can't. They type is unpopulated since nothing can be both int and float.
<Rota> OK. then how can I call f
<mrvn> f (`Foo 1)
<Rota> got it
<Drup> (stuff starting by a ` are special constructors that don't need a preliminary declaration)
<Drup> (they a re a bit more flexible than regular types, the cost being that it's easier to shoot yourself in the foot and that they tend to make type errors messages horrible)
<Drup> (mrvn's example usually counts as shooting yourself in the foot)
<Rota> Yes.
BiDOrD has joined #ocaml
<Drup> (it's usually considered as one of OCaml's advanced features)
<mrvn> Drup: shooting yourself in the foot?
<Rota> And why we cannot say: let f (x: Foo of int)=0? Do we need a separate type name for "Foo of int"?
<Drup> mrvn: you can easily define stuff that are not composable with polymorphic variants, while it's quite harder with regular variants
<mrvn> Rota: yes. Foo of int must be declared as type first.
<Drup> Rota: Foo or `Foo ?
<Rota> Foo
<Drup> then you need to declare a type with the constructor Foo
<mrvn> Rota: you can only do that with `Foo because of the magic behind `*
<Drup> "Foo of int" is not a type by itself
<mrvn> Rota: Sidenote: you would write: let f (Foo _) = 0
<mrvn> Rota: or type foo = Foo of int let f (x : foo) = 0
<Rota> _ is another confusing issure when I was reading OCaml books.
<Rota> s/issure/issue
<Drup> _ is "There should be something here, but I don't care about it"
<mrvn> Rota: _ simply says you don't care about it. Otherwise is it the same as "x"
<mrvn> Rota: like saying "void foo(int x, int)" in C++
<Rota> let f (Foo _) = 0 gave me an error of unbound constructor Foo.
<Rota> I need define Foo first right?
<Drup> yes
<Rota> ok
<Rota> type a=Foo of int ;; type b = Foo of float ;; let g(Foo _) =0;; In this case, Foo is somehow overriden?
<Drup> yes
<mrvn> shadowed
<Rota> OK. That means constructor is always globally inside a module?
<nicoo> Rota: What do you mean ?
tnguyen has joined #ocaml
<mrvn> Rota: type a = Foo of int let make_int x = Foo x type b = Foo of float let make_float x = Foo x let t = (make_int 1, make_float 2.);;
<mrvn> val t : a * b = (Foo 1, Foo 2.)
<mrvn> Rota: It's not realy global, it doesn't work retroactively.
maattdd_ has quit [Ping timeout: 250 seconds]
<mrvn> Rota: it's also quite confusing when you do redeclare constructors.
<Rota> nicoo: I mean the constructor can be shadowed by a same name constructor anywhere as long as they are in the same module.
maattdd_ has joined #ocaml
Topher has left #ocaml []
<mrvn> Rota: works across modules and for modules or values too
<nicoo> Rota: You can shadow either with a new type declaration or a (local?) open
bjkeller has quit []
watermind has joined #ocaml
yacks has quit [Ping timeout: 252 seconds]
yacks has joined #ocaml
<mrvn> n8
darkf has joined #ocaml
nikki93 has quit [Remote host closed the connection]
tobiasBora has quit [Quit: Konversation terminated!]
zpe_ has quit [Remote host closed the connection]
jonludlam has quit [Ping timeout: 252 seconds]
zpe has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
Muzer has quit [Ping timeout: 252 seconds]
madroach has quit [Ping timeout: 252 seconds]
madroach has joined #ocaml
zpe has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
NoNNaN has joined #ocaml
iorivur has joined #ocaml
claudiuc_ has joined #ocaml
claudiuc has quit [Ping timeout: 258 seconds]
zpe has quit [Ping timeout: 250 seconds]
nikki93 has joined #ocaml