<olle>
if a function returns a record, and always the same record, is it pure? even if rec1 == rec2 is not true? for physical identity.
<d_bot>
<darrenldl> wouldn't purity of a function be defined by its behaviour rather than where and how the runtime decides to store the returned result?
<olle>
I don't know!
<d_bot>
<darrenldl> i mean i can also make an non-pure function that returns exactly same record, and even also rec1 == rec2
<olle>
Wikipedia has this condition: "Its return value is the same for the same arguments"
<olle>
But how to compare the return value?
<olle>
d_bot: true
<olle>
heh
<olle>
talking to a bot
<d_bot>
<darrenldl> you missed the second condition: "Its evaluation has no side effects (no mutation of local static variables, non-local variables, mutable reference arguments or I/O streams)."
<olle>
yes
<olle>
so, no new memory allocation?
<d_bot>
<darrenldl> "same" in the sense of `=` usually suffices in discussion (data equality is enough)
<olle>
yeah
<d_bot>
<darrenldl> > so, no new memory allocation?
<d_bot>
<darrenldl> @olle#0000 well no - anything you do would lead to memory allocation strictly speaking, so if we consider memory allocation as part of the side effect to be taken into account, then nothing we do would be pure
<d_bot>
<darrenldl> if the returned values are non-pure functions, then i'm not fully certain how to go about defining equality of the values
<d_bot>
<darrenldl> well i think i'd argue that if we include the environment as a context, and encode the side effecting procedures as pure functions with a context parameter, then you can still define equality (so we argue based on the extracted state transition graphs essentially)
<d_bot>
<darrenldl> okay, re your snippet specifically: i think the more conservative choice is preferred here, as otherwise you'll need to conclude exactly if an arbitrary procedure could possibly return two different procedures (which implies solving the halting problem)
<d_bot>
<darrenldl> ~~okay, re your snippet specifically: i think the more conservative choice is preferred here, as otherwise you'll need to conclude exactly if an arbitrary procedure could possibly return two different procedures (which implies solving the halting problem)~~ wait hang on, i might be reading this way wrong (edited)
<zozozo>
here you have to distinguish the definition of purity (which in HO languages need to define an equality predicate on functions, which intuitively would be extensional equality), from its decidability
<def>
and even when one does not care about decidability, there are dozen of ways to define equality, depending on the properties you care about.
dborisog has joined #ocaml
<d_bot>
<Christophe> @BigOof (I don't think that people on IRC side can see when you edit your message)
<zozozo>
well actually, on irc it reposts the new version of the message
<zozozo>
which is a bit noisy unfortunately
sarna has joined #ocaml
<d_bot>
<darrenldl> > @darrenldl (I don't think that people on IRC side can see when you edit your message)
<d_bot>
<darrenldl> @Christophe oop, thanks for letting me know
<d_bot>
<darrenldl> @ irc peeps: sorries
<d_bot>
<Christophe> ah, noisy indeed, though at least you can see the updated information
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
dhil has joined #ocaml
<d_bot>
<mseri> Finally, the [OCaml 2020 Workshop](https://www.youtube.com/watch?v=E8T_4zqWmq8&list=PLKO_ZowsIOu5fHjRj0ua7_QWE_L789K_f) is live, please join us in the zoom meeting via clowdr or feel free to ask questions here. We will try to forward it to the presenters and record their answers, which are later will be posted as Q&A.
<d_bot>
<mseri> Finally, the [OCaml 2020 Workshop](https://www.youtube.com/channel/UCjrxSvgZDrku8s7eeZ-L9Tg) is live, please join us in the zoom meeting via clowdr or feel free to ask questions here. We will try to forward it to the presenters and record their answers, which are later will be posted as Q&A.
<d_bot>
<mseri> Finally, the [OCaml 2020 Workshop](https://www.youtube.com/watch?v=E8T_4zqWmq8&list=PLKO_ZowsIOu5fHjRj0ua7_QWE_L789K_f) is live, please join us in the zoom meeting via clowdr or feel free to ask questions here. We will try to forward it to the presenters and record their answers, which are later will be posted as Q&A.
<d_bot>
<mseri> and I am posting via discord, sorry π
<reynir>
discord people, every time you edit your messages we get a new message over here
<olle>
zozozo: extension equality of closures?
<olle>
extensional*
* olle
no editing needed ^^
<d_bot>
<mseri> now I know, sorry for the noise
<reynir>
Can it be put in /topic on discord regarding edits?
<d_bot>
<Et7f3> ?
<alehander92>
in #nim i think
<alehander92>
we receive only context of the edit, not the whole edited message
<alehander92>
which might be a good solution
<alehander92>
e.g. stuff like `<Rika> (edit) 'non-var,' => 'non-var data,'` it works well imho
<olle>
booo
<olle>
should be vim syntax, s/non-var/non-var data
nullcone has quit [Quit: Connection closed for inactivity]
osa1 has quit [Quit: osa1]
osa1 has joined #ocaml
pigeonv has quit [Quit: WeeChat 2.3]
<d_bot>
<Et7f3> /g after ?
osa1 has quit [Ping timeout: 256 seconds]
<d_bot>
<mseri> would'n that edit the whole history?
<olle>
no, `%` is used to apply to all rowsw
<olle>
rows*
<olle>
/g is for "all occurencies", implied "on the line"
<olle>
I think
<alehander92>
haha maybe
reynir has quit [Ping timeout: 256 seconds]
reynir has joined #ocaml
mfp has joined #ocaml
mbuf has joined #ocaml
osa1 has joined #ocaml
dborisog has quit [Ping timeout: 258 seconds]
<zozozo>
olle: basically two functions f and g of type a -> b are equal iff for all x:a f x = g x (hence, b can be a function type, which would unfold the same definition)
<zozozo>
of course, as def poitned out, you still need a definition of equality for the "base" (or rather non-functional) types, and there may be many choices
<zozozo>
*pointed
<zozozo>
(e.g. for maps you likely do not want the structural equality but the more intuitive notion of equality that is defined by the equal function in that module)
<olle>
yeah
<olle>
pretty complex in the end
<zozozo>
well, equality is complicated
<olle>
yeah
<olle>
Another definition that disregards equality: "
<olle>
A pure function is one whose output is completely deterministic given its input, and which has no side effects.
<Armael>
nah, "deterministic" relies on a notion of equality
<olle>
ah shit, you're right
<d_bot>
<Christophe> I got convinced to try ocaml-lsp π (not yet vscode, but almost)
osa1 has quit [Quit: osa1]
dhil has quit [Ping timeout: 258 seconds]
dhil has joined #ocaml
<olle>
I wonder how Haskell reasons about purity :d
<olle>
hm
<olle>
well, if everything is pure, then no problem, I guess (unless there's the IO monad implied)
<d_bot>
<Et7f3> I would say for equality: function that return record can be seen as group of function that return each one field/data and if they are pure their product is also. so physical equality is strange when we talk about purity</2cts>
<olle>
hm
<olle>
"It should be noted that an equality operator like (===) above breaks referential transparency, so adding it to Haskell would ruin many of the nice properties that Haskell has and would make many program transformations invalid. "
<laokz>
TryOCaml hang at 'Preparing the environment' on Debian testing Firefox 68.11.0esr. what shall i check?
kanishka has joined #ocaml
<kanishka>
Has anybody done a comparison of reasonml syntax versus scalajs syntax, to see which ones non-FP people find easier to adjust to?
malc_ has left #ocaml ["ERC (IRC client for Emacs 28.0.50)"]
Anarchos has quit [Quit: Vision[0.10.3]: i've been blurred!]
kanishka has quit [Quit: Quit]
kanishka has joined #ocaml
kanishka has quit [Client Quit]
osa1 has quit [Ping timeout: 246 seconds]
laokz has quit [Quit: Leaving]
narimiran has quit [Ping timeout: 246 seconds]
borne has quit [Ping timeout: 260 seconds]
Tuplanolla has joined #ocaml
borne has joined #ocaml
<olle>
sounds subjective
Haudegen has quit [Quit: Bin weg.]
jnavila has joined #ocaml
Hail_Spacecake has quit [Remote host closed the connection]
Hail_Spacecake has joined #ocaml
olle has quit [Ping timeout: 258 seconds]
borne has quit [Ping timeout: 240 seconds]
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
vicfred has joined #ocaml
mbuf has quit [Quit: Leaving]
<d_bot>
<Bluddy> reasonml now has 2 syntaxes: rescript and reason. so it's a more complicated comparison
<zozozo>
(note for irc/weechat users here: I have found a nice script to correctly translate the discord bot messages so that they appear as if coming from regular users, if anyone is interested)
<d_bot>
<octachron> It is more than ReScript has 3 syntaxes, and one of them is a (fixed ?) version of the reasonml syntax.
<zozozo>
though I had to make a few changes to the python script (because I didn't want or need the "network" part of the script)
<companion_cube>
I should probably learn how to script weechat :s
<zozozo>
well, it's easier when you have an already working script and just have to modify it a bit
<zozozo>
although to my regret it meant I had to write a few lines of python, :p
<companion_cube>
well there's a rust API π
<zozozo>
haha, I removed a line and a few characters on some other line, doesn't really justify that much work
<companion_cube>
well please share it ;)
<zozozo>
will try (the simpler solution would probably be cloning the github repo I guess)
<companion_cube>
I mena if you made a patch, why not share the patch? :p
<d_bot>
<Bluddy> do you guys want to post the finished script to a gist or something?
<companion_cube>
that'd be swell
<d_bot>
<Bluddy> I can pin it here, and even if IRC can't see it, we can copy paste if anyone needs it
<d_bot>
<Bluddy> I'll also link it on ocamlverse
muskan has joined #ocaml
<zozozo>
companion_cube: well, my "patch" simply removes code for one functionality of the script (used when there is a bot or bots that bridge multiple other apps, such as discord and slack, in order to add the source in the rewrittent message, but in my case, it was just annoying since it was required)
<companion_cube>
oh ok
<zozozo>
so it can't really be submitted upstream in that case
<d_bot>
<Et7f3> @zozozo: gist are git repo so they can be updated automatically but for 2 files it also to present correctly(like readme+code)
<companion_cube>
hmmm
<companion_cube>
how do you test/debug that?!
<d_bot>
<companion_cube> test
<companion_cube>
ahh it works, nice.
<zozozo>
@Et7f3 : interesting to known, ^^
<zozozo>
companion_cube: yeah, the testing part is a bit complicated, I've been waiting for discord messages and fixing the errors all afternnon (with long pauses when there were no messages, :p )
<companion_cube>
:s
<d_bot>
<Et7f3> hey ping work through the bridge \:)
<zozozo>
@Et7f3: yeah, but irc users have to 1) type the whole nick by hand since auto-completion does not work, and 2) remember to add an '@' because else discord does not highlight the msg
<d_bot>
<Et7f3> ha you need space
<zozozo>
XD
<zozozo>
I think irc users will not remember all the rule to amke succesful pings of discord users
<zozozo>
+s
<companion_cube>
ah, it doesn't tab complete :/
<companion_cube>
oh well
<companion_cube>
at least it's more readable
aaaaaa has quit [Quit: leaving]
tane has joined #ocaml
Serpent7776 has quit [Read error: Connection reset by peer]
Serpent7776 has joined #ocaml
webshinra has joined #ocaml
tane has quit [Quit: Leaving]
Simerax has joined #ocaml
tane has joined #ocaml
gypsydave5 has joined #ocaml
tane has quit [Client Quit]
tane has joined #ocaml
<gypsydave5>
I'm having some trouble installing ppx_string over opam - can anyone help me?