Skip to content

belongsTo doesn't seem to work #4

Closed

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.

Activity

  1. dlucanu commented on Feb 21, 2019

    @dlucanu
    Contributor

    You are right. The manual is updated now. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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