Skip to content

Instantly share code, notes, and snippets.

View tail-call's full-sized avatar
🐚
Conch in the Shell

Maria tail-call

🐚
Conch in the Shell
View GitHub Profile
@tail-call
tail-call / run-length-encoding.lisp
Created June 14, 2023 15:12
Who are you running from?
(defun make-stack ()
(make-array 0 :fill-pointer 0 :initial-element nil))
(defun stack-push! (stack item)
(vector-push-extend item stack))
(defun run-length-encode (string)
(declare (type string string))
(let ((octets (string-to-octets string))
(stack (make-stack))
(defconstant ~bad-number~ (integer->bit-vector #xEDB88320)
"Used in CRC computation.")
;; From https://lispforum.com/viewtopic.php?p=6269#p6269
(defun integer->bit-vector (integer)
"Create a bit-vector from a positive integer."
(labels ((integer->bit-list (int &optional accum)
(cond ((> int 0)
(multiple-value-bind (i r) (truncate int 2)
(integer->bit-list i (push r accum))))
#lang racket/gui
(require srfi/26)
(define-syntax-rule (when condition . body)
(if condition
(begin . body)
(void)))
(define auto-clicker-prices
(require math/flonum)
(define (sorted-lists->stream list-1 list-2)
(cond ((empty? list-1) list-2)
((empty? list-2) list-1)
((< (car list-1)
(car list-2))
(stream-cons (car list-1)
(sorted-lists->stream (cdr list-1) list-2)))
(else
function* iota(n: number) {
for (let i = 0; i < n; i++) yield i;
return 8;
}
function* map<T, U>(generator: Generator<T>, mapper: (value: T) => U) {
for (const value of generator) {
yield mapper(value);
}
}
interface X {
x: any;
}
interface Y {
y: any;
}
interface Z {
z: any;
{
"magic": [0x2, 0x24, 0x99],
"version": { "!format": "u1", "!equal": { "!or": [0x14, 0x13] } },
}

Either for TypeScript

Is this working? I don't know.

//@ts-check
class PushbackIterator {
/**
* @param {Iterator<string, string, string>} stringIter
*/
constructor(stringIter) {
/** @type {Iterator<string, string, string>} */
this.stringIter = stringIter;
/** @type {Array<string>} */
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sections demo</title>
<style>
section {
display: none;
}