[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>variables >"immutable"

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 26
Thread images: 11

File: 1475673459848.jpg (4KB, 145x130px) Image search: [Google]
1475673459848.jpg
4KB, 145x130px
>variables
>"immutable"
>>
File: 1465831684865.jpg (7KB, 300x294px) Image search: [Google]
1465831684865.jpg
7KB, 300x294px
>>56972807
>array index starts at 1
>>
File: twin turbo rotary.jpg (54KB, 500x400px) Image search: [Google]
twin turbo rotary.jpg
54KB, 500x400px
>mutables
>invarianle
>>
File: 1464367531966.jpg (1MB, 1280x1024px) Image search: [Google]
1464367531966.jpg
1MB, 1280x1024px
>an "array" of variables
>they're all the same type
>>
File: i-say-shark.jpg (77KB, 780x629px) Image search: [Google]
i-say-shark.jpg
77KB, 780x629px
>Jeeves! These variables don't seem to vary!
>Oh, I'm terribly sorry, sir. Those are constants. I'll bring it down to the workshop right away. I think we have some casts that will make them work as you want them to.
>>
>>56972871
Kek heres your (You)
>>
File: alonzo.jpg (13KB, 332x434px) Image search: [Google]
alonzo.jpg
13KB, 332x434px
>offsets instead of indices
>>
>string
>it's 1 char long
>>
>null-terminated string
>>
File: disgusted-face.jpg (66KB, 380x380px) Image search: [Google]
disgusted-face.jpg
66KB, 380x380px
>>56973059
>null existing
>>
File: disgust.jpg (46KB, 620x400px) Image search: [Google]
disgust.jpg
46KB, 620x400px
>conflating mutable cells with variables

f x = x + 1

x is a variable, it varies.
>>
>>56974131
What?

In an immutable language X = X + 1 would throw a parse error

In FX = X + 1, FX is not the same variable as X
>>
>>56972807
>>
File: wut.png (77KB, 620x183px) Image search: [Google]
wut.png
77KB, 620x183px
>>56974759
>>
File: 1474760430627.webm (9KB, 234x240px) Image search: [Google]
1474760430627.webm
9KB, 234x240px
>>56974774
It's not about the file size this time, check again.
>>
>>56974759
A - 10
V - 10
Thanks YIFY!
>>
>>56974727
That's a function definition.
f is a function, x is its parameter, x + 1 is its value.
>>
>>56975063
Yeah, but the function takes the (immutable) x as an argument, it doesn't return it changed.
>>
I'm just gonna repost that. Yikes.

>>56974727
Also this
>In an immutable language X = X + 1 would throw a parse error
is totally wrong. It's a perfectly valid definition in Haskell, modulo uppercase. It might even have a non-divergent value for some types.

data Peano = Z | S Peano
instance Num Peano where
Z + y = y
(S x) + y = S (x + y)
...


>>56975077
Yeah, no shit, but x is not a constant. It's variable.
ex1 = f 4
ex2 = f 5
Here x takes on the different values 4 and 5.

"Variable" does not mean "mutable cell."
>>
>>56975149
I think I'm just not cut out for this shit, anon, you're bending my mind.
>>
>>56975220
I'm just arguing semantics, really.

A mutable cell is a mutable cell. It's analogous to the registers in processors and RAM, and that's useful. Procedural programmers were calling them "variables" since before I was born. I can't very well change that. Same with the conflation of "functions" with procedures that produce values.

This overloading of terms won't go away because of the autism of an anon on some taiwanese wallpainting forum, but I reserve the right to object when someone says that variables aren't variables and functions aren't functions.
>>
>objects
>>
>recursive
>it's possible that it only runs once
>>
>>56975220
Immutable variables are variables that you get to define exactly once. After that, you can't give them a new value, or increment them, or anything like that.

The reason they're variables is because they can still have different values during different executions of the same program, or different calls to the same function.
>>
>>56972807
>an array of ints is not an array of Integers
>>
>>56972849
Thanks for reminding me I work with ColdFusion every day in 2016
Thread posts: 26
Thread images: 11


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.