From 653a76220b9eeecffa192449296da939bdc6991b Mon Sep 17 00:00:00 2001 From: mark1626 Date: Sun, 19 Nov 2023 19:28:17 +0530 Subject: [PATCH] add: guile, penrose-notation, bookmarks --- README.md | 2 +- bookmarks/blog.rec | 6 ++++ bookmarks/category.rec | 4 +++ bookmarks/fp.rec | 5 +++ bookmarks/tex.rec | 5 +++ index.md | 2 +- languages/guile/guile.md | 7 ++++ languages/guile/guile_assoc_list.md | 20 +++++++++++ languages/guile/guile_cli_app.md | 16 +++++++++ languages/guile/guile_macros.md | 42 +++++++++++++++++++++++ languages/languages.md | 1 + math/linear-algebra/graphical-notation.md | 22 ++++++++++++ math/math.md | 1 + 13 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 bookmarks/category.rec create mode 100644 bookmarks/tex.rec create mode 100644 languages/guile/guile.md create mode 100644 languages/guile/guile_assoc_list.md create mode 100644 languages/guile/guile_cli_app.md create mode 100644 languages/guile/guile_macros.md create mode 100644 math/linear-algebra/graphical-notation.md diff --git a/README.md b/README.md index 2174e61..15bd363 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ This repo is a collection of tidbits of things I learn See the site live [here](https://mark1626.github.io/knowledge/) -This repo currently contains #441 articles +This repo currently contains #445 articles diff --git a/bookmarks/blog.rec b/bookmarks/blog.rec index 6b07822..8f9f980 100644 --- a/bookmarks/blog.rec +++ b/bookmarks/blog.rec @@ -255,3 +255,9 @@ Url: http://erikdemaine.org/ Description: Origami 3D and figurine Tags: origami Tags: blog + +Url: https://ralphammer.com/a-quick-beginners-guide-to-drawing/ +Description: Art and drawing +Tags: art +Tags: drawing + diff --git a/bookmarks/category.rec b/bookmarks/category.rec new file mode 100644 index 0000000..591def6 --- /dev/null +++ b/bookmarks/category.rec @@ -0,0 +1,4 @@ +Url: https://www.mathstat.dal.ca/~selinger/papers.html +Description: Selinger Papers +Tags: papers + diff --git a/bookmarks/fp.rec b/bookmarks/fp.rec index 1354321..4bd61d2 100644 --- a/bookmarks/fp.rec +++ b/bookmarks/fp.rec @@ -24,3 +24,8 @@ Description: Programming Language Foundations in Agda Tags: adga Tags: haskell +Url: https://www.lisperati.com/casting.html +Description: Casting Spels in Lisp +Tags: lisp +Tags: macros + diff --git a/bookmarks/tex.rec b/bookmarks/tex.rec new file mode 100644 index 0000000..7a42c80 --- /dev/null +++ b/bookmarks/tex.rec @@ -0,0 +1,5 @@ +Url: https://tikz.dev/gd-usage-tikz +Description: TikZ tutorial +Tags: latex +Tags: tikz + diff --git a/index.md b/index.md index a5f0b36..996a363 100644 --- a/index.md +++ b/index.md @@ -7,7 +7,7 @@ --- - ## Contents - There are #441 articles + There are #445 articles --- - ## Categories diff --git a/languages/guile/guile.md b/languages/guile/guile.md new file mode 100644 index 0000000..2c55484 --- /dev/null +++ b/languages/guile/guile.md @@ -0,0 +1,7 @@ +# Guile + +[Back](../languages.md) + +- [Guile Assoc List](./guile_assoc_list.md) +- [Guile CLI Application](./guile_cli_app.md) +- [Guile Macros](./guile_macros.md) diff --git a/languages/guile/guile_assoc_list.md b/languages/guile/guile_assoc_list.md new file mode 100644 index 0000000..aae0116 --- /dev/null +++ b/languages/guile/guile_assoc_list.md @@ -0,0 +1,20 @@ +- +- ```scm + (define object-locations '( + (whiskey-bottle . living-room) + (bucket . living-room) + (chain . garden) + (frog . garden) + (test . player) + )) + ``` +- > Note: Associative list created using quote are immutable +- ## Modifying assoc-lists +- ```scm + (assoc-set! object-location* object 'player) + ``` +- +- ## Reading +- https://www.gnu.org/software/guile/manual/html_node/Association-Lists.html + logseq.order-list-type:: number +- \ No newline at end of file diff --git a/languages/guile/guile_cli_app.md b/languages/guile/guile_cli_app.md new file mode 100644 index 0000000..f198d71 --- /dev/null +++ b/languages/guile/guile_cli_app.md @@ -0,0 +1,16 @@ +- ```scm + #!/usr/bin/env guile -s + !# + + (use-modules (ice-9 regex)) + (use-modules (ice-9 format)) + + (define (main) + (let ((args (program-arguments))) + (if (< (length args) 2) + (begin (display (format #f "Usage: ~s [args]\n" (car args))) + (newline) + (exit))))) + ; Call the main function + (main) + ``` \ No newline at end of file diff --git a/languages/guile/guile_macros.md b/languages/guile/guile_macros.md new file mode 100644 index 0000000..10d22c4 --- /dev/null +++ b/languages/guile/guile_macros.md @@ -0,0 +1,42 @@ +# Guile Macros +- +- ## Examples +- **A simple expansion** +- ```scm + ; Macro + ; Usage (walk west) + ; Expanded to (walk-direction west) + (define-syntax walk + (syntax-rules () + ((walk direction) + (walk-direction 'direction)))) + + ``` +- **A more complex expansion that create a new procedure** +- ```scm + (define-syntax game-action + (syntax-rules () + ((game-action command subj obj place ...) + (define command (lambda (subject object) + (cond ((and (eq? *location* 'place) + (eq? 'subject 'subj) + (eq? 'object 'obj) + (have 'subj)) + ...) + (#t '(i cant command like that.)))))))) + + (game-action weld chain bucket attic + (cond ((and (have 'bucket) (set! *chain-welded* #t)) + '(the chain is now securely welded to the bucket.)) + (#t '(you do not have a bucket.)))) + + (game-action dunk bucket well garden + (cond (*chain-welded (set! *bucket-filled* #t) '(the bucket is full of water.) + (#t '(the water level is too low to reach.))))) + + ; Creates two new actions into the game + ``` +- ## Further Reading +- https://www.gnu.org/software/guile/manual/html_node/Macros.html + logseq.order-list-type:: number +- \ No newline at end of file diff --git a/languages/languages.md b/languages/languages.md index 05297b8..98d3e6c 100644 --- a/languages/languages.md +++ b/languages/languages.md @@ -15,6 +15,7 @@ 9. [Typescript](./typescript/typescript.md) 10. [Java](./java/java.md) 11. [JS](./js/js.md) +11. [Guile](./guile/guile.md) ## HPC diff --git a/math/linear-algebra/graphical-notation.md b/math/linear-algebra/graphical-notation.md new file mode 100644 index 0000000..50aa5c8 --- /dev/null +++ b/math/linear-algebra/graphical-notation.md @@ -0,0 +1,22 @@ +# Tensor Networks + +[Back](../../index.md) + +Tensor Networks (Penrose diagrams) are visual diagrams to represent Tensor operations. The idea behind using a visual representations is that you can study and optimize these networks. These networks are also perhaps with some minor differences, **string diagrams. **String diagrams have been used in category theory to prove things (Curry Howard correspondence). Also formal proofs can be used to generalize optimizations + **(Linear Algebra/Differential Equations) - Tensors - Category Theory - Formal Proofs - Optimizations** + +## Reading + +- https://www.microsoft.com/en-us/research/publication/using-tensor-diagrams-to-represent-and-solve-geometric-problems/?from=https://research.microsoft.com/apps/pubs/default.aspx?id=79791&type=exact +- https://en.wikipedia.org/wiki/Tensor_network +- https://www.math3ma.com/blog/matrices-as-tensor-network-diagrams +- https://www.tensors.net/tutorial-4 + +## Papers + +- Fong, Brendan and David I. Spivak. “Seven Sketches in Compositionality: An Invitation to Applied Category Theory.” *arXiv: Category Theory* (2018): n. pag. +- Bradley, Tai-Danae. “What is Applied Category Theory?” (2018). +- https://iopscience.iop.org/article/10.1088/1751-8121/aa6dc3 +- https://www.mathstat.dal.ca/~selinger/papers.html#graphical +- Selinger, Peter. “A Survey of Graphical Languages for Monoidal Categories.” *arXiv: Category Theory* (2009): 289-355. +- https://www.cs.ox.ac.uk/people/bob.coecke/Selby.pdf diff --git a/math/math.md b/math/math.md index 3bb63b6..e29c5a1 100644 --- a/math/math.md +++ b/math/math.md @@ -31,6 +31,7 @@ - [Normal Equations](./linear-algebra/normal-equations.md) - [Einstein Notation](./linear-algebra/einsum.md) +- [Penrose Notation](./linear-algebra/graphical-notation.md) ## Number Theory