From 5470893f684c59bc4c20ac51e15a8cbf4a739254 Mon Sep 17 00:00:00 2001 From: Sander Spies Date: Tue, 9 Jun 2020 13:15:24 +0200 Subject: [PATCH 1/4] Bitwise pseudomodule documentation. --- gitlab-pages/docs/reference/bitwise.md | 119 ++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 3 deletions(-) diff --git a/gitlab-pages/docs/reference/bitwise.md b/gitlab-pages/docs/reference/bitwise.md index 9d4df471a..3b3e76c8c 100644 --- a/gitlab-pages/docs/reference/bitwise.md +++ b/gitlab-pages/docs/reference/bitwise.md @@ -9,17 +9,42 @@ import Syntax from '@theme/Syntax'; import SyntaxTitle from '@theme/SyntaxTitle'; -function and : nat -> nat -> nat +function and : 'a -> nat -> nat -val and : nat -> nat -> nat +val and : 'a -> nat -> nat -let and: (nat, nat) => nat +let and: ('a, nat) => nat +`'a` can either be an `int` or `nat`. + A bitwise `and` operation. + + +```pascaligo +const zero: nat = Bitwise.and(2n, 1n) +``` + + + + +```cameligo +let zero: nat = Bitwise.and 2n 1n +``` + + + + +```reasonligo +let zero: nat = Bitwise.and(2n, 1n); +``` + + + + function or : nat -> nat -> nat @@ -32,6 +57,28 @@ let or: (nat, nat) => nat A bitwise `or` operation. + + +```pascaligo +const three: nat = Bitwise.or(2n, 1n) +``` + + + + +```cameligo +let three: nat = Bitwise.or 2n 1n +``` + + + + +```reasonligo +let three: nat = Bitwise.or(2n, 1n); +``` + + + function xor : nat -> nat -> nat @@ -44,6 +91,28 @@ let xor: (nat, nat) => nat A bitwise `xor` operation. + + +```pascaligo +const two: nat = Bitwise.xor(2n, 1n) +``` + + + + +```cameligo +let two: nat = Bitwise.xor 2n 1n +``` + + + + +```reasonligo +let two: nat = Bitwise.xor(2n, 1n); +``` + + + function shift_left : nat -> nat -> nat @@ -56,6 +125,28 @@ let shift_left: (nat, nat) => nat A bitwise shift left operation. + + +```pascaligo +const four: nat = Bitwise.shift_left(2n, 1n) +``` + + + + +```cameligo +let four: nat = Bitwise.shift_left 2n 1n +``` + + + + +```reasonligo +let four: nat = Bitwise.shift_left(2n, 1n); +``` + + + function shift_right : nat -> nat -> nat @@ -67,3 +158,25 @@ let shift_right: (nat, nat) => nat A bitwise shift right operation. + + + +```pascaligo +const one: nat = Bitwise.shift_right(2n, 1n) +``` + + + + +```cameligo +let one: nat = Bitwise.shift_right 2n 1n +``` + + + + +```reasonligo +let one: nat = Bitwise.shift_right(2n, 1n); +``` + + \ No newline at end of file From 816afdd1b80da29aae4fc71863abef07c4332a2e Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 9 Jun 2020 14:32:07 +0000 Subject: [PATCH 2/4] Apply 1 suggestion(s) to 1 file(s) --- gitlab-pages/docs/reference/bitwise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-pages/docs/reference/bitwise.md b/gitlab-pages/docs/reference/bitwise.md index 3b3e76c8c..8f564493c 100644 --- a/gitlab-pages/docs/reference/bitwise.md +++ b/gitlab-pages/docs/reference/bitwise.md @@ -94,7 +94,7 @@ A bitwise `xor` operation. ```pascaligo -const two: nat = Bitwise.xor(2n, 1n) +const three: nat = Bitwise.xor(2n, 1n) ``` From d810ccc9218660acc2cbb25cb4d41a8d93486c19 Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 9 Jun 2020 14:32:14 +0000 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) --- gitlab-pages/docs/reference/bitwise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-pages/docs/reference/bitwise.md b/gitlab-pages/docs/reference/bitwise.md index 8f564493c..3e4176cae 100644 --- a/gitlab-pages/docs/reference/bitwise.md +++ b/gitlab-pages/docs/reference/bitwise.md @@ -108,7 +108,7 @@ let two: nat = Bitwise.xor 2n 1n ```reasonligo -let two: nat = Bitwise.xor(2n, 1n); +let three: nat = Bitwise.xor(2n, 1n); ``` From 34d726c2f38864a49c297d05c1f9b4ccfa0e9283 Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 9 Jun 2020 14:32:17 +0000 Subject: [PATCH 4/4] Apply 1 suggestion(s) to 1 file(s) --- gitlab-pages/docs/reference/bitwise.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-pages/docs/reference/bitwise.md b/gitlab-pages/docs/reference/bitwise.md index 3e4176cae..7796e94c6 100644 --- a/gitlab-pages/docs/reference/bitwise.md +++ b/gitlab-pages/docs/reference/bitwise.md @@ -101,7 +101,7 @@ const three: nat = Bitwise.xor(2n, 1n) ```cameligo -let two: nat = Bitwise.xor 2n 1n +let three: nat = Bitwise.xor 2n 1n ```