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
(setq aa (vector 10 11 12)) | |
(defun foo (bb) | |
(setf (elt bb 0) (+ 90 9)) | |
(setq bb 9999)) | |
(foo aa) | |
(print aa) ; => [99 11 12] |
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
(require 'cl-lib) | |
(defun m-random-choice (seq) | |
(elt seq (random (length seq)))) | |
(defvar m-doors (list 1 2 3)) | |
;; baseball scenario: | |
(cl-loop repeat 10000 | |
for car-door = (m-random-choice m-doors) | |
for chosen-door = 1 ; door chosen by you | |
for hit-door = (m-random-choice m-doors) ; door hit by the baseball |
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
;;; Example 4 | |
'(wxyz xy xy-xy end) | |
'(aabb ab ab-ab end) | |
(progn | |
(font-lock-add-keywords | |
nil | |
`(("\\bxy\\b" | |
(0 'success t)) |
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
;; copy the following and | |
;; paste it in your emacs init file (the dotemacs file) | |
(defun fix-quotes (beg end) | |
"replaces pretty quotes to ugly quotes." | |
(interactive "r") | |
(save-excursion | |
(format-replace-strings '(("\x2019" . "'") | |
("\x201c" . "\"") | |
("\x201d" . "\"") |