Skip to content

Instantly share code, notes, and snippets.

View shegeley's full-sized avatar
🍴
Fork you

Grigory Shepelev shegeley

🍴
Fork you
View GitHub Profile
@shegeley
shegeley / scmfmt.scm
Created June 14, 2023 07:20 — forked from ojarjur/scmfmt.scm
Code formatter for Scheme using Guile's pretty-print method. This reads from stdin and writes to stdout.
(use-modules (ice-9 pretty-print))
;; Helper methods for maintaining comments and whitespace.
(define (copy-line-comment)
(let ((char (read-char)))
(if (not (eof-object? char))
(if (eq? char #\newline)
(newline)
(begin (write-char char) (copy-line-comment))))))
(define (maintain-empty-lines)
@shegeley
shegeley / convenience-lambda.scm
Created April 15, 2023 03:30 — forked from shanecelis/convenience-lambda.scm
A succinct anonymous procedure syntax for Guile scheme
;; convenience-lambda.scm
;;
;; This syntax was inspired by arc and Clojure's anonymous procedure
;; syntax.
;;
;; #.\ (+ %1 %2) -> (lambda (%1 %2) (+ %1 %2))
;; #.\ (+ % %%) -> (lambda (% %%) (+ % %%))
;;
;; The .\ is supposed to approximate the lowercase lambda character in
;; ascii.