Skip to content

Instantly share code, notes, and snippets.

@anticrisis
anticrisis / tcl-mode-beginning-of-defun-patch.txt
Last active February 6, 2021 21:55
Patch to emacs to fix tcl-mode with nested procs/methods
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 0a0118a5eb..82e1343e05 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -651,7 +651,6 @@ tcl-mode
(setq-local add-log-current-defun-function
#'tcl-add-log-defun)
- (setq-local beginning-of-defun-function #'tcl-beginning-of-defun-function)
(setq-local end-of-defun-function #'tcl-end-of-defun-function))
@anticrisis
anticrisis / pipe.tcl
Last active January 28, 2021 23:33
Pipe, arrow, or threading operator in Tcl
#
# See tryit::go at the bottom of this file for sample.
#
# pipe $x f g h will evaluate [h [g [f $x]]]
# pipe $x {add 5} {mul 3} will evaluate [mul [add $x 5] 3]
#
namespace eval util {
namespace export pipe
proc pipe {args} {
@anticrisis
anticrisis / main.cpp
Created June 13, 2019 22:13
c++ equivalent of generic type constraints
// c++11, c++14, c++17
#include <iostream>
#include <type_traits>
using namespace std;
class BaseClass { };
class OtherClass { };
class DerivedClass : BaseClass {};
@anticrisis
anticrisis / clojure-spec-regex-instrument-confusion.clj
Created July 10, 2017 06:32
Inconsistent behavior with a simple spec that uses a regex op in an instrumented function
(s/def ::test (s/cat :k keyword? :rest (s/* pos-int?)))
(s/conform ::test [:foo 1 2 3 4])
;; => {:k :foo, :rest [1 2 3 4]}
(s/conform (s/spec ::test) [:foo 1 2 3 4])
;; => {:k :foo, :rest [1 2 3 4]}
(s/conform (s/cat :t ::test) [:foo 1 2 3 4])
;; => {:t {:k :foo, :rest [1 2 3 4]}}