It's UWAweek 50

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 4 articles in this topic
Showing 4 of 834 articles.
Currently 3 other people reading this forum.


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

👍?
helpful
4:56pm Fri 6th Sep, Joshua N.

ANONYMOUS wrote:
> Taking this into consideration from the ml language: > > 6. there will be at most 50 unique identifiers appearing in any program > > lets just say a variable within a function is introduced, and then is set out of scope when exiting the function. The variable technically does not exist, does this still count towards the 50? as in there needs to be a max 50 in total, or just 50 concurrently > > > function addwithb a > b <- 10 > return a * b > > #b no longer exists outside the function
Hi
>From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.


SVG not supported

Login to reply

👍?
helpful
4:56pm Fri 6th Sep, Joshua N.

Hi
>From my understanding, Chris said "appearing" so, you should only see at most 50 unique identifiers in a single ml file. So, in the case above b would count towards the total.


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
5:05pm Mon 9th Sep, Harrison L.

Hello,

This makes sense, but what if the variable is used again outside of the scope of the function?

function func a
	problem <- 3
	return a + problem
problem <- 5
print func(problem)

The above example would work with a result of 8, with problem being a variable inside and outside of the scope of func- in fact, even the following should work:

function func a
	problem <- 3
	return a + problem
print func(problem)

With a result of 3- as problem would be automatically instated as a variable with the value of 0:

variables do not need to be defined before being used in an expression, and are automatically initialised to the (real) value 0.0

So- am I correct in assuming that in both of the above scenarios, problem counts as 2 identifiers?


SVG not supported

Login to reply

👍?
helpful
9:16pm Thu 12th Sep, Joshua N.

"Harrison Lisle" [email protected] wrote:

Hello,

This makes sense, but what if the variable is used again outside of the scope of the function?

function func a
	problem <- 3
	return a + problem
problem <- 5
print func(problem)

The above example would work with a result of 8, with problem being a variable inside and outside of the scope of func- in fact, even the following should work:

function func a
	problem <- 3
	return a + problem
print func(problem)

With a result of 3- as problem would be automatically instated as a variable with the value of 0:

variables do not need to be defined before being used in an expression, and are automatically initialised to the (real) value 0.0

So- am I correct in assuming that in both of the above scenarios, problem counts as 2 identifiers?

I believe so, they would be two separate identifiers, but they would count towards "unique" identifiers since they have the same name.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy