-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
❗ [modify]: Better 'let' layout for demo.
- Loading branch information
Showing
16 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
let (x, y) = ⸨(⸨3⸩, ⸨3⸩)⸩; | ||
yss = ⸨[|0|(i, j) in (x, y)|]⸩ in dims yss | ||
yss = ⸨[|0|(i, j) in (x, y)|]⸩ in | ||
dims yss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
let xs = [[1, 4, 8], [3, 2, 17], [0, ⸨14⸩, 6]]; | ||
ys = [|nth2 i j xs|(i, j) in (3, 3)|] in ys ! ((3, 2)) | ||
ys = [|nth2 i j xs|(i, j) in (3, 3)|] in | ||
ys ! ((3, 2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let edgeDetect = [[⸨0⸩, ⸨1⸩, ⸨0⸩], [⸨1⸩, ⸨-4⸩, ⸨1⸩], [⸨0⸩, ⸨1⸩, ⸨0⸩]]; | ||
kernel = [|nth2 i j edgeDetect|(i, j) in (⸨3⸩, ⸨3⸩)|]; | ||
image' = [[⸨15⸩, ⸨13⸩, 6, 9, 16], [⸨12⸩, 5, 15, 4, 13], [14, 9, 20, 8, 1], [4, 10, 3, 7, 19], [3, 11, 15, 2, 9]]; | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in convolve image kernel extend | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in | ||
convolve image kernel extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let emboss = [[-2, -1, 0], [-1, ⸨1⸩, ⸨1⸩], [0, ⸨1⸩, ⸨2⸩]]; | ||
filter = [|nth2 i j emboss|(i, j) in (⸨3⸩, ⸨3⸩)|]; | ||
image' = [[⸨15⸩, ⸨13⸩, 6, 9, 16], [⸨12⸩, ⸨5⸩, 15, 4, 13], [14, 9, 20, 8, 1], [4, 10, 3, 7, 19], [3, 11, 15, 2, 9]]; | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in convolve image filter zero | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in | ||
convolve image filter zero |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
let gaussian = [[1, 4, 1], [4, ⸨16⸩, ⸨4⸩], [1, ⸨4⸩, ⸨1⸩]]; | ||
filter = [|nth2 i j gaussian|(i, j) in (⸨3⸩, ⸨3⸩)|]; | ||
image' = [[⸨15⸩, ⸨13⸩, 6, 9, 16], [⸨12⸩, ⸨5⸩, 15, 4, 13], [14, 9, 20, 8, 1], [4, 10, 3, 7, 19], [3, 11, 15, 2, 9]]; | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in convolve image filter zero | ||
image = [|nth2 i j image'|(i, j) in (5, 5)|] in | ||
convolve image filter zero |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
let e = ⸨{|"a" := 5, "a" ++ "b" := 6|}⸩; | ||
f = ⸨{|"ab" := 12|}⸩ in dict_difference e f | ||
f = ⸨{|"ab" := 12|}⸩ in | ||
dict_difference e f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
let d = {|"a" := 5, "a" ++ "b" := {fst : 6, | ||
snd : ⸨0⸩}|} in dict_get "a" d * dict_get "ab" d.snd | ||
snd : ⸨0⸩}|} in | ||
dict_get "a" d * dict_get "ab" d.snd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
dict_intersectionWith (let x = ⸨2⸩ in (fun n m = (n + m) * x)) {|"a" := 5, "b" := ⸨6⸩, "c" := ⸨3⸩|} {|"b" := ⸨-6⸩, "c" := ⸨7⸩|} | ||
dict_intersectionWith (let x = ⸨2⸩ in | ||
(fun n m = (n + m) * x)) {|"a" := 5, "b" := ⸨6⸩, "c" := ⸨3⸩|} {|"b" := ⸨-6⸩, "c" := ⸨7⸩|} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
let incHead = let x = ⸨3⸩ in (fun xs = head xs + x); | ||
let incHead = let x = ⸨3⸩ in | ||
(fun xs = head xs + x); | ||
d = {|"a" := [⸨5⸩, 6], "b" := [⸨9⸩, 10], "c" := [3, 4]|}; | ||
e = {|"c" := []|}; | ||
d' = dict_map incHead (dict_difference d e) in dict_get "a" d' + dict_get "b" d' | ||
d' = dict_map incHead (dict_difference d e) in | ||
dict_get "a" d' + dict_get "b" d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
let filter p [] = []; | ||
filter p (x : xs) = let ys = filter p xs in if p x then (x ⸨:⸩ ys) else ys in | ||
filter p (x : xs) = let ys = filter p xs in | ||
if p x then (x ⸨:⸩ ys) else ys in | ||
filter ((<) ⸨5⸩) [⸨8⸩, 4, 7, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters