Upgrade to Pro — share decks privately, control downloads, hide ads and more …

esaを支えたい技術

 esaを支えたい技術

Emacs Lisp and Elm may have some common syntax.

esa をネタに Emacs Lisp と Elm を無理やり繋げた発表をした
https://developer.feedforce.jp/entry/2019/07/01/140000

Takashi Masuda

June 28, 2019
Tweet

More Decks by Takashi Masuda

Other Decks in Programming

Transcript

  1. (defun helm-esa-http-request (&optional url) "Make a new HTTP request for

    create `helm-esa-file'. Use `helm-esa-get-url' if URL is nil." (unless url ;; 1st page (if (get-buffer helm-esa-work-buffer-name) (kill-buffer helm-esa-work-buffer-name)) (get-buffer-create helm-esa-work-buffer-name)) (helm-esa-http-debug-start) (request (if url url (helm-esa-get-url)) :headers `(("Authorization" . ,(concat "Bearer " helm-esa-access-token))) :parser 'json-read :success (cl-function (lambda (&key data response &allow-other-keys) (helm-esa-http-debug-finish-success (request-response-url response)) (let ((next-url)) (with-current-buffer (get-buffer helm-esa-work-buffer-name) (goto-char (point-max)) (helm-esa-insert-articles data) (setq next-url (helm-esa-next-url data)) (if next-url (helm-esa-http-request next-url) (write-region (point-min) (point-max) helm-esa-file)))))) :error (cl-function (lambda (&key error-thrown response &allow-other-keys) (helm-esa-http-debug-finish-error (request-response-url response) error- thrown))))) IUUQTHJUIVCDPNNBTVUBLBFNBDTIFMNFTB
  2. ؔ਺ݺͼग़͠ (max 1 2) => 2 elisp -- ΧϯϚ ͸ෆཁ

    max 1 2 => 2 -- ΧοίͰׅΕΔ⭐ (max 1 2) => 2 Elm
  3. தஔԋࢉࢠ (1 + 2) => Invalid function: 1 (+ 1

    2) => 3 elisp 1 + 2 => 3 -- ؔ਺ͱͯ͠΋࢖͑Δ (+) 1 2 => 3 -- ઈରݟ΍͍͢⭐ ((+) 1 2) => 3 Elm
  4. MFUࣜ (let ((a 1) (b 2)) (max a b)) =>

    2 elisp -- ׬શʹҰக⭐ let a = 1 b = 2 in max a b => 2 Elm
  5. -JTUʢԋࢉࢠʣ (cons 3 '(2 1)) => (3 2 1) elisp

    -- ͜Ε·ͨಉ͡⭐ 3 :: [2, 1] => [3,2,1] Elm
  6. λϓϧ (cons 1 "a") => (1 . "a") elisp --

    ಉͩ͡⭐ (1, "a") => (1,"a") Elm