It's UWAweek 37 (2nd semester, week 7)

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 7 articles in this topic
Showing 7 of 409 articles.
Currently 4 other people reading this forum.


 UWA week 34 (2nd semester, week 5) ↓
SVG not supported

Login to reply

👍?
helpful
1:46am Sun 25th Aug, Yuxuan Y.

Hi, Professor. I have some questions about project 1. Should we consider about nested function and higher-order function?

function create_multiplier factor
	function multiplier x
		return x * factor
	return multiplier

double <- create_multiplier(2)
print double(5)
function foo x
	function bar y
		print y
	print x

and should we handle the unexpected indent error like

[statement]
	[statement]
[statement]


SVG not supported

Login to reply

👍x1
helpful
5:04am Sun 25th Aug, Christopher M.

Hello, The project specification is not quite finished, yet, but ... "Yuxuan Yuan" <24*8*8*3@s*u*e*t*u*a*e*u*a*> wrote:
> Should we consider about nested function and higher-order function?
The language's syntax does not permit nested functions: [CITS2002] Functions are introduced with the 'function' keyword, which only appears at the program's global level, and not as a type of statement.
> and should we handle the unexpected indent error like > ``` > [statement] > [statement] > [statement] > ```
Whitespace is insignificant, everywhere, except for when a single tab shows that a statement belongs to a function body. So the above is OK.


 UWA week 35 (2nd semester, week 6) ↓
SVG not supported

Login to reply

👍x1
helpful
4:22am Mon 26th Aug, Christopher M.

"Yuxuan Yuan" <24*8*8*3@s*u*e*t*u*a*e*u*a*> wrote:
> and should we handle the unexpected indent error like > ``` > [statement] > [statement] > [statement] > ```
Very sorry, but I'm going to reverse my decision on this point (to make it easier for all to implement): All statements and function prototypes (1st line) must begin at the left-hand-margin (column 1). The statements forming a function's body must be indented with a single tab-character. So, your above example should be flagged as having an invalid/unrecognised middle line. Please reply if this is unclear!


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

Login to reply

👍?
helpful
1:22am Thu 5th Sep, ANONYMOUS

Hi, Does this mean whitespace is only significant when it is at the beginning of a line but still insignificant anywhere else (except when 1 whitespace minimum is necessary)? Therefore, any line beginning with a whitespace would cause an error (including before a tab character), but additional whitespace throughout a line is fine. Or does this mean all additional whitespaces should be a cause for error? Thank you for clarifying!


SVG not supported

Login to reply

👍?
helpful
9:22pm Thu 5th Sep, Joshua N.

ANONYMOUS wrote:
> Hi, > > Does this mean whitespace is only significant when it is at the beginning of a line but still insignificant anywhere else (except when 1 whitespace minimum is necessary)? Therefore, any line beginning with a whitespace would cause an error (including before a tab character), but additional whitespace throughout a line is fine. > > Or does this mean all additional whitespaces should be a cause for error? > > Thank you for clarifying!
Hi question is answered here: [help2002]


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

Login to reply

👍?
helpful
6:45pm Wed 11th Sep, ANONYMOUS

I apologise for repeatedly asking, but I still need a more specific clarification regarding this case. The line 'Whitespace can only appear at the beginning of a line if it is a tab under a function definition' is said to be true but whitespace and tab are not the same, so it is a bit confusing to me. Assuming that line only means the tab character '\t', I am under the impression that any line beginning with whitespace would cause an error, please let me know if I am misunderstanding.


SVG not supported

Login to reply

👍?
helpful
10:43pm Thu 12th Sep, Joshua N.

ANONYMOUS wrote:
> I apologise for repeatedly asking, but I still need a more specific clarification regarding this case. The line 'Whitespace can only appear at the beginning of a line if it is a tab under a function definition' is said to be true but whitespace and tab are not the same, so it is a bit confusing to me. Assuming that line only means the tab character '\t', I am under the impression that any line beginning with whitespace would cause an error, please let me know if I am misunderstanding.
Tabs are a form of white space. More detail given here: [help2002]

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