Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
INTERCAL
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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"/>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
INTERCAL
(section)
Add topic