Skip to content

Instantly share code, notes, and snippets.

View dnsosebee's full-sized avatar

Daniel Sosebee dnsosebee

View GitHub Profile
/* global postMessage */
import { logger as parentLogger } from '../../logger'
import { MessageTypes } from './flogramming'
const logger = parentLogger.child({ module: 'worker' })
export type GenericMessageToWorker<T extends MessageTypes> = {
type: T
toEval: string // can have escaped pointy brackets, or not
context: { [key: string]: unknown }
@dnsosebee
dnsosebee / lisp.py
Created March 2, 2022 00:37
A simple LISP AST generator
# lisp.py, a simple LISP AST generator, by Daniel Sosebee
# param code_str: a string of LISP code
# return: a nested array AST for the inputted code
def get_ast(code_str):
branch_stack = [[]] # open branches of the AST in increasing depth
symbol_str = ''
for index in range(len(code_str)):
char = code_str[index]
if char in ['(', ')', ' ']:
# cracklepop.py
CRACKLE_NUM = 3
POP_NUM = 5
NUM_ITERATIONS = 100
def crackle_pop(n):
for num in range(1, n + 1):
if num % CRACKLE_NUM == 0:
if num % POP_NUM == 0: