Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ptbl update

  • Loading branch information...
commit d017c10a9b544d221e0318f7fc021d1ab2c8e51c 1 parent e55d2d1
Vincent Toups authored
View
10 better-monad-parse.el
@@ -662,4 +662,14 @@ for string and buffer input."
"Returns the parser which returns the ALIST created by passing ARGS to ALIST>>."
(parser-return (apply #'alist>> args)))
+(defun =>. (f &rest args)
+ "Return F on ARGS."
+ (parser-return (apply f args)))
+
+(defalias '=> #'parser-return)
+
+(defun parser-return. (f &rest args)
+ "Return F on ARGS."
+ (parser-return (apply f args)))
+
(provide 'better-monad-parse)
View
BIN  better-monad-parse.elc
Binary file not shown
View
17 blogging.el
@@ -0,0 +1,17 @@
+(defun literate-scheme->markdown (input-buffer output-buffer)
+ (labels ((insertf* (&rest args)
+ (with-current-buffer
+ output-buffer (insert (apply #'format args))))
+ (text? (line)
+ (string= (substring line 0 (min 3 (length line))) ";;;")))
+ (let ((lines (with-current-buffer
+ input-buffer
+ (buffer-all-lines))))
+ (loop for line in lines do
+ (if (text? line)
+ (insertf* "%s\n" (chomp (substring line 3)))
+ (insertf* " %s\n" line))))))
+
+(literate-scheme->markdown
+ (get-buffer "interpreter-01.rkt")
+ (get-buffer "interpreter-01.md"))
View
3  monads.el
@@ -139,6 +139,9 @@ transforms it out of other such functions.")
(domonad monad-state ,monad-forms ,@body)
,state))))
+(defun seq-bind (v f) (apply #'append (mapcar f v)))
+(defun seq-return (v) (list v))
+
(defvar monad-seq
(tbl!
:m-zero (list)
View
BIN  monads.elc
Binary file not shown
View
10 parse-sombers-lab-files.el
@@ -39,5 +39,15 @@
(=>set-input new)
(m-return new))))
+(defparser =stim-desc
+ (current <- =number)
+ =_
+ (pulses <- =number)
+ =_
+ (freq <- =number)
+ (=>maybe =_)
+ (trial <- =maybe-letter->trial)
+ (m-return (alist>> :trial trial :current current :pulses pulses :freq freq :type "stim")))
+
(provide 'parse-sombers-lab-files)
View
BIN  parse-sombers-lab-files.elc
Binary file not shown
View
5 persistent-hash-tables.el
@@ -91,8 +91,9 @@ NIL."
(let* ((h (sxhash key))
(ix (mod h (ptbl-n-buckets tbl)))
(buckets (ptbl-buckets tbl))
- (bucket (ra:list-ref buckets ix)))
- (ptbl-get-from-bucket bucket key (ptbl-test tbl))))
+ (bucket (ra:list-ref buckets ix))
+ (r (ptbl-get-from-bucket bucket key (ptbl-test tbl))))
+ (if r r or-value)))
(defun ptbl-keys (tbl)
"Return a list of all keys in the persistent hash table TBL.
View
BIN  persistent-hash-tables.elc
Binary file not shown
View
6 utils.el
@@ -1187,10 +1187,10 @@ PRED to control set equality. Defaults to EQUAL."
(defun buffer-all-lines ()
"Returns all the lines in a buffer as a list."
- (save-excursion (goto-char (point-min))
+ (reverse (cdr (reverse (save-excursion (goto-char (point-min))
(loop collect
(buffer-line)
- while (= (forward-line 1) 0))))
+ while (= (forward-line 1) 0)))))))
(defun org-line->list (str)
@@ -2192,4 +2192,6 @@ input and RESET resets the labeling."
(directoryp first-attr)
first-attr)))
+
+
(provide 'utils)
View
BIN  utils.elc
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.