True

From the SETL Wiki

Jump to: navigation, search

true is the name of the predefined boolean constant that represents logical truth in SETL (like most high-level languages.)

Operations involving true include:

  • Use it as the condition in an if statement:
    if true then
      print('You should see this');
    else
      print('You should not see this');
    end;
    


  • Use it as the condition in an while statement:
    (while true)
      print('You should see this repeated infinitely');
    end while;
    
    (until true)
      print('You should not see this');
    end until;
    


  • Convert it to a string:
    str true
    

    Result: '#t'

  • Parse it from a string:
    unstr '#T'
    

    Result:true

  • Query its type:
    print(type true, is_boolean true, is_integer true, denotype '#t');
    

    Output:BOOLEAN #T #F BOOLEAN

  • Insert it into a set or map:
    s := {true};
    true in s;
    false in s;
    
    not_map := {[true, false], [false, true]};
    not_map(true);
    not_map(false);
    

    Results:
    #T
    #F

    #F
    #T

Personal tools