This file contains hidden or 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
| ;; http://www.slideshare.net/dahlmoon/numpy-20160519 | |
| ;; (import [numpy [*]]) | |
| (import numpy) | |
| (import math) | |
| ;; 1D 배열 | |
| ;; 파이썬 : numpy.array([1,2,3]) | |
| (numpy.array [1 2 3] ) |
This file contains hidden or 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
| ;; https://www.youtube.com/watch?v=SB9TWabor1k | |
| ;; http://docs.hylang.org/en/latest/language/api.html | |
| ;; http://docs.hylang.org/en/latest/language/api.html#defmacro | |
| ;;defmacro is used to define macros. | |
| defmacro는 매크로를 정의하는 데 사용됩니다. | |
| ;;The general format is (defmacro name [parameters] expr). | |
| 일반적인 형식은 (defmacro name [parameters] expr)입니다. | |
| ;; The following example defines a macro that can be used to swap order of elements in code, |
This file contains hidden or 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
| ;; https://www.youtube.com/watch?v=SB9TWabor1k | |
| ;; http://docs.hylang.org/en/latest/language/api.html | |
| ;; http://docs.hylang.org/en/latest/language/api.html#defmacro | |
| ;;defmacro is used to define macros. | |
| defmacro는 매크로를 정의하는 데 사용됩니다. | |
| ;;The general format is (defmacro name [parameters] expr). | |
| 일반적인 형식은 (defmacro name [parameters] expr)입니다. | |
| ;; The following example defines a macro that can be used to swap order of elements in code, |
This file contains hidden or 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
| ;; https://www.youtube.com/watch?v=SB9TWabor1k | |
| (car (car (cdr (cdr '(apples oranges (pickles bananas)) )))) | |
| ;;=> 'pickles' | |
| (cdr '(apples oranges (pickles bananas)) ) | |
| ;;=> ('oranges' ('pickles' 'bananas')) | |
| (cdr (cdr '(apples oranges (pickles bananas)) )) | |
| ;;=> (('pickles' 'bananas')) |
This file contains hidden or 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
| (def pi 3.14159) | |
| (def radius 10) | |
| (* pi ;; 3.14159 | |
| (* radius radius) ;; 100 | |
| ) | |
| ;;=> 314.159 |
This file contains hidden or 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
| ;; ELISP | |
| ;; sort함수가 없어서 직접 정의해 만들어 주어야함. | |
| (defun quicksort (lst) | |
| "Implement the quicksort algorithm." | |
| (if (null lst) nil | |
| (let* ((spl (car lst)) | |
| (rst (cdr lst)) | |
| (smalp (lambda (x) | |
| (< x spl)))) | |
| (append (quicksort (remove-if-not smalp rst)) |
This file contains hidden or 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
| M-x lexbind-mode | |
| ;; => Lexbind mode enabled | |
| M-x lexbind-toggle-lexical-binding | |
| ;; => Lexical-binding enabled | |
| lexical-binding | |
| ;; => t |
This file contains hidden or 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
| (let ( (a 1) ) | |
| (let ( (F (lambda () (print a))) ) | |
| (funcall F) )) | |
| ;;=> 1 | |
| (let ((a 1)) | |
| (let ((f (lambda () (print a)))) | |
| (let ((a 2)) | |
| (funcall f) ))) |
This file contains hidden or 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
| (setq x 3) | |
| ;; lambda == Anonymous function? | |
| (defun func (x) | |
| "function" | |
| '(lambda () x)) | |
| ;; (funcall (func 10)) |
This file contains hidden or 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
| lexical-binding | |
| ;; => nil 이라면? (현재 상태는 Dynamic binding을 의미한다?) | |
| ;; lambda == Anonymous function? | |
| (defun func (x) | |
| "function" | |
| '(lambda () x)) | |
| (setq wrapped_func (func 10)) |