lokien_ has quit [Quit: Connection closed for inactivity]
Emmanuel` has quit [Quit: Konversation terminated!]
Emmanuel` has joined #ocaml
dksong has joined #ocaml
mal`` has joined #ocaml
dksong has quit [Ping timeout: 272 seconds]
nicooo has joined #ocaml
nicoo has quit [Ping timeout: 248 seconds]
hanshenrik has quit [Ping timeout: 256 seconds]
hanshenrik has joined #ocaml
jeffmo has quit [Quit: jeffmo]
Emmanuel` has quit [Quit: Konversation terminated!]
FreeBirdLjj has joined #ocaml
exm has joined #ocaml
<Algebr`>
Drup: Using Lwt_io.lines_of_file and it sometimes throws an exception of End_of_file and sometimes doesn't even though the file is unchanged. Not sure how to debug this
seangrove has quit [Ping timeout: 272 seconds]
igoroliveira has quit [Quit: Connection closed for inactivity]
ygrek has quit [Ping timeout: 256 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<Algebr`>
ah, nvm, found it, didn't realize that End_of_file is raised for more than just readling from files but in general terms of reading.
struk|desk|away is now known as struk|desk
shinnya has quit [Ping timeout: 276 seconds]
luzie has joined #ocaml
struk|desk has quit [Remote host closed the connection]
dksong has joined #ocaml
hanshenrik_ has joined #ocaml
dksong has quit [Ping timeout: 265 seconds]
hanshenrik has quit [Ping timeout: 252 seconds]
chris2 has quit [Ping timeout: 240 seconds]
chris2 has joined #ocaml
kushal has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hanshenrik__ has joined #ocaml
aantron has joined #ocaml
hanshenrik_ has quit [Ping timeout: 276 seconds]
_whitelogger_ has quit [Remote host closed the connection]
<elfring>
def`: Do you perform any special checks for unbounded recursion even if a programming language like OCaml provides good support for tail calls?
Sim_n is now known as Simn
<orbifx>
2
<orbifx>
Kakadu: are you about?
<companion_cube>
mstevens: cool!
<mstevens>
companion_cube: I started trying to read Practical Ocaml, but I'm not finding it good
<elfring>
orbifx: Can the Unix library (alone) by OCaml be insufficient for your vehicle application? How do you think about the reuse of modules like Netmcore and Netcamlbox?
<mstevens>
companion_cube: but I've read some of RWO online and it looked promising enough to buy
<mstevens>
Also, I have a more general question, why *doesn't* steve yegge like ocaml?
<orbifx>
elfring: so far it's sufficient.
<orbifx>
mstevens: who is steve yegge?
octachron has joined #ocaml
<mstevens>
orbifx: he's a dude who wrote some interesting tech blogs a while ago
<orbifx>
companion_cube: it seems to be a philosophy and without being an expert in the field, I think I agree with the view that it's better to just fork.
Guest2299 is now known as kandu
<mstevens>
best I can find is a complaint that ocaml doesn't have a generic print function
lpaste has joined #ocaml
<elfring>
orbifx: Are there any special constraints for your selection of appropriate software libraries?
<companion_cube>
looks like a post that praises OCaml
<mstevens>
companion_cube: note the bit at the top "ocaml has some fairly fundamental problems..."
jyc has quit [Ping timeout: 264 seconds]
<orbifx>
elfring: yeah, get my work done :P
<mstevens>
and, on further googling, his entire complaint seems to be the inability to print arbitrary objects
martintrojer has joined #ocaml
<orbifx>
Kakadu: My call to a method is killing the program. I'm checking if it's some instation issue. I've not use Obj.magic before.
<companion_cube>
heh
rand__ has quit [Quit: leaving]
<companion_cube>
ppx_deriving.show to the rescue!
<companion_cube>
(it's so awesome for, say, tests!)
freehck has quit [Remote host closed the connection]
<Kakadu>
orbifx: Is your code based on my latest threads example?
<butts_butts>
All went smoothly enough. Went to install ocamlfind, just using opam install ocamlfind
<butts_butts>
And I get an error saying:
<butts_butts>
# Reason: dllunix.so: dynamic loading not supported on this platform.
<butts_butts>
Anyone know what I might be missing..?
rpip has joined #ocaml
<orbifx>
butts_butts: Linux :)
<butts_butts>
haa
<butts_butts>
Sure :P
<butts_butts>
But the whole process does work with the Cygwin OCaml build and all that right
<companion_cube>
sorry, I only have tried through: cygwin (which contains OCaml); then install opam from sources; then opam swich to 4.02.3
<orbifx>
butts_butts: I see the article says to use cygwin. Did you install the OCaml packages from cygwin?
Ankhers has joined #ocaml
<butts_butts>
Yup
<butts_butts>
Followed that article
luigy has joined #ocaml
jyc has quit [Ping timeout: 264 seconds]
<elfring>
companion_cube: Would you like to clarify safety checks around unbounded recursion because of special tail calls?
<orbifx>
butts_butts: cause I don't know how old that article is. I have mine installed and i used the packages that came with cygwin
<butts_butts>
Hmm
<butts_butts>
So you're able to install ocamlfind?
<orbifx>
I must have.. don't remember what I did now. I rarely use my winblows machine.
<orbifx>
based on your error
jyc has joined #ocaml
abbiya has quit [Quit: Leaving]
Snark has joined #ocaml
dhil has quit [Ping timeout: 244 seconds]
<orbifx>
... abort that thought. Looking into it.
<butts_butts>
ok :)
<Kakadu>
orbifx: can you check that main () is executed before your crash happens?
<companion_cube>
elfring: hu. unbounded recursion is useful for loops (servers, etc.) so what do you mean?
<butts_butts>
Huh, weirdly if I try to execute ocamlfind from cygwin, it seems to already be there.
strmpnk has joined #ocaml
stephe has joined #ocaml
<butts_butts>
Does the opam installer check for the existence of executables before installing?
<butts_butts>
Guess not
<elfring>
companion_cube: Does the OCaml compiler transform source code which contains unbounded recursion into an other control flow structure?
NhanH has joined #ocaml
<companion_cube>
if it's a tailcall, then yes
<orbifx>
butts_butts: yeah, it probably doesn't. And I said I'm pretty sure my setup is based on just cygwin. i don't have access to that machine.
Mandus has quit [Remote host closed the connection]
<orbifx>
Kakadu: my main function? pretty sure. But As I said I need to double check the instantiation. Maybe I missed something.
<elfring>
companion_cube: Where is this kind of source code transformation documented for tail calls?
dhil has joined #ocaml
Mandus has joined #ocaml
<companion_cube>
in the manual
<elfring>
orbifx: Is the discussed "main function" part of free software?
Leonidas_ is now known as Leonidas
caw has joined #ocaml
<orbifx>
the example one? It was referred yesterday on a link
octachron has quit [Ping timeout: 250 seconds]
S11001001 has joined #ocaml
<Kakadu>
maybe better name is 'initializer'
<elfring>
companion_cube: Which paragraph should I read again in the manual?
Guest23500 has quit [Quit: When two people dream the same dream, it's multicast dream routing.]
octachron has joined #ocaml
<elfring>
orbifx: Is the discussed vehicle application another evolving free software?
<companion_cube>
elfring: ask google for 'tail recursion'
<orbifx>
elfring: unfortunately no
seako has quit [Remote host closed the connection]
yminsky has quit [Remote host closed the connection]
stephe has quit [Remote host closed the connection]
caw has quit [Remote host closed the connection]
BitPuffin has joined #ocaml
lokien has joined #ocaml
dmbaturin has joined #ocaml
chenglou has joined #ocaml
<elfring>
companion_cube: Do you refer to the software optimisation possibility of "tail call elimination"?
sepp2k has joined #ocaml
ggherdov_ has joined #ocaml
kushal has quit [Quit: Leaving]
Janni has joined #ocaml
antkong_ has joined #ocaml
bacam has quit [Quit: leaving]
bacam has joined #ocaml
<Janni>
Hello. I'm an Ocaml newbie and I have a question concerning initial values in an class/object definition. I'm a bit unsure about how to initialise the values, because there are the values I have to assign anyway, there are initialisers, and I can use class parameters (is that the right name?).
Guest11111 has joined #ocaml
<dmbaturin>
Janni: If you are an ocaml newbie, you probably should not be using objects. :)
Kakadu has quit [*.net *.split]
t4nk597 has quit [*.net *.split]
<Janni>
So, I'm just wondering, are there guidelines like "never use class parameters for that!" or "use an initialiser if..." or "never use complex expressions for the predefined values"...
<dmbaturin>
They are a special case, for when OOP is really the best thing to do.
mattg has joined #ocaml
<def`>
what dmbaturin said, however prefer expressions over initializers
<ggole>
Janni: you can use let bindings just before the object ... end in order to do calculations prior to construction of the object, or use initializers which run after construction.
<companion_cube>
elfring: yes
foolishmonkey has joined #ocaml
<dmbaturin>
Janni: The default ways to enforce encapsulation in people's minds is abstract types (and closures), and the default way to generalize is parametric polymorphism and functors.
<Janni>
As a Haskeller I'm probably a bit too eager to use structural inheritance once again. :-)
lokien has quit [Remote host closed the connection]
<Drup>
Janni: well, you have structure inheritance without objects
<Drup>
with modules :3
<elfring>
companion_cube: I m still unsure if the OCaml compiler will "optimise" unbounded recursion away. How much does "tail call elimination" matter in such an use case?
<companion_cube>
please read the manual -_-
<companion_cube>
let rec foo () = ...... ; foo () will be converted into a while loop or something similar, that's it
<companion_cube>
it's not about unbounded recursion but tail recursion
<elfring>
companion_cube: Is it occasionally nicer to express such a while loop directly in a function implementation?
<companion_cube>
probably...?
* mstevens
read some more of RWO, looks very promising
hanshenrik_ has joined #ocaml
lokien_ has joined #ocaml
<elfring>
companion_cube: Is it just a coding style preference about using tail recursion or a while loop?
<octachron>
companion_cube, to be fair, the manual does not describe tail recursion at all :(
darkf_ has quit [Read error: Connection reset by peer]
darkf_ has joined #ocaml
hanshenrik__ has quit [Ping timeout: 244 seconds]
<octachron>
elfring, is it just a coding style preference to not just write down the right Turing machine for every program?
jeffmo has joined #ocaml
<def`>
\o/
kushal has joined #ocaml
darkf_ has quit [Quit: Leaving]
Guest11111 has quit [Ping timeout: 268 seconds]
<companion_cube>
are the slides from yesterday's OUPs online?
mj12` has quit [*.net *.split]
regnat has quit [*.net *.split]
Kakadu has joined #ocaml
antkong_ has quit [Ping timeout: 255 seconds]
mj12` has joined #ocaml
lopex has joined #ocaml
oskarth has joined #ocaml
jeroud has quit [Ping timeout: 268 seconds]
regnat has joined #ocaml
butts_butts has quit [Ping timeout: 268 seconds]
jeroud has joined #ocaml
stephe has joined #ocaml
copy` has joined #ocaml
dksong has joined #ocaml
emmanueloga has joined #ocaml
alpen- has quit [Ping timeout: 268 seconds]
copy` has quit [Read error: Connection reset by peer]
nuuit has joined #ocaml
copy` has joined #ocaml
alpen has joined #ocaml
strmpnk has quit [Read error: Connection reset by peer]
strmpnk has joined #ocaml
jwatzman2 is now known as jwatzman|work
jwatzman|work has joined #ocaml
jwatzman|work has quit [Changing host]
yminsky has joined #ocaml
caw has joined #ocaml
butts_butts has joined #ocaml
myst|fon has quit [Read error: Connection reset by peer]
myst|fon has joined #ocaml
seako has joined #ocaml
octachron has quit [Ping timeout: 250 seconds]
th5 has joined #ocaml
stephe has quit [K-Lined]
seako has quit [K-Lined]
caw has quit [K-Lined]
oskarth has quit [K-Lined]
Sorella has joined #ocaml
habnabit has quit [Ping timeout: 240 seconds]
MorTal1ty has joined #ocaml
stephe has joined #ocaml
Guest11111 has joined #ocaml
oldmanistan_ has quit [Ping timeout: 268 seconds]
oldmanistan_ has joined #ocaml
jeffmo has quit [Quit: jeffmo]
exm has left #ocaml [#ocaml]
tane has joined #ocaml
larhat has joined #ocaml
_habnabit has joined #ocaml
<Janni>
I'm not planning on asking these kinds of questions too often, but could someone give me an elegant translation of "any p xs" from Haskell? Laziness is not an issue here.
<flux>
yep. the type would be: ('a -> bool) -> 'a list -> bool
<Janni>
But I was looking for "bool list -> bool" which didn't yield anything useful.
<companion_cube>
grr, ocamlscope annoys me, it's so unmaintained
butts_butts has quit [Ping timeout: 268 seconds]
MercurialAlchemi has quit [Ping timeout: 240 seconds]
<flux>
elfring, often times you want to pass new data to the new round, and while cannot do that. to do that with while you would need to use references. but they are shun :)
oldmanistan_ has quit [Ping timeout: 268 seconds]
oldmanistan_ has joined #ocaml
FreeBird_ has joined #ocaml
Guest11111 has quit [Ping timeout: 268 seconds]
pierpa has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has quit [Ping timeout: 265 seconds]
jwatzman|work has quit [Read error: Connection reset by peer]
jwatzman|work has joined #ocaml
Riviera has quit [Quit: Reconnecting]
vpm has joined #ocaml
Riviera has joined #ocaml
butts_butts has joined #ocaml
S11001001 has quit [Read error: Connection reset by peer]
S11001001 has joined #ocaml
hanshenrik_ is now known as hanshenrik
larhat has quit [Quit: Leaving.]
nicooo has quit [Remote host closed the connection]
nicooo has joined #ocaml
dhil has quit [Ping timeout: 250 seconds]
Guest38 has joined #ocaml
hcarty has joined #ocaml
lokien has joined #ocaml
Anarchos has joined #ocaml
butts_butts has quit [Remote host closed the connection]
butts_butts has joined #ocaml
nicholasf has joined #ocaml
<lokien>
do we have any string size limit?
octachron has joined #ocaml
<flux>
we do, on 32-bit platforms it's only 16 megabytes. on 64-bit platforms.. it's a lot more
<flux>
Sys.max_string_length tells you the limit
<flux>
on my system it's 144115188075855863
<lokien>
that's in megabytes?
<yawnt>
mm
<yawnt>
why would merlin complain about unbound module X in Emacs
<yawnt>
if I have PKG X in my .merlin?
<hcarty>
lokien: It's in bytes
<hcarty>
yawnt: The package may not be installed. Or the findlib package name may not match the module name, depending on the library.
butts_butts_ has joined #ocaml
<yawnt>
hcarty: a restart fixed it
<yawnt>
weird
<lokien>
hcarty: so.. 134217728 GB? sweet!
butts_butts has quit [Ping timeout: 240 seconds]
<Janni>
Is there syntax for ad-hoc inheritance? That is if c and d are classes: let o = new c inherit d method f = ...
pierpa has quit [Read error: Connection reset by peer]
<Janni>
So that I can make instances of virtual classes with their own implementation of the methods?
pierpa has joined #ocaml
<lokien>
Janni: why do you want to do oop so badly, if you're a haskeller? :D
nicholasf has quit []
<Janni>
I'm working on a little pet project (a small game with different kinds of moving objects), and OOP just suggests itself. But I concede that I possibly should be using OCaml's module system instead...
<lokien>
I'd personally only use oop with gui stuff (buttons etc). you can program your game functionally (or imperatively)
MercurialAlchemi has joined #ocaml
<ggole>
Janni: close, let o = object inherit d method f = .. end
AlexRussia has quit [Quit: WeeChat 1.4-dev]
Guest11111 has joined #ocaml
slash^ has joined #ocaml
AlexRussia has joined #ocaml
<Janni>
ggole: Thanks!
seako has joined #ocaml
Guest43501 is now known as johnelse
caw has joined #ocaml
oskarth has joined #ocaml
aantron has joined #ocaml
<Janni>
How do I express in a signature: a type of object which inherits class c and d?
<lokien>
why can't I use snd with ~f label, with List.map function?
<Janni>
OK, I just discovered constraint clauses
<aantron>
lokien: are you using jane street core or the standard library?
<lokien>
aantron: core
<aantron>
what is your expression and what is the error message?
<ggole>
Janni: you can use inherit in type signatures
<Janni>
I think I asked that earlier already: What's the type of an objects that inherits classes c and d?
<hcarty>
lokien: You probably need to add a ~f label to the function. Core changes the signature of a lot of functions vs the stdlib
<hcarty>
lokien: Or swap the position of xs and the function
<lokien>
hcarty: oh, sure. it works now! I couldn't wrap my mind around these errors, thanks
<Janni>
I know that such a type expression must exist because if c's set of methods is {f} and d's set of methods is {g}, then I could write something like <f; g>, right?
<ggole>
There's no object type shortcut like that, only a class type shortcut
<seangrove>
Does merlin autocomplete work for things like let% ?
<Janni>
ggole: What would be the class type shortcut?
<Janni>
inherit ... inherit ...?
<ggole>
Yeah
<ggole>
So you might write in a signature class foo : object inherit foo end
lokien_ has quit [Quit: Connection closed for inactivity]
<Janni>
So, if I want to work with a list of type 'a objects that inherit from c and d, do I need to first declare "class e = object inherit c inherit d"?
<Drup>
seangrove: no
<seangrove>
Oh man, trying out https://github.com/mirage/ocaml-magic-mime - anything under the mirage banner is usually nerve-wrecking to try, and this hasn't been touched in a year
<seangrove>
Drup: And that's because it's camlp4?
<ggole>
You need a class (or a class type) if you want to refer to the type explicitly (which you might, because of the occasional need for coercions)
<Drup>
seangrove: it's not camlp4, it's ppx, so no
<Drup>
it's just because there is no real index of the %thingy available ..
<seangrove>
Drup: Ah, ok. I thought I read that merlin could handle ppx extensions automatically, and thought that would include everything
<seangrove>
Is there a name for the class of stuff it can't autocomplete?
<Drup>
well, ppx syntax extensions are ... not really in the language
<seangrove>
Heh, ok, so it can't handle any ppx syntax extensions?
<seangrove>
That's easy enough, just trying to get a rough approximation so I know when my setup is broken, and when to keep digging
<smondet>
seangrove: usually if the ppx creates functions after one compilation pass, if merlin sees the `.cmi` files, the generated code is available for completion
<Drup>
seangrove: I'm not sure what you are trying to say
oldmanistan_ has quit [Read error: Connection reset by peer]
msch has quit [Ping timeout: 240 seconds]
oskarth has quit [Read error: Connection reset by peer]
pootler_ has quit [Read error: Connection reset by peer]
sz0 has quit [Read error: Connection reset by peer]
al-maisan has quit [Ping timeout: 240 seconds]
boegel has quit [Remote host closed the connection]
mehdi_ has quit [Quit: No Ping reply in 180 seconds.]
alpen has quit [Ping timeout: 240 seconds]
rpip has quit [Ping timeout: 240 seconds]
cschneid_ has quit [Ping timeout: 240 seconds]
zozozo has quit [Ping timeout: 240 seconds]
Asmadeus has quit [Ping timeout: 240 seconds]
mietek_ has joined #ocaml
bitbckt has quit [Ping timeout: 240 seconds]
igitoor has quit [Ping timeout: 240 seconds]
edwin has quit [Ping timeout: 240 seconds]
dexterph has quit [Ping timeout: 240 seconds]
mehdi_ has joined #ocaml
boegel has joined #ocaml
msch has joined #ocaml
sigjuice has joined #ocaml
NhanH has joined #ocaml
Quintasan has left #ocaml [#ocaml]
l1x has joined #ocaml
pootler_ has joined #ocaml
cschneid_ has joined #ocaml
al-maisan has joined #ocaml
zozozo has joined #ocaml
edwin has joined #ocaml
sspi has joined #ocaml
bitbckt has joined #ocaml
igitoor has joined #ocaml
alpen has joined #ocaml
cojy has joined #ocaml
rpip has joined #ocaml
sz0 has joined #ocaml
oldmanistan_ has joined #ocaml
Asmadeus has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
oskarth has joined #ocaml
antkong has joined #ocaml
exm has joined #ocaml
shinnya has quit [Ping timeout: 250 seconds]
Guest11111 has quit [Ping timeout: 244 seconds]
<Kakadu>
I'm in strange doubts: can I call a C function `value asdf(value _,..................)` from another function with similiar signature?
<lokien>
can I include many let .. in .. bindings? let x y = 2 1 in .. ?
<aantron>
lokien: let x = 2 and y = 1 in ...
<aantron>
Kakadu: are you asking whether a C function can call another C function?
<lokien>
aantron: thanks :)
<aantron>
lokien: also let x, y = 2, 1 in ...
<aantron>
this is matching a tuple pattern against a tuple
<Kakadu>
aantron: I'm asking can CAMLlocalN and CAMLreturn in this function create some problems?
<Kakadu>
function*
<Kakadu>
functions*
<aantron>
ok, so you mean calling one entry point from another.. i dont readily know. perhaps someone else can say. in any case, you can move your implementation to a third function, or use https://github.com/ocamllabs/ocaml-ctypes
<jyc>
you can always write a tail recursive function and see if it stack overflows :)
<aantron>
i believe all variants of ML support tail call elimination as a basic feature
<aantron>
in fact the Quora answer says so
<aantron>
(for OCaml in particular)
demonimin has joined #ocaml
<zozozo>
small remark: functional languages without tail call optimization would be weird....
<companion_cube>
^
<lokien>
zozozo: *ekhem* clojure *ekhem*
alexst has joined #ocaml
<aantron>
=> clojure is weird :)
<Drup>
(And it's not guaranteed in rust ...)
<lokien>
is it bad that my tic tac toe game seems monolithic? it's only 86 lines so far :^(
<aantron>
"seems monolithic"?
<lokien>
code is tangled a bit :D
<zozozo>
lokien: ideally, the interface part should be separated from the logic part I'd say
<lokien>
zozozo: it's a cli game which I'm making to teach myself ocaml
<zozozo>
nice
<companion_cube>
rust isn't really functional
<elfring>
aantron: How do you think about the wording "In other languages like OCaml, the compiler gives you the same promise …" in the referenced article? Where should I find this "promise" for "proper tail calls" (or "tail call elimination") in the provided documentation explicitly?
julien_t has quit [Ping timeout: 250 seconds]
<mstevens>
companion_cube: I don't disagree, but it has some interesting functional-inspired aspects
<companion_cube>
agreed
<foolishmonkey>
lokien, did you implement AI?
<lokien>
foolishmonkey: it's a social game, you have to invite someone to your house to play it
<lokien>
:^)
<foolishmonkey>
lokien, :D
<foolishmonkey>
code a four in a row, it's a more interesting gme
<foolishmonkey>
and the code is more complex
<lokien>
foolishmonkey: I'll be doing cli battleships when I'm done with that
<foolishmonkey>
for battleships you need network or a safe way to prohibit cheating
<foolishmonkey>
that's not easy tasks
<lokien>
foolishmonkey: who said I'm a sane person
<foolishmonkey>
You chose your nick
madroach has quit [Quit: leaving]
lokien has left #ocaml ["Leaving"]
insane_person has joined #ocaml
<insane_person>
hello
mfp has quit [Remote host closed the connection]
ygrek has joined #ocaml
mfp has joined #ocaml
<insane_person>
foolishmonkey: I don't know how to translate loop/recur though :(
<insane_person>
I'm starting to write "game" function now, everything besides that works as it should
<insane_person>
I tried to match only i, board i, doing _ stuff, nothing works
<aantron>
elfring: i don't recall where in OCaml, let me take a look and see if i can find it
alexst has quit [Ping timeout: 250 seconds]
mietek_ is now known as mietek
hcarty has quit [Ping timeout: 250 seconds]
mietek has quit [Changing host]
mietek has joined #ocaml
mietek has joined #ocaml
antkong_ has quit [Client Quit]
Haudegen has joined #ocaml
kushal has joined #ocaml
cat5e has quit [Ping timeout: 244 seconds]
<aantron>
ive only been able to find implicit references, such as the option -annot refers to tail calls, and library functions such as those in List refer to tail recursion, which they wouldnt if the compiler wasn't performing the optimization
<pierpa>
the only way of writing long running programs would be by using 'while', if there were no proper tail calls
<aantron>
pierpa: the question is whether the manual explicitly promises that the compilers will perform it
<elfring>
aantron: Are there chances to make the support for this special technique any more explicit?
<pierpa>
the only way of writing turing-complete programs, actually
<pierpa>
yes, I understand :)
<aantron>
ok :)
<pierpa>
elfring, it's not a special technique. It's a normal one
<aantron>
elfring: i suppose someone could request to patch the docs. that the OCaml compilers do this optimization is currently part of the surrounding lore and culture of ML, perhaps it's such a basic assumption that it didnt occur to put it in an obvious place in the manual :)
<companion_cube>
it is in the manual, I think
<companion_cube>
everyone knows that OCaml performs TCE, in any c ase, and that it plays a central role
Haudegen has quit [Ping timeout: 265 seconds]
<pierpa>
on the other hand, I suppose the manual does not mention the runtime stack
<pierpa>
so, there's no reason to believe that something that is never mentioned will overflow
<mstevens>
for scheme, the language spec explicitly says thou must support efficient tail recursion
<aantron>
same for SML iirc
<pierpa>
yes, but ocaml has not a definition as formal as scheme and sml
<pierpa>
*does not have a ...
<insane_person>
guys? anybody? :(
<pierpa>
insane, I see some problems in your game function
<pierpa>
but I got distracted along the way :)
<insane_person>
pierpa: I see them too, but I can't fix em
exm has left #ocaml [#ocaml]
<pierpa>
first, matching on board is superfluous
<pierpa>
and on i, is weird
<pierpa>
I'd just use a couple of ifs
<insane_person>
hm, that's because I didn't know how to do x, o, x, o
<insane_person>
so I used i. and when it's odd, o moves, when it's even, x moves
<insane_person>
(or the other way, I don't really remember)
<pierpa>
you have a match on i wnd the only distinguishing is in when guards
<aantron>
"Exceptions: A function application followed by a function return is replaced by the compiler by a jump (tail-call optimization). In this case, no event is put after the function application."
<aantron>
i believe that strictly speaking this can be argued to apply only to ocamlc
<insane_person>
pierpa: do we have anything like "case"?
<insane_person>
or switch?
<mstevens>
insane_person: just as a learner this is all pretty interesting to read
<insane_person>
mstevens: we can talk about it when I'm done
<mstevens>
insane_person: personally I feel like you want some types
<pierpa>
insane_person: yes, match
<pierpa>
match i mod 2 with 0 -> even case | 1 -> odd case
<insane_person>
pierpa: so why doesn't it work?! :D
<insane_person>
mstevens: later :v
<pierpa>
does not work in which way
<insane_person>
pierpa: in a way I was doing it. now I'll try your match
<elfring>
Do any other technical writers care about to mention the discussed details at more "prominent" places in the documentation (than besides the debugger description)?
<aantron>
elfring: i think it should be mentioned prominently, since it's very important to using OCaml effectively
<pierpa>
your prompt function boils down to: while true do o_moves board; x_moves board done
<aantron>
not to mention properly understanding the meaning of "this function is tail-recursive" in the library docs, without a prior background in FP
<insane_person>
mstevens: eh, screw it, I need some types
djellemah_ has joined #ocaml
<pierpa>
the language reference is not a manual for learning CS, though
<aantron>
but nothing you learn in CS implies that OCaml does support tail recursion, or does not support it
<aantron>
tail call optimization*
<aantron>
though it does hint that it should, if OCaml is sane :)
<pierpa>
then someone will asks that the manual should explain floating point arithmetic
hcarty has joined #ocaml
<pierpa>
-s
mstevens has quit [Quit: leaving]
<aantron>
well if OCaml had a mysterious type "real" like SML does, it might be worth pointing out that it's a floating-point number
<aantron>
i dont think we are saying that the reference should explain what TCE is, just that OCaml does perform it
<pierpa>
ok, maybe a line somewhere whould be present :)
<pierpa>
*should
dhil has joined #ocaml
BitPuffin has quit [Read error: Connection reset by peer]
<pierpa>
and maybe there is, just we couldn't find it :)
<aantron>
pierpa: perhaps, but i did a case-insensitive grep for "tail" in the manual, and the statement in the debugger chapter is the most explicit reference i could find
<yawnt>
companion_cube: ping
Haudegen has joined #ocaml
alexst_ has joined #ocaml
<pierpa>
btw, does the manual explain that ocaml uses applicative order evaluation?
<aantron>
i.e. call-by-value?
<pierpa>
yes
<pierpa>
no, sorry
<pierpa>
eager evaluation
<pierpa>
in contrast to normal order, as in Haskell, for example
<aantron>
ah
<pierpa>
I don't thing this is mentioned anywhere in the manual :)
<pierpa>
*think
alexst has quit [Ping timeout: 248 seconds]
<aantron>
i couldnt find references with a brief search for call, value, applicative, or eager
<pierpa>
:)
_andre has quit [Quit: leaving]
<companion_cube>
yawnt: ?
Soni has joined #ocaml
<aantron>
there is a description of call-by-value here, http://caml.inria.fr/pub/docs/manual-ocaml/expr.html#sec120, but i havent seen any discussions for other constructs that would rule out normal order evaluation. i havent been thorough or done any non-trivial reasoning, however
<insane_person>
when they were saying ocaml is a "language for smart people", I thought they were exaggerating :(
<Drup>
I would rather say that it doesn't hide the complexity behind void*
<Drup>
But apparently, it's a point that is highly contentious :D
<insane_person>
see you in two years, when I'll write my first working program in it :D
<aantron>
the empty source file compiles to a working program :)
* insane_person
tries that
<insane_person>
second *
<pierpa>
lol
pflanze has joined #ocaml
<insane_person>
and how do I use all these types? this is madness!
<aantron>
i guess let also is described as eager. most likely if you read all the sections here http://caml.inria.fr/pub/docs/manual-ocaml/expr.html you can reason that ocaml uses applicative order evaluation pervasively. of course, it's not as easy to deal with as just a one-line claim somewhere in the manual
<yawnt>
companion_cube: uhm, dunno, i was having an issue with MyOCamlbuildBase being unbound
<pierpa>
Yes, agreed. Actually the function application section explains it. So I was wrong
<yawnt>
and google brought up something you said on IRC on the very same repo
<pierpa>
aantron ^
<yawnt>
but looks like I fixed it, no idea how :)
<pflanze>
Hello. Is there a way to specify source location information in OCaml source code? (like #line and #file in C and hopefully a column specification)
<hcarty>
pflanze: __LINE__ and several others
<pflanze>
(Or is there a better format to use when targetting Ocaml from a compiler? Currently not writing the compiler in Ocaml though.)
<insane_person>
do you write your .mli by hand? if I have something.inferred.mli and something.mli, which one compiler will use?
<yawnt>
anyone has experience with Cstubs and OASIS?
<yawnt>
the whole process looks.. daunting :P
<aantron>
something.mli, corresponding to something.ml
<aantron>
i write my .mlis by hand, but having the compiler infer it can be a starting point
<aantron>
but i usually want to constrain the .ml file so much that i dont want the inferred .mli anyway
<pflanze>
aantron, thanks!
<insane_person>
aantron: do I have to put every function in .mli file?
<aantron>
no, just ones you want to be able to use outside the module
<aantron>
in fact, thats one of the major reasons to use .mli in the first place
Janni_ has joined #ocaml
<Janni>
Hello.
<aantron>
hi
<insane_person>
aantron: what if I don't want to use them in other modules, but want my custom types?
<Janni>
I'm currently experimenting with OCaml's system. I've been getting the error "The instance variable self cannot be accessed from the definition of another instance variable" when using self#f() on the right hand side of a class value...
<Janni>
I suppose there's a good reason why this is not possible?
<aantron>
insane_person: not sure what you mean. you want to declare types somewhere? they can (and will have to be) declared in the .ml file. what do you want the .mli file for?
<aantron>
or you just want a separate module containing only types?
<insane_person>
aantron: so.. if I write type something = string, it'll affect all strings in my functions?
<aantron>
no, but what do you mean by "affect"?
<aantron>
if you write type something = string, you will just be able to use "something" as a fancy synonym for "string" in your types
<aantron>
unless you make something abstract using a signature, then code outside the module won't know that "soemthing" is a string
<aantron>
"know"
<insane_person>
hrm, previously I had a function of type string -> string. after I declare that type, it'll have type of something -> something?
<insane_person>
automatically?
<aantron>
no
<aantron>
you have to change it to something -> something
<insane_person>
how?
<aantron>
ah
<insane_person>
:D
<aantron>
you are not using type ascriptions
<aantron>
so yes it will have types string -> string, something -> something, something -> string, and string -> something, and so on for all synonyms of string
<aantron>
because at that point "something" is simply the same thing as "string"
<insane_person>
how can I change that function to have type of something -> something and not accept regular strings?
<aantron>
what exactly do you want it to accept?
darkf has joined #ocaml
<Janni>
Concrete example: In a class definition I'd like to say: val thread = return self#someLoop. So I'd like to store the thread objects of that class run as a value. So I can easily kill the thread from various points. I can work around the error, but it seems awkward.
<aantron>
if you want the strings to have been validated somehow, you could use a module with an abstract type, where "something" is known to be a "string" internally, but is opaque to the "outside world"
<aantron>
then the only way to construct the "something" will be to validate a string
<insane_person>
aantron: ugh >:C
<insane_person>
but thank you
<aantron>
but are you sure "something" should be a string?
<insane_person>
hm, maybe I'll explain it again, I think I wasn't clear enough earlier
zoobab has quit [Ping timeout: 248 seconds]
<insane_person>
I have a function, with type string -> string. I want to create custom type(type something = string), so that function will only accept strings of that type
<insane_person>
but not other strings
<insane_person>
function "regular string" would throw a type error
<aantron>
right, we understood each other. i believe an abstract type is how you do that
<aantron>
i am just asking whether you really need "something" to be a string in your implementation, because if not, you might not have to resort to abstract types to distinguish it from string
zoobab has joined #ocaml
<insane_person>
I.. have to print it later, so it has to be a string, I think
<aantron>
not if you can convert it to string.. after all, you can print ints that way
<aantron>
(for example)
<insane_person>
show me two approaches if you can
<aantron>
i need to know what "something" actually is supposed to represent, thats why im asking
<aantron>
Janni: i hope someone with more experience with the object system can help you.
<elfring>
Janni: Has a variable name like "thread" got a remarkable risk for further confusion around the desired clarification od affected implementation details?
<Janni>
My current solution: val multable thread = return () initializer thread <- someLoop() (*which uses #self*)
<insane_person>
aantron: field in a tic tac toe board
<Janni>
elfring: Hmm. This is not about the name of the variable. I named it differently in the actual code.
<aantron>
a location in a field? use int * int, or something like that, depending on your representation
<aantron>
a value in a field? a variant like Empty | X | O
<insane_person>
I'd have problems with accessing/extracting values then
<aantron>
how so?
<Janni>
elfring: It's a small simulation game, so it's a thread that implements the behaviour of a farm animal. Need more details? ;-)
<aantron>
you just need to be able to compute string location -> index
<aantron>
but if you want, you can also store a map of string location -> state
<aantron>
so you'd use a (string, value) Hashtbl.t
<aantron>
your locations would still be strings in this case, but at least we would have turned your state cells into a variant instead of strings
<aantron>
i guess thats not really different from List.assoc right now, except for the usage of the variant type "value"
Simn has quit [Quit: Leaving]
<insane_person>
aantron: sorry, my head had imploded
<aantron>
insane_person: why do you want different types for some functions anyway?
<elfring>
Janni: It will help to add some information incrementally. I guess that some software developers appreciate to talk about nice animals and farming occasionally. ;-)
<insane_person>
aantron: because some guy on irc said types would be nice.
<aantron>
types are (incredibly useful) tool but if you dont have a need to use them, don't. if you have a goal like "i want this function to accept only a set of certain 'valid' values", then you need types
<aantron>
i mean "i want to code this functon as if it only accepts..."
<aantron>
in practice, that kind of assumption is very useful, and you will want to use it all the time, so you will want to use types
<aantron>
but if you dont need it now for this program, dont use them now. people will say your program is bad, and indeed it is quite unidiomatic
<aantron>
but its much easier to learn how to use types in general and ocaml types in particular once you feel a strong need for them
<insane_person>
aantron: that program pasted on bpaste, or that one I'm trying to create with types?
<aantron>
i got the impression that you are trying to modify the pasted program to use types
<insane_person>
yeah
<aantron>
or i should say, to use types more appropriately
<insane_person>
but which one is unidiomatic and bad
<aantron>
the pasted one
<aantron>
im not saying its "bad", its definitely not idiomatic though
<aantron>
insane_person: are you familiar with enumeration types or variant types?
<insane_person>
aantron: yeah
<insane_person>
familiar = I know what they are
<aantron>
good, so when would you use such a thing?
<insane_person>
when.. I need it?
<aantron>
hehe, when is that?
<insane_person>
when I want my function to only accept some kinds of data, but refuse to take other data?
<insane_person>
or when I want to encapsulate data for safety
<insane_person>
no?
<aantron>
more like when you want the surrounding language to forbid calling your function, except with values from a certain small set of values
<aantron>
so thats why i am saying to replace your "-" "x" and "o" with a variant type
<aantron>
that would be "idiomatic" ocaml
<insane_person>
hm, right
<aantron>
if this type is called "value"
<aantron>
then you will need to write two functions, string -> value, and value -> string
<insane_person>
I had used python/clojure for too much
<insane_person>
aantron: how would they look like?
slash^ has quit [Read error: Connection reset by peer]
<insane_person>
something like | X -> "x" ?
<aantron>
the "implciit" reason the first function is needed is because ocaml is telling you "you need to validate arbitrary input"
<aantron>
yes
<insane_person>
oh, duh
<insane_person>
it's beautiful
<aantron>
and the reason the second function is needed is because ocaml sucks at converting variants to string, unless you use typeconv or some other library :)
<aantron>
but that ocaml forces you to write the first function is a very good thing
<aantron>
the first one will just be like "... = function | "x" -> X | "o" -> O | "-" -> Empty" (if you need that last case)
<aantron>
i gtg for an hour or so, but we can continue this discussion later if you want, if someone else doesnt jump in :)
<insane_person>
no "deriving show"? that's sad
<aantron>
yes, there is ppx_deriving
<insane_person>
kay, have fun. and thanks :)
<aantron>
its a library
<aantron>
enjoy
Soni is now known as cat5e
kushal has quit [Quit: Leaving]
Haudegen has quit [Ping timeout: 276 seconds]
danieli has joined #ocaml
danieli has quit [Changing host]
seangrove has quit [Ping timeout: 240 seconds]
MercurialAlchemi has quit [Ping timeout: 248 seconds]
ollehar has joined #ocaml
<Janni>
What's the best way to do something n times? Or replicate an element n times : int -> 'a -> ['a]
<companion_cube>
use an alternative stdlib, or write the function yourself (which is easy)
MercurialAlchemi has joined #ocaml
<icicled>
is there an option in utop to turn off the bar with the time, command #, and counter?
<companion_cube>
#utop_prompt_simple;;
<companion_cube>
or #utop_prompt_dummy;;
<companion_cube>
but the # will remain, as in the toplevel
<icicled>
thanks, that helps! it's a lot clearer now
<icicled>
the bar is distracting
<insane_person>
can the bar get even fancier?
<hcarty>
insane_person: utop gives you that power
<hcarty>
Use it wisely
<insane_person>
hcarty: I want fancier bar! with combo counter and explosions!
<insane_person>
seriously, I loved that in atom
Haudegen has joined #ocaml
djellemah_ has quit [Ping timeout: 240 seconds]
yomimono has joined #ocaml
<wirrbel>
I want to use a file in utop /ocaml
<wirrbel>
typically I used ##use "mymod.ml"
<wirrbel>
sorry, s/##/#
<wirrbel>
anyway, now I use another file in that module, myothermod.ml
<companion_cube>
I'm starting to grok the choice of your pseudo, insane_person ;)
<wirrbel>
which gives me an error "Error: Reference to undefined global `Myothermod`"
<insane_person>
companion_cube: it's in today's log
copy` has quit [Quit: Connection closed for inactivity]
<hcarty>
wirrbel: #mod_use "myothermode.ml";;
<wirrbel>
thank hcarty
<wirrbel>
now I can load it as a module, but now I get a type error although ocamlfind compiles it nicely
<wirrbel>
hmm
<wirrbel>
ah, got it
malc_ has quit [Quit: leaving]
elfring has quit [Quit: Konversation terminated!]
tane has quit [Ping timeout: 248 seconds]
yomimono has quit [Quit: Leaving]
copy` has joined #ocaml
raphaelss has joined #ocaml
<insane_person>
aantron: hey, shh
dhil has quit [Ping timeout: 240 seconds]
dexterph has joined #ocaml
nadirvardar has joined #ocaml
<aantron>
insane_person: hi
aantron has quit [Remote host closed the connection]
<companion_cube>
pfff, incremental contains half the dependencies on planet JST
MercurialAlchemi has quit [Ping timeout: 250 seconds]
<insane_person>
aand he's gone :(
Algebr has joined #ocaml
<icicled>
could someone please point out what I'm doing wrong in this curl example - it always times out w/o writing the email data I've specified: http://sprunge.us/cPhX
nadirvardar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<edwin>
you give it chunks of data each time
<edwin>
not the whole thing at once
<icicled>
ah I missed that
<edwin>
val set_readfunction : t -> (int -> string) -> unit (** [readfunction n] should return string of length at most [n], otherwise transfer will be aborted (as if with exception) *)
<edwin>
also n is the max size
<aantron>
insane_person: aand he's back
nadirvardar has joined #ocaml
<insane_person>
aantron: oh hai :D
<insane_person>
aantron: but I already forgot what I wanted to say to you :D
hanshenrik has quit [Ping timeout: 240 seconds]
<icicled>
edwin: thanks - I wish the ocamldoc was a bit clearer
<aantron>
alright, np :)
<edwin>
for C bindings it sometimes helps to consult the original C lib's docs (when there are any)
<icicled>
yea, I'm going to have to pay closer attention to that
<insane_person>
aantron: but you can talk to me, since I'm a dummy and like to learn
Guest12385 has quit [Quit: ZNC 1.6.2 - http://znc.in]
aantron has quit [Remote host closed the connection]
seangrove has joined #ocaml
pgiarrusso has quit [Quit: pgiarrusso]
<seangrove>
Hey all, it seems that there's no pure-ocaml implementation of bcrypt/scrypt (ocaml-safepass seems very nice on top of it) - I suppose this means that unikernel/jsoo use is out of the question?
<Drup>
At this point of the conversation, I want to point out that salting on the client is a stupid idea
<seangrove>
Drup: Heh, absolutely fair. I'm thinking of target envs for my blog post though
<seangrove>
e.g. nodejs, xen images, standard ocaml binary, etc.
<Drup>
(And afaik, no, that's why everyone uses cryptokit)
<Drup>
It's not an issue for unikernel, though
<seangrove>
Drup: Oh, how so?
<orbifx>
seangrove: have you checked if this function exists in an unlikely library?
<seangrove>
orbifx: I haven't, good question
<Drup>
seangrove: nocrypto works on xen
<orbifx>
I remember finding some crypto functions stashed away in an inconspicuous
<orbifx>
library
<Drup>
It's not incomspicuous, it's called "nocrypto" :D
<orbifx>
or sorry, are you looking for ocaml implementation?
<orbifx>
pure-ocaml, I see
<Drup>
seangrove: in general, you can cross compile C stuff to xen, but it needs a bit of effort, so it's not instantly available.
<Drup>
(like, there is zarith and zarith-xen ...)
<orbifx>
seangrove: Isn't a unikernel compiled on a different host machine?
<orbifx>
cause what I'm getting at, is that as Drup says, might be best to compile from an existing library. Writing security related code like this would require auditing, which I'm sure existing libraries have received in abundance.
<seangrove>
orbifx: Definitely - but it's a similar challenge to that of e.g. openssl
<orbifx>
similar challenge?
<orbifx>
in what context?
<seangrove>
Drup: Had no idea that cross compiling stuff was an option, will hold that in the back of my mind, thanks