June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
26
Task/Logical-operations/REXX/logical-operations-1.rexx
Normal file
26
Task/Logical-operations/REXX/logical-operations-1.rexx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*REXX program demonstrates some binary (also known as bit or logical) operations.*/
|
||||
x= 1 ; y= 0 /*set the initial values of X and Y. */
|
||||
@x= ' x '; @y= ' y ' /*define a couple of literals for HDRs.*/
|
||||
/* [↓] echo the X and Y values.*/
|
||||
call $ 'name', "value" /*display the header (title) line. */
|
||||
call $ 'x' , x /*display "x" and then the value of X.*/
|
||||
call $ 'y' , y /* " "y" " " " " " Y */
|
||||
/* [↓] negate the X; then the Y value.*/
|
||||
call $ 'name', "negated" /*some REXXes support the ¬ character*/
|
||||
call $ 'x' , \x /*display "x" and then the value of ¬X*/
|
||||
call $ 'y' , \y /* " "y" " " " " " ¬Y*/
|
||||
say
|
||||
say
|
||||
call $ @x, @y, 'AND'; do x=0 to 1; do y=0 to 1; call $ x, y, x & y; end; end
|
||||
call $ @x, @y, 'OR' ; do x=0 to 1; do y=0 to 1; call $ x, y, x | y; end; end
|
||||
call $ @x, @y, 'XOR'; do x=0 to 1; do y=0 to 1; call $ x, y, x && y; end; end
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
$: parse arg @.1, @.2, @.3, @.4; hdr= length(@.1) \== 1; if hdr then say
|
||||
do j=0 to hdr; _=
|
||||
do k=1 for arg(); _=_ center(@.k, 7)
|
||||
end /*k*/
|
||||
say _
|
||||
@.=copies('═', 7) /*define a new header separator line. */
|
||||
end /*j*/
|
||||
return
|
||||
29
Task/Logical-operations/REXX/logical-operations-2.rexx
Normal file
29
Task/Logical-operations/REXX/logical-operations-2.rexx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*REXX pgm demonstrates some binary (also known as bit or logical) extended operations.*/
|
||||
x= 1 ; y= 0 /*set the initial values of X and Y. */
|
||||
@x= ' x '; @y= ' y ' /*define a couple of literals for HDRs.*/
|
||||
/* [↓] echo the X and Y values.*/
|
||||
call $ 'name', "value" /*display the header (title) line. */
|
||||
call $ 'x' , x /*display "x" and then the value of X.*/
|
||||
call $ 'y' , y /* " "y" " " " " " Y */
|
||||
/* [↓] negate the X; then the Y value.*/
|
||||
call $ 'name', "negated" /*some REXXes support the ¬ character*/
|
||||
call $ 'x' , \x /*display "x" and then the value of ¬X*/
|
||||
call $ 'y' , \y /* " "y" " " " " " ¬Y*/
|
||||
say /*note: NXOR is also known as XNOR. */
|
||||
say /*all 16 bit operations could be shown.*/
|
||||
call $ @x, @y, 'AND' ; do x=0 to 1; do y=0 to 1; call $ x, y, x & y ; end; end
|
||||
call $ @x, @y, 'NAND'; do x=0 to 1; do y=0 to 1; call $ x, y, \(x & y); end; end
|
||||
call $ @x, @y, 'OR' ; do x=0 to 1; do y=0 to 1; call $ x, y, x | y ; end; end
|
||||
call $ @x, @y, 'NOR' ; do x=0 to 1; do y=0 to 1; call $ x, y, \(x | y); end; end
|
||||
call $ @x, @y, 'XOR' ; do x=0 to 1; do y=0 to 1; call $ x, y, x && y ; end; end
|
||||
call $ @x, @y, 'NXOR'; do x=0 to 1; do y=0 to 1; call $ x, y, \(x && y); end; end
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
$: parse arg @.1, @.2, @.3, @.4; hdr= length(@.1) \== 1; if hdr then say
|
||||
do j=0 to hdr; _=
|
||||
do k=1 for arg(); _=_ center(@.k, 7)
|
||||
end /*k*/
|
||||
say _
|
||||
@.= copies('═', 7) /*define a new separator (header) line.*/
|
||||
end /*j*/
|
||||
return
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/*REXX program demonstrates some binary (also known as bit or logical) operations.*/
|
||||
x=1; y=0; @v= 'value' /*set initial values of X & Y; literal.*/
|
||||
/* [↓] echo the X and Y values.*/
|
||||
call TT 'name', "value" /*display the header (title) line. */
|
||||
call TT 'x' , x /*display "x" and then the value of X.*/
|
||||
call TT 'y' , y /* " "y" " " " " " Y */
|
||||
/* [↓] negate the X; then the Y value.*/
|
||||
call TT 'name', "negated" /*some REXXes support the ¬ character*/
|
||||
call TT 'x' , \x /*display "x" and then the value of ¬X*/
|
||||
call TT 'y' , \y /* " "y" " " " " " ¬Y*/
|
||||
/*both DO loops use 0 and 1 for values.*/
|
||||
call TT @v, @v, 'AND'; do x=0 for 2; do y=0 for 2; call TT x, y, x & y; end /*y*/
|
||||
end /*x*/
|
||||
|
||||
call TT @v, @v, 'OR'; do x=0 for 2; do y=0 for 2; call TT x, y, x | y; end /*y*/
|
||||
end /*x*/
|
||||
|
||||
call TT @v, @v, 'XOR'; do x=0 for 2; do y=0 for 2; call TT x, y, x && y; end /*y*/
|
||||
end /*x*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
TT: parse arg @.1,@.2,@.3,@.4; hdr=length(@.1)\==1; if hdr then say; w=7
|
||||
do j=0 to hdr; _=; do k=1 for arg(); _=_ center(@.k,w); end /*k*/
|
||||
say _
|
||||
@.=copies('═', w) /*define the header separator line. */
|
||||
end /*j*/ /*W: is used for the width of a column*/
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue