This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 ['(', ')', ' ']: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: |