Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
INTERCAL
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Operators === There are only five operators in INTERCAL-72. Implementations vary in which characters represent which operation, and many accept more than one character, so more than one possibility is given for many of the operators. {| class="wikitable" |+ INTERCAL operators<ref name="clc"/><ref name="manual72"/><ref name="manualick"/> |- ! Operator ! INTERCAL-72 characters ! C-INTERCAL characters ! CLC-INTERCAL characters |- | INTERLEAVE / MINGLE | <code>c</code> [[backspace]] <code>/</code> | <code>Β’</code>, <code>$</code>, <code>c</code> backspace <code>/</code> | <code>Β’</code> |- | SELECT || <code>~</code> || <code>~</code> || <code>~</code> |- | AND || <code>&</code> || <code>&</code> || <code>&</code> |- | OR || <code>V</code> || <code>V</code> || <code>V</code> |- | XOR | <code>V</code> backspace <code>-</code> | <code>V</code> backspace <code>-</code>, <code>?</code>, <code>β</code> | <code>V</code> backspace <code>-</code>, <code>Β₯</code> |} Contrary to most other languages, AND, OR, and XOR are [[Unary operation|unary]] operators, which work on consecutive bits of their argument; the [[most significant bit]] of the result is the operator applied to the least significant and most significant bits of the input, the second-most-significant bit of the result is the operator applied to the most and second-most significant bits, the third-most-significant bit of the result is the operator applied to the second-most and third-most bits, and so on. The operator is placed between the punctuation mark specifying a variable name or constant and the number that specifies which variable it is, or just inside grouping marks (i.e. one character later than it would be in programming languages like [[C (programming language)|C]].) SELECT and INTERLEAVE (which is also known as MINGLE) are infix binary operators; SELECT takes the bits of its first operand that correspond to "1" bits of its second operand and removes the bits that correspond to "0" bits, shifting towards the least significant bit and padding with zeroes (so 51 (1'''1'''0'''0'''1'''1''' in binary) SELECT 21 (10101 in binary) is 5 ('''101''' in binary)); MINGLE alternates bits from its first and second operands (in such a way that the least significant bit of its second operand is the least significant bit of the result). There is no operator precedence; grouping marks must be used to disambiguate the precedence where it would otherwise be ambiguous (the grouping marks available are <code>'</code> ("spark"), which matches another spark, and <code>"</code> ("rabbit ears"), which matches another rabbit ears; the programmer is responsible for using these in such a way that they make the expression unambiguous).<ref name="manual72"/>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)