Skip to content

Instantly share code, notes, and snippets.

@sogaiu
sogaiu / scribble-indexing-notes.md
Last active February 12, 2025 11:57
scribble indexing notes

2025-02-12

problem

not all items listed in the "table" here result in successful searches. one example item that does not yield any search results is: #fl(

exploration

background

@sogaiu
sogaiu / gist:09dc279ed7da68bdeece55a69429d831
Created February 12, 2025 00:59
"shorthand", "short-hand", etc.
$ rg hort | rg and
janet.1:Execute a single Janet expression as a Janet short-fn, passing the remaining command line arguments to the expression. This allows
test/suite-parse.janet:(assert (= '(1 2 3) (quote (1 2 3)) (tuple 1 2 3)) "quote shorthand")
CHANGELOG.md:- Add function literal short-hand via `|` reader macro, which maps to the
test/suite-boot.janet:# Function shorthand
test/suite-boot.janet:(assert (= (|(+ 1 2 3)) 6) "function shorthand 1")
test/suite-boot.janet:(assert (= (|(+ 1 2 3 $) 4) 10) "function shorthand 2")
test/suite-boot.janet:(assert (= (|(+ 1 2 3 $0) 4) 10) "function shorthand 3")
test/suite-boot.janet:(assert (= (|(+ $0 $0 $0 $0) 4) 16) "function shorthand 4")
test/suite-boot.janet:(assert (= (|(+ $ $ $ $) 4) 16) "function shorthand 5")
@sogaiu
sogaiu / gist:dd3ad41558d3b89ef10ed2930868176c
Created February 9, 2025 16:30
use of expander in janet
https://github.com/janet-lang/janet/commit/70e1f3ac81eb6cc14ad8c616b5ddce615dcf0d64
@sogaiu
sogaiu / hexadecimal-exponential-notation.md
Last active February 3, 2025 12:05
hexadecimal exponential notation
@sogaiu
sogaiu / git-tips.md
Last active February 13, 2025 08:20
git tips
@sogaiu
sogaiu / dsl-error-messages.md
Created January 29, 2025 14:11
dsl error messages

Like all programmers, DSL users deserve proper abstractions, that is, constructs that do not expose the underlying, reused components. In other words, host language details should not leak into uses of the DSL, including in error messages. Racket’s syntactic abstraction capabilities builds on the innovations of its Scheme and Lisp roots, but these predecessors never cared about writing true abstractions. At best, Lisp and Scheme programmers write low-level validation code that clutters the implementation; more commonly, validation is omitted, leaving Lisp and Scheme macros that resemble naive rewrite rules that do not distinguish the DSL from the host language. Racket helps the creation of robust linguistic abstractions with a declarative DSL for writing syntax transformers [Culpepper 2012]. Instead of low-level validation code, programmers write high-level specifications, which is compiled to produce error messages in terms of the surface language.

@sogaiu
sogaiu / jeat-notes.md
Last active January 29, 2025 03:13
janet-ex-as-tests notes

issues

  • how to handle matching macroexpansions... identifiers in expansions typically vary each time an expansion is performed. there doesn't appear to be a way to "reset" things such that specific identifiers are used.
  • how to handle checking for certain numeric values like floating point... expressing an exact value for an expected value seems non-trivial / impractical not too infrequently, e.g. (= 0.3 (+ 0.1 0.2)) is false
  • how to handle (def ...), (var ...), etc.... the code transformation step could have an initial phase that