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
| ;; ---- Asynchronous ----- | |
| (defun retrieve-handler (status) | |
| (message "callback %s with %s chars" status (buffer-size)) | |
| (setq got status)) | |
| (condition-case x (url-retrieve "http://ahsdjfas" #'retrieve-handler) (t (message "handle %s" x))) | |
| "handle (error ahsdjfas/80 nodename nor servname provided, or not known)" | |
| (condition-case x (url-retrieve "http:ahsdjfas" #'retrieve-handler) (t (message "handle %s" x))) |
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
| ;; | |
| ;; I'm not sure why these aren't part of `math-standard-units`. | |
| ;; Source: https://en.wikipedia.org/wiki/Mebibyte | |
| ;; | |
| (setq math-additional-units '( | |
| ;; Base units. Note "b" is Barns in math-standard-units, while convention "B" is Bytes, so | |
| ;; there's no conflict. | |
| (bits nil "bits") | |
| (B "8 * bits" "Bytes") |
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
| #!/usr/bin/env python3 | |
| # see https://old.reddit.com/r/mathematics/comments/p2wv1a/twin_primes_square_distances/ | |
| def find_prime_pairs(n): | |
| sieve = [True] * n | |
| if n > 0: | |
| sieve[0] = False | |
| if n > 1: | |
| sieve[1] = False | |
| for number in range(2, int(n ** 0.5) + 1): |
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
| i=0 | |
| j=3 | |
| k=5 | |
| while i<40: | |
| if j==0 and k==0: | |
| print(f'{i} fizzbuzz') | |
| j=2 | |
| k=4 | |
| elif j==0: | |
| print(f'{i} fizz') |
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
| (intern ":fact") | |
| (intern ":expt") | |
| (defun sp/fact (n) ; n! | |
| (if (> n 1) | |
| (* n (sp/fact (- n 1))) | |
| 1)) | |
| (defun sp/term(op &rest rest) | |
| (cond ((eq op :fact) (cons 'sp/fact rest)) ; a! |
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
| Solution to an old puzzle. The puzzle text: | |
| 02201010121021210121111011020201012110221021 | |
| 21020201012102221020211111110210101211010102 | |
| 10010120211210202101211102210212010121012111 | |
| 00210201010121101010210010120220010121102011 | |
| 02021102101201010120211210121111110101202112 | |
| 01012020210101201212012100121101212012110121 | |
| 20121201211 |
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://en.wikipedia.org/wiki/Paradox_of_tolerance |
OlderNewer