It's UWAweek 44 (2nd semester, 1st exam week)

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


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

Login to reply

👍?
helpful
8:39pm Mon 2nd Sep, Mark LN.

Hey,

Thought we could share interesting and weird ml code to test our work. Here is one I came up with:

mlcode

2 is printed

3 is printed afterwards

value <- 1

function increment value <- value + 1

Function call with parens right against the name

increment() print value

Empty lines ignored:

Function call with parens separated by a space

increment () print value


You can change it to test your expression checker as follows (this should print an error saying value2 is not defined or something like that):

```mlcode```
# 2 is printed
# 3 is printed afterwards
#
value <- 1
#
function increment
	value <- value2 + 1

# Function call with parens right against the name
increment()
print value

# Empty lines ignored:

# Function call with parens separated by a space
increment ()
print value

cheers,

Mark


SVG not supported

Login to reply

👍?
helpful
8:44pm Mon 2nd Sep, Mark LN.

Ok wow - the markdown is a bit different to what I am used to using. Lets try that again because there doesn't seem to be a way to edit my post:

Working code:

# 2 is printed
# 3 is printed afterwards
#
value <- 1
#
function increment
	value <- value + 1

# Function call with parens right against the name
increment()
print value

# Empty lines ignored:

# Function call with parens separated by a space
increment ()
print value

Should break due to missing value2 variable declaration:

# 2 is printed
# 3 is printed afterwards
#
value <- 1
#
function increment
	value <- value2 + 1

# Function call with parens right against the name
increment()
print value

# Empty lines ignored:

# Function call with parens separated by a space
increment ()
print value


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

Login to reply

👍?
helpful
8:43pm Wed 11th Sep, Joshua N.

"Mark Le Noury" [email protected] wrote:

Ok wow - the markdown is a bit different to what I am used to using. Lets try that again because there doesn't seem to be a way to edit my post:

Working code:

# 2 is printed
# 3 is printed afterwards
#
value <- 1
#
function increment
	value <- value + 1

# Function call with parens right against the name
increment()
print value

# Empty lines ignored:

# Function call with parens separated by a space
increment ()
print value

Should break due to missing value2 variable declaration:

# 2 is printed
# 3 is printed afterwards
#
value <- 1
#
function increment
	value <- value2 + 1

# Function call with parens right against the name
increment()
print value

# Empty lines ignored:

# Function call with parens separated by a space
increment ()
print value

Note there are no empty lines in ml, "empty lines" start with a #.

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