From 0015e42a83365952a3cb12502b59babe448ff60f Mon Sep 17 00:00:00 2001 From: netpyoung Date: Sat, 3 Feb 2024 22:51:21 +0900 Subject: [PATCH] update: src/ --- src/Index.md | 6 +- src/SUMMARY.md | 3 + src/advanced/asdf.md | 1 + src/advanced/debug.md | 1 + src/advanced/error.md | 1 + src/advanced/gensym.md | 1 + src/advanced/macro.md | 1 + src/advanced/type-part2.md | 1 + src/basic/atom.md | 12 +++ src/basic/bind.md | 1 + src/basic/comment.md | 1 + src/basic/comparison.md | 1 + src/basic/condition.md | 1 + src/basic/cons.md | 62 +++++++++++++++ src/basic/expression.md | 1 + src/basic/file.md | 1 + src/basic/function.md | 1 + src/basic/lambda.md | 1 + src/basic/map.md | 1 + src/basic/package.md | 1 + src/basic/print.md | 19 +++++ src/basic/recursion.md | 1 + src/basic/return.md | 1 + src/basic/symbol.md | 1 + src/basic/type/array.md | 25 ++++++ src/basic/type/boolean.md | 1 + src/basic/type/char.md | 19 +++++ src/basic/type/hashtable.md | 1 + src/basic/type/number.md | 96 +++++++++++++++++++++++ src/basic/type/string.md | 19 +++++ src/basic/type/structure.md | 17 ++++ src/basic/type/type.md | 121 +++++++++++++++++++++++++++++ src/basic/type/vector.md | 1 + src/basic/values.md | 1 + src/clos/clos.md | 1 + src/darkside/format.md | 1 + src/darkside/loop.md | 1 + src/darkside/reader-macro.md | 1 + src/darkside/symbol-macro.md | 1 + src/library/quicklisp.md | 1 + src/museum/history.md | 1 + src/museum/people/john-mccarthy.md | 1 + src/museum/people/people.md | 1 + src/reference/reference.md | 1 + 44 files changed, 431 insertions(+), 1 deletion(-) create mode 100644 src/advanced/asdf.md create mode 100644 src/advanced/debug.md create mode 100644 src/advanced/error.md create mode 100644 src/advanced/gensym.md create mode 100644 src/advanced/macro.md create mode 100644 src/advanced/type-part2.md create mode 100644 src/basic/atom.md create mode 100644 src/basic/bind.md create mode 100644 src/basic/comment.md create mode 100644 src/basic/comparison.md create mode 100644 src/basic/condition.md create mode 100644 src/basic/cons.md create mode 100644 src/basic/expression.md create mode 100644 src/basic/file.md create mode 100644 src/basic/function.md create mode 100644 src/basic/lambda.md create mode 100644 src/basic/map.md create mode 100644 src/basic/package.md create mode 100644 src/basic/print.md create mode 100644 src/basic/recursion.md create mode 100644 src/basic/return.md create mode 100644 src/basic/symbol.md create mode 100644 src/basic/type/array.md create mode 100644 src/basic/type/boolean.md create mode 100644 src/basic/type/char.md create mode 100644 src/basic/type/hashtable.md create mode 100644 src/basic/type/number.md create mode 100644 src/basic/type/string.md create mode 100644 src/basic/type/structure.md create mode 100644 src/basic/type/type.md create mode 100644 src/basic/type/vector.md create mode 100644 src/basic/values.md create mode 100644 src/clos/clos.md create mode 100644 src/darkside/format.md create mode 100644 src/darkside/loop.md create mode 100644 src/darkside/reader-macro.md create mode 100644 src/darkside/symbol-macro.md create mode 100644 src/library/quicklisp.md create mode 100644 src/museum/history.md create mode 100644 src/museum/people/john-mccarthy.md create mode 100644 src/museum/people/people.md create mode 100644 src/reference/reference.md diff --git a/src/Index.md b/src/Index.md index de344f4..5cd01f3 100644 --- a/src/Index.md +++ b/src/Index.md @@ -1,3 +1,7 @@ # ๋“ค์–ด๊ฐ€๋ฉฐ -๐Ÿšง ์‚ฌ์ดํŠธ ๊ณต์‚ฌ์ค‘์ž…๋‹ˆ๋‹ค. \ No newline at end of file +๐Ÿšง ์‚ฌ์ดํŠธ ๊ณต์‚ฌ์ค‘์ž…๋‹ˆ๋‹ค. + +## Ref + +- [wiki: Common Lisp](https://en.wikipedia.org/wiki/Common_Lisp) \ No newline at end of file diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 588e052..dcbdfe4 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -5,6 +5,7 @@ # ๊ธฐ์ดˆ - [์•„ํ†ฐ](./basic/atom.md) +- [Cons](./basic/cons.md) - [ํ‘œํ˜„์‹](./basic/expression.md) - [์‹ฌ๋ณผ](./basic/symbol.md) - [์ฃผ์„](./basic/comment.md) @@ -18,12 +19,14 @@ - [๋ฐ์ดํ„ฐ ํƒ€์ž…](./basic/type/type.md) - [์ˆซ์ž](./basic/type/number.md) - [๋ถˆ๋ฆฌ์–ธ](./basic/type/boolean.md) + - [๋ฌธ์ž](./basic/type/char.md) - [๋ฌธ์ž์—ด](./basic/type/string.md) - [๋ฐฐ์—ด](./basic/type/array.md) - [๋ฒกํ„ฐ](./basic/type/vector.md) - [ํ•ด์‹œํ…Œ์ด๋ธ”](./basic/type/hashtable.md) - [๊ตฌ์กฐ์ฒด](./basic/type/structure.md) - [map](./basic/map.md) +- [print](./basic/print.md) - [ํŒŒ์ผ ์ž…์ถœ๋ ฅ](./basic/file.md) - [๋ฐ”์ธ๋“œ](./basic/bind.md) - [ํŒจํ‚ค์ง€](./basic/package.md) diff --git a/src/advanced/asdf.md b/src/advanced/asdf.md new file mode 100644 index 0000000..022d78b --- /dev/null +++ b/src/advanced/asdf.md @@ -0,0 +1 @@ +# asdf diff --git a/src/advanced/debug.md b/src/advanced/debug.md new file mode 100644 index 0000000..a4995fe --- /dev/null +++ b/src/advanced/debug.md @@ -0,0 +1 @@ +# ๋””๋ฒ„๊ทธ diff --git a/src/advanced/error.md b/src/advanced/error.md new file mode 100644 index 0000000..7b172af --- /dev/null +++ b/src/advanced/error.md @@ -0,0 +1 @@ +# ์—๋Ÿฌ diff --git a/src/advanced/gensym.md b/src/advanced/gensym.md new file mode 100644 index 0000000..1f3181f --- /dev/null +++ b/src/advanced/gensym.md @@ -0,0 +1 @@ +# gensym diff --git a/src/advanced/macro.md b/src/advanced/macro.md new file mode 100644 index 0000000..d6d8219 --- /dev/null +++ b/src/advanced/macro.md @@ -0,0 +1 @@ +# ๋งคํฌ๋กœ diff --git a/src/advanced/type-part2.md b/src/advanced/type-part2.md new file mode 100644 index 0000000..3256477 --- /dev/null +++ b/src/advanced/type-part2.md @@ -0,0 +1 @@ +# ํƒ€์ž… part2 diff --git a/src/basic/atom.md b/src/basic/atom.md new file mode 100644 index 0000000..1440bbc --- /dev/null +++ b/src/basic/atom.md @@ -0,0 +1,12 @@ +# ์•„ํ†ฐ + +``` lisp +(atom 1) +;;=> T + +(atom 'atom) +;;=> T + +(atom nil) +;;=> T +``` \ No newline at end of file diff --git a/src/basic/bind.md b/src/basic/bind.md new file mode 100644 index 0000000..025a44b --- /dev/null +++ b/src/basic/bind.md @@ -0,0 +1 @@ +# ๋ฐ”์ธ๋“œ diff --git a/src/basic/comment.md b/src/basic/comment.md new file mode 100644 index 0000000..57f2c9c --- /dev/null +++ b/src/basic/comment.md @@ -0,0 +1 @@ +# ์ฃผ์„ diff --git a/src/basic/comparison.md b/src/basic/comparison.md new file mode 100644 index 0000000..66dd8e2 --- /dev/null +++ b/src/basic/comparison.md @@ -0,0 +1 @@ +# ๋น„๊ต diff --git a/src/basic/condition.md b/src/basic/condition.md new file mode 100644 index 0000000..6585a1f --- /dev/null +++ b/src/basic/condition.md @@ -0,0 +1 @@ +# ์กฐ๊ฑด๋ฌธ diff --git a/src/basic/cons.md b/src/basic/cons.md new file mode 100644 index 0000000..1b085bf --- /dev/null +++ b/src/basic/cons.md @@ -0,0 +1,62 @@ +# Cons + +s-expression + +cons cell + +car cdr + +cons๊ฐ€ ์•„๋‹Œ ๊ฒƒ์€ ์•„ํ†ฐ + + +``` lisp +(atom (cons 1 2)) +;;=> NIL +``` + +``` lisp +(consp '()) +;;=> NIL + +(consp '(1)) +;;=> T + +(consp '(1 . 2)) +;;=> T + +(consp '(1 2)) +;;=> T +``` + +``` lisp +(type-of '()) +;;=> NULL +(typep '() 'atom) +;;=> T + +(type-of '(1)) +;;=> CONS + + +(typep '() 'cons) +;;=> NIL +(typep '() 'list) +;;=> T + +(typep '(1) 'cons) +;;=> T +(typep '(1) 'list) +;;=> T + +(typep '(1 . 2) 'cons) +;;=> T +(typep '(1 . 2) 'list) +;;=> T +``` + +## ์งš๊ณ  ๋„˜์–ด๊ฐ€๊ธฐ + +- `car` / `cdr` +- `first` / `rest` +- `cons` +- `consp \ No newline at end of file diff --git a/src/basic/expression.md b/src/basic/expression.md new file mode 100644 index 0000000..1336d10 --- /dev/null +++ b/src/basic/expression.md @@ -0,0 +1 @@ +# ํ‘œํ˜„์‹ diff --git a/src/basic/file.md b/src/basic/file.md new file mode 100644 index 0000000..32fc0b7 --- /dev/null +++ b/src/basic/file.md @@ -0,0 +1 @@ +# ํŒŒ์ผ ์ž…์ถœ๋ ฅ diff --git a/src/basic/function.md b/src/basic/function.md new file mode 100644 index 0000000..43ec88d --- /dev/null +++ b/src/basic/function.md @@ -0,0 +1 @@ +# ํ•จ์ˆ˜ diff --git a/src/basic/lambda.md b/src/basic/lambda.md new file mode 100644 index 0000000..9a5a192 --- /dev/null +++ b/src/basic/lambda.md @@ -0,0 +1 @@ +# ๋žŒ๋‹ค diff --git a/src/basic/map.md b/src/basic/map.md new file mode 100644 index 0000000..d4ab730 --- /dev/null +++ b/src/basic/map.md @@ -0,0 +1 @@ +# map diff --git a/src/basic/package.md b/src/basic/package.md new file mode 100644 index 0000000..ba45f76 --- /dev/null +++ b/src/basic/package.md @@ -0,0 +1 @@ +# ํŒจํ‚ค์ง€ diff --git a/src/basic/print.md b/src/basic/print.md new file mode 100644 index 0000000..4fbee7e --- /dev/null +++ b/src/basic/print.md @@ -0,0 +1,19 @@ +# print + + +``` lisp +(setq a '(1 2 3 4 5 6)) +;;=> (1 2 3 4 5 6) + +(dotimes (i 7) + (let ((*print-length* i)) + (format t "~&~D -- ~S~%" i a))) +;;>> 0 -- (...) +;;>> 1 -- (1 ...) +;;>> 2 -- (1 2 ...) +;;>> 3 -- (1 2 3 ...) +;;>> 4 -- (1 2 3 4 ...) +;;>> 5 -- (1 2 3 4 5 ...) +;;>> 6 -- (1 2 3 4 5 6) +;;=> NIL +``` \ No newline at end of file diff --git a/src/basic/recursion.md b/src/basic/recursion.md new file mode 100644 index 0000000..9f23173 --- /dev/null +++ b/src/basic/recursion.md @@ -0,0 +1 @@ +# ์žฌ๊ท€ diff --git a/src/basic/return.md b/src/basic/return.md new file mode 100644 index 0000000..bc7f48b --- /dev/null +++ b/src/basic/return.md @@ -0,0 +1 @@ +# return diff --git a/src/basic/symbol.md b/src/basic/symbol.md new file mode 100644 index 0000000..f5c52f6 --- /dev/null +++ b/src/basic/symbol.md @@ -0,0 +1 @@ +# ์‹ฌ๋ณผ diff --git a/src/basic/type/array.md b/src/basic/type/array.md new file mode 100644 index 0000000..d57ca1f --- /dev/null +++ b/src/basic/type/array.md @@ -0,0 +1,25 @@ +# ๋ฐฐ์—ด + + +``` lisp +(defparameter *array* (make-array '(2 4) :initial-element 0)) +;;=> *ARRAY* + +*array* +;; => #2A((0 0 0 0) (0 0 0 0)) + +(aref *array* 0 0) +;; => 0 + +(setf (aref *array* 0 0) 100) +;; => 100 + +*array* +;; => #2A((100 0 0 0) (0 0 0 0)) + +(setf (aref *array* 1 1) 100) +;; => 100 + +*array* +;; => #2A((100 0 0 0) (0 100 0 0)) +``` \ No newline at end of file diff --git a/src/basic/type/boolean.md b/src/basic/type/boolean.md new file mode 100644 index 0000000..037dc1c --- /dev/null +++ b/src/basic/type/boolean.md @@ -0,0 +1 @@ +# ๋ถˆ๋ฆฌ์–ธ diff --git a/src/basic/type/char.md b/src/basic/type/char.md new file mode 100644 index 0000000..50cb4c3 --- /dev/null +++ b/src/basic/type/char.md @@ -0,0 +1,19 @@ +# ๋ฌธ์ž + +CHAR= ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ +CHAR-EQUAL ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„ x + + +| Numeric Analog | Case-Sensitive | Case-Insensitive | +| -------------- | -------------- | ----------------- | +| = | CHAR= | CHAR-EQUAL | +| /= | CHAR/= | CHAR-NOT-EQUAL | +| < | CHAR< | CHAR-LESSP | +| > | CHAR> | CHAR-GREATERP | +| <= | CHAR<= | CHAR-NOT-GREATERP | +| >= | CHAR>= | CHAR-NOT-LESSP | + + +## Ref + +- [Practical Common Lisp - 10. Numbers, Characters, and Strings](https://gigamonkeys.com/book/numbers-characters-and-strings.html) diff --git a/src/basic/type/hashtable.md b/src/basic/type/hashtable.md new file mode 100644 index 0000000..8ec893c --- /dev/null +++ b/src/basic/type/hashtable.md @@ -0,0 +1 @@ +# ํ•ด์‹œํ…Œ์ด๋ธ” diff --git a/src/basic/type/number.md b/src/basic/type/number.md new file mode 100644 index 0000000..91b6500 --- /dev/null +++ b/src/basic/type/number.md @@ -0,0 +1,96 @@ +# ์ˆซ์ž + +Integers +Ratios ๋ถ„์ˆ˜ +Floating-Point Numbers +Complex Numbers + +integer + fixnum + bignum +ratio +ratio, rational, real, number, t + + + +float +#C(a b) +#\char + + +most-positive-fixnum +most-negative-fixnum + +| ์ง„๋ฒ• | | | +| ------ | --- | -------------------- | +| 2์ง„๋ฒ• | #b | `b`inary | +| 8์ง„๋ฒ• | #o | `o`ctal | +| 16์ง„๋ฒ• | #x | he`x`adecimal | +| N์ง„๋ฒ• | #Nr | ์—ฌ๊ธฐ์„œ N์€ ์ž„์˜์˜ ์ˆ˜ | + +| ๋ถ€๋™ ์†Œ์ˆ˜์  | | +| ----------- | -------------- | +| s | `s`hort-float | +| f | single-`f`loat | +| d | `d`ouble-float | +| l | `l`ong-float | + +## ๋ณต์†Œ์ˆ˜ + +`a + bi == (complex a b) == #C(a b)` + +``` lisp +(type-of #C(1 2)) +;;=> (COMPLEX (INTEGER 1 2)) + +(typep #C(1 2) 'complex) +;;=> T + +(complex 1 2) +;;=> #C(1 2) + +(* #C(1 2) #C(1 2)) +;;=> #C(-3 4) + +(complexp #C(1 2)) +;;=> T +``` + +1+ +1- +incf +decf +min +max +minusp / zerop / plusp +evenp / oddp + +LOG +EXP +EXPT +SIN/COS/TAN +ASIN/ACOS/ATAN +์Œ๊ณก์„  ํ•จ์ˆ˜: SINH, COSH, ๋ฐ TANH +ASINH, ACOSH, ๋ฐ ATANH. + + + +FLOOR +CEILING +TRUNCATE +ROUND +MOD +REM + + +isqrt, which returns the greatest integer less than or equal to the exact positive square root of natural. +gcd `G`reatest `C`ommon `D`enominator +lcm `L`east `C`ommon `M`ultiple. + + +## Ref + +- [The Common Lisp Cookbook โ€“ Numbers](https://lispcookbook.github.io/cl-cookbook/numbers.html) +- [Common Lisp the Language, 2nd Edition - 2.1. Numbers](https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node16.html#SECTION00610000000000000000) +- [Practical Common Lisp - 10. Numbers, Characters, and Strings](https://gigamonkeys.com/book/numbers-characters-and-strings.html) + diff --git a/src/basic/type/string.md b/src/basic/type/string.md new file mode 100644 index 0000000..46b1c3e --- /dev/null +++ b/src/basic/type/string.md @@ -0,0 +1,19 @@ +# ๋ฌธ์ž์—ด + + +| Numeric Analog | Case-Sensitive | Case-Insensitive | +| -------------- | -------------- | ------------------- | +| = | STRING= | STRING-EQUAL | +| /= | STRING/= | STRING-NOT-EQUAL | +| < | STRING< | STRING-LESSP | +| > | STRING> | STRING-GREATERP | +| <= | STRING<= | STRING-NOT-GREATERP | +| >= | STRING>= | STRING-NOT-LESSP | + + +:start1 +:end1 +:start2 +:end2 + +(string= "foobarbaz" "quuxbarfoo" :start1 3 :end1 6 :start2 4 :end2 7) diff --git a/src/basic/type/structure.md b/src/basic/type/structure.md new file mode 100644 index 0000000..99869ae --- /dev/null +++ b/src/basic/type/structure.md @@ -0,0 +1,17 @@ +# ๊ตฌ์กฐ์ฒด + + +``` lisp +(defstruct Hello + a + b) + +(make-Hello :a 1 :b 2) +``` + +;; :conc-name + +## ์งš๊ณ  ๋„˜์–ด๊ฐ€๊ธฐ + +- defstruct +- make-Blabla \ No newline at end of file diff --git a/src/basic/type/type.md b/src/basic/type/type.md new file mode 100644 index 0000000..f094594 --- /dev/null +++ b/src/basic/type/type.md @@ -0,0 +1,121 @@ +# ๋ฐ์ดํ„ฐ ํƒ€์ž… + +1 +1.1 +1234567890123456789012345678901234567890123456789012345678901234567890 +#C(1.2 3) ; 1.2 + 3i + + +| type-of | | +| ------------ | --- | +| cons | | +| null | | +| | | +| symbol | | +| condition | | +| function | | +| | | +| sequence | | +| array | | +| vector | | +| bit-vector | | +| hash-table | | +| stream | | +| | | +| integer | | +| float | | +| number | | +| short-float | | +| single-float | | +| double-float | | +| long-float | | +| complex | | +| ratio | | +| rational | | +| string | | +| character | | +| | | +| random-state | | +| | | +| package | | +| pathname | | +| readtable | | +| restart | | + + +array +atom +bignum +bit +bit-vector +chracter +[common] +compiled-function +complex +cons +double-float +fixnum +float +function +hash-table +integer +keyword +list +long-float +nil +null +number +package +pathname +random-state +ratio +rational +readtable +sequence +short-float +signed-byte +simple-array +simple-bit-vector +simple-string +simple-vector +single-float +standard-char +stream +string +[string-char] +symbol +t +unsigned-byte +vector + + + +typep +subtypep +type-of + +- [4.9. Determining the Type of an Object - Common Lisp the Language, 2nd Edition](https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node53.html) + + + + +| make-random-state | | +| ----------------- | ---------------------- | +| random-state | random-state ๋ณต์‚ฌ | +| nil (๊ธฐ๋ณธ๊ฐ’) | ํ˜„์žฌ random-state ๋ณต์‚ฌ | +| t | ์ƒˆ๋กœ์šด random-state | + + +| Common Lisp | | +| -------------- | ----------- | +| (logand a b c) | a & b & c | +| (logior a b c) | a \| b \| c | +| (lognot a) | ~a | +| (logxor a b c) | a ^ b ^ c | +| (ash a 3) | a << 3 | +| (ash a -3) | a >> 3 | + +log: bit-wise `log`ical operations +ash: `a`rithmetic `sh`ift operation + +https://www.lispworks.com/documentation/lw70/CLHS/Body/f_logand.htm \ No newline at end of file diff --git a/src/basic/type/vector.md b/src/basic/type/vector.md new file mode 100644 index 0000000..cd98558 --- /dev/null +++ b/src/basic/type/vector.md @@ -0,0 +1 @@ +# ๋ฒกํ„ฐ diff --git a/src/basic/values.md b/src/basic/values.md new file mode 100644 index 0000000..14c26da --- /dev/null +++ b/src/basic/values.md @@ -0,0 +1 @@ +# values diff --git a/src/clos/clos.md b/src/clos/clos.md new file mode 100644 index 0000000..e01e4ab --- /dev/null +++ b/src/clos/clos.md @@ -0,0 +1 @@ +# CLOS diff --git a/src/darkside/format.md b/src/darkside/format.md new file mode 100644 index 0000000..a095177 --- /dev/null +++ b/src/darkside/format.md @@ -0,0 +1 @@ +# Format diff --git a/src/darkside/loop.md b/src/darkside/loop.md new file mode 100644 index 0000000..1b9cc28 --- /dev/null +++ b/src/darkside/loop.md @@ -0,0 +1 @@ +# Loop diff --git a/src/darkside/reader-macro.md b/src/darkside/reader-macro.md new file mode 100644 index 0000000..dcb50de --- /dev/null +++ b/src/darkside/reader-macro.md @@ -0,0 +1 @@ +# ๋ฆฌ๋”๋งคํฌ๋กœ diff --git a/src/darkside/symbol-macro.md b/src/darkside/symbol-macro.md new file mode 100644 index 0000000..158cc00 --- /dev/null +++ b/src/darkside/symbol-macro.md @@ -0,0 +1 @@ +# ์‹ฌ๋ณผ๋งคํฌ๋กœ diff --git a/src/library/quicklisp.md b/src/library/quicklisp.md new file mode 100644 index 0000000..6ba81f1 --- /dev/null +++ b/src/library/quicklisp.md @@ -0,0 +1 @@ +# Quicklisp diff --git a/src/museum/history.md b/src/museum/history.md new file mode 100644 index 0000000..d7c58c3 --- /dev/null +++ b/src/museum/history.md @@ -0,0 +1 @@ +# ์ปค๋จผ๋ฆฌ์Šคํ”„ ์—ญ์‚ฌ diff --git a/src/museum/people/john-mccarthy.md b/src/museum/people/john-mccarthy.md new file mode 100644 index 0000000..0efeaee --- /dev/null +++ b/src/museum/people/john-mccarthy.md @@ -0,0 +1 @@ +# John McCarthy diff --git a/src/museum/people/people.md b/src/museum/people/people.md new file mode 100644 index 0000000..6920f72 --- /dev/null +++ b/src/museum/people/people.md @@ -0,0 +1 @@ +# ์ธ๋ฌผ๋“ค diff --git a/src/reference/reference.md b/src/reference/reference.md new file mode 100644 index 0000000..68b0723 --- /dev/null +++ b/src/reference/reference.md @@ -0,0 +1 @@ +# ์ฐธ๊ณ ์ž๋ฃŒ