Skip to content
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

Constant definition #78

Open
ogerardin opened this issue Jul 26, 2016 · 5 comments
Open

Constant definition #78

ogerardin opened this issue Jul 26, 2016 · 5 comments

Comments

@ogerardin
Copy link

I think it's not correct to define a constant as a variable that can only be assigned once; that's the mechanism that most programming languages use to implement constants, but it's not a definition.
I would just define it as a symbolic name for a value.

@jethrolarson
Copy link
Collaborator

Constant is also the name of a type that is a monad. I don't know if that
should be mentioned on the doc though

On Tue, Jul 26, 2016, 2:06 AM Olivier Gérardin notifications@github.com
wrote:

I think it's not correct to define a constant as a variable that can only
be assigned once; that's the mechanism that most programming languages use
to implement constants, but it's not a definition.
I would just define it as a symbolic name for a value.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#78, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAB-4JnmIZ9lmKsfqGQh8MAVTYBxlHCeks5qZc4YgaJpZM4JU71-
.

@jethrolarson
Copy link
Collaborator

I guess the current definition is more of const than the concept. If we define it as a symbolic name for a value then what distinguishes it from a variable?

@ogerardin
Copy link
Author

The only difference is that a variable's value can change over time. But we know that in pure functional world there is no such thing as a variable anyway :)

@jethrolarson
Copy link
Collaborator

In a pure functional world variables are like math variables. If you say x
= 1 then later say it's 2 you're just being a ridiculous lier

On Thu, Jul 28, 2016, 12:25 AM Olivier Gérardin notifications@github.com
wrote:

The only difference is that a variable's value can change over time. But
we know that in pure functional world there is no such thing as a variable
anyway :)


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#78 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAB-4NXo-M7-ZZusQUalgMkTzUOjNwELks5qaFl3gaJpZM4JU71-
.

@stereobooster
Copy link

stereobooster commented Aug 5, 2017

That is, they can be replaced with the values that they represent without affecting the result.

true, but this will work if only n is known value:

const fact = n => n < 2 ? 1 : n * fact(n-1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants