MISC - nus-cs4215/x-slang-t1-xz-jj GitHub Wiki

The following are the predeclared names of MISC, in alphabetical order.

List of predeclared names

display

error

get_time

Infinity

is_boolean

is_function

is_number

is_string

is_None

NaN

parse_int

prompt

runtime

undefined

Predeclared Names

display


Please use the python print() function instead.

error


error(v,s)

Parameters

v : any : value of variable to be printed

s : str : message to be printed

error will raise a ValueError exception and terminate program execution

Returns

None

get_time


get_time()

Parameters

None

get_time returns the epoch time

Returns

float

Infinity


Not implemented

is_boolean


is_boolean(v)

Parameters

v : any : value to be checked

checks if a given value is boolean. Returns True or False

Returns

bool

is_function


is_function(v)

Parameters

v : any : value to be checked

checks if a given value is a function. Returns True or False

Returns

bool

is_number


is_number(v)

Parameters

v : any : value to be checked

checks if a given value is an int or float. Returns True or False

Returns

bool

is_string


is_string(v)

Parameters

v : any : value to be checked

checks if a given value is a string. Returns True or False

Returns

bool

is_None


is_None(v)

Parameters

v : any : value to be checked

checks if a given value is == None. Returns True or False

Returns

bool

NaN


Not applicable.

parse_int


parse_int(s, base)

Parameters

s : str : a number to be converted to base 10

base : int : the current base the number is in. Possible values are 2, 8, 10, 16

Converts a number expressed as a string to base 10.

Returns

int

prompt


Not implemented

runtime

Not implemented

stringify


stringify(v)

Parameters

v : list, dict : value to be stringify

Convert a list or dict into string. Follows JSON stringify style.

Returns

str

undefined


Not applicable.