Skip to content

Instantly share code, notes, and snippets.

View santanuchakrabarti's full-sized avatar

Santanu Chakrabarti santanuchakrabarti

  • Kolkata. West Bengal. India
View GitHub Profile
@santanuchakrabarti
santanuchakrabarti / _reader-macros.md
Created February 27, 2022 06:40 — forked from chaitanyagupta/_reader-macros.md
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@santanuchakrabarti
santanuchakrabarti / custom.el
Last active February 19, 2022 18:56
Configuring Emacs 27 for Common Lisp
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(diff-hl magit treemacs project-explorer use-package))
'(pe/cache-enabled nil)
'(pe/inline-folders nil)
'(pe/width 20)
'(treemacs-python-executable "C:/Python310/python.exe"))
@santanuchakrabarti
santanuchakrabarti / build.gradle
Last active February 11, 2022 15:32
Default Gradle build file to run nREPL server by Clojuresque
buildscript {
repositories {
mavenCentral()
maven { url 'http://clojars.org/repo' }
}
dependencies {
classpath 'clojuresque:clojuresque:1.7.0'
}
}
@santanuchakrabarti
santanuchakrabarti / .emacs
Last active August 29, 2015 14:03
Emacs configuration file (.emacs) - For Common Lisp and SLIME, Scheme and Geiser, Clojure, Java and ANSI C
(add-to-list 'load-path "~/.emacs.d/include")
(add-to-list 'load-path "~/.emacs.d/ecb")
(add-to-list 'load-path "~/.emacs.d/full-ack")
(autoload 'ack-same "full-ack" nil t)
(autoload 'ack "full-ack" nil t)
(autoload 'ack-find-same-file "full-ack" nil t)
(autoload 'ack-find-file "full-ack" nil t)
(setq cedet-custom-path "~/.emacs.d/cedet-1.0.1") ;; takes care of loading cedet-1.1
(require 'ideframetools)
;;(load-file "~/.emacs.d/cedet-1.1/common/cedet.el")
@santanuchakrabarti
santanuchakrabarti / RE_to_Grammar_Algorithm.md
Last active December 5, 2021 21:12
An algorithm to generate a Regular Grammar from a Regular Expression
@santanuchakrabarti
santanuchakrabarti / codelets1.lisp
Created June 4, 2014 22:09
Code I wrote to learn basic Lisp programming
(defun add_positive_numbers (from to)
(/ (* (+ from to) (+ 1 (- to from))) 2))
(add_positive_numbers 20 119)
(defun create_seq (seq_generator seq_items iter_count)
(loop for i from 0 to iter_count
do (let ((nxt_entry (funcall seq_generator seq_items)))
(setf seq_items (append seq_items (list nxt_entry)))))
seq_items)