Skip to content

belongsTo doesn't seem to work #4

Closed
@simi2525

Description

@simi2525

The example given in the seminar does not work as intended. It gives the following warring/error (I'm not sure since it still prints the final state) :

line 10:10 no viable alternative at input 'forallyin{1..6}if(ybelongsTo'

s1 = { 1 .. 5 }; s2 = { 2, 4, 6, 7 }; a = s1 U s2 ; b = s1 ^ s2; c = s1 \ s2; x = 0; forall y in s2 x = x + y; d = emptySet; forall y in { 1 .. 6 } if (y belongsTo s2) d = d U { y };

The correct way of doing this seems to have changed to using 'in':
if (y in s2) d = d U { y };

The language manual needs to be updated to reflect this change as well as any code examples used in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions