-
-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What should if (maybe)
do?
#235
Comments
it would do it either probably or half |
I'd recommend that
|
As far as I know, there's some sort of "probabilistic boolean algebra", but I can't recall how it is named. IIRC, |
maybe should roll a coin(pick 0 or 1) and do the operation at a 50% chance.
and i think that "maybe" was a const const const variable made by some user |
The compiler will implement quantum superposition in the manner described: #271 |
On machines where quantum superpositions can't be used, the compiler should instead do some parts of both branches. For example like this:
Which lines get selected could be up to runtime randomness, as long as 50% of lines of each branch get executed. Another option would be to introduce definitely (or short def) as a response to maybe.
|
The obvious behaviour for
To never call. This is the expected behaviour as demonstrated by user Carly R Jepson. |
I'd guess a || b would be 1 - (1-a)*(1-b) |
It seems that DreamBerd is using ternary logic, and I think the third value usually simply represents that the value is unknown, not specifying any particular probability. I guess one way to approach this, if only variable assignments were involved, would be to apply any assignments that were consistent between both branches, and set any variables that were assigned differently between branches to be undefined. e.g. given
x would be set to 1 and y would be set to undefined. This would be complicated to implement, though, and would only work for variable assignment, not output, so I don't think it's really practical. I think Snapstromegon's second suggestion, of adding a third clause to the if statement is probably more practical. I'd possibly rename it, though. Perhaps: |
Again, there's a formal specification for that "fuzzy boolean", I just can't remember the name, and I fail to cite from memory. |
Fuzzy memory?
…On Thu, 16 Nov 2023, 06:21 Steffen Ohrendorf, ***@***.***> wrote:
Again, there's a formal specification for that "fuzzy boolean", I just
can't remember the name, and I fail to cite from memory.
—
Reply to this email directly, view it on GitHub
<#235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA46MLPBHRUM6X6KQL2753LYEU55HAVCNFSM6AAAAAAZ6GGUYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGM2TIMRRHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
It's actually called Fuzzy Logic :/ |
No, I meant, you "fail(ed) to cite from [your] (fuzzy) memory".
…On Thu, 16 Nov 2023, 13:24 Steffen Ohrendorf, ***@***.***> wrote:
It's actually called Fuzzy Logic
<https://en.wikipedia.org/wiki/Fuzzy_logic> :/
—
Reply to this email directly, view it on GitHub
<#235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA46MLJALCUFS44RUZQLYJ3YEWPRVAVCNFSM6AAAAAAZ6GGUYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTHAYDSNZTHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
OK. I was just going by what was written in your comment. You mentioned "multiplication of probabilities". Assuming we're working with probabilities, a && b would be a * b for independent variables. Under the same conditions, a || b would be 1 - (1-a)*(1-b), I think. |
It feels like the section on
maybe
could really use an example of what trying to doif (maybe) ...
does.I see two possible possibilities:
true
andfalse
The text was updated successfully, but these errors were encountered: