Back to APIs list

Air quality API examples & templates

Use these vals as a playground to view and fork Air quality API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
snip
beneskildsen
snip
An interactive, runnable TypeScript val by beneskildsen
lisp
zackoverflow
lisp
Lispaas (lisp as a service) A mini lisp interpreter How to use: To execute code: const result = @zackoverflow.lisp(" (+ 1 2)") To just parse and return the AST: const ast = @zackoverflow.lisp("(+ 1 2)", true) The value returned is the last expression of the program, for example: const lispResult = @zackoverflow.lisp("(+ 1 2) (+ 400 20)") console.log('Val', lispResult.val === 420) Example: Compute Fibonacci sequence let result = @zackoverflow.lisp(` (defun fib (x) (if (<= x 1) x (defun impl (i n-1 n-2) (if (= x i) (+ n-1 n-2) (impl (+ i 1) (+ n-1 n-2) n-1))) (impl 2 1 0))) (assert-eq 0 (fib 0)) (assert-eq 1 (fib 1)) (assert-eq 1 (fib 2)) (assert-eq 2 (fib 3)) (assert-eq 3 (fib 4)) (assert-eq 5 (fib 5)) (assert-eq 8 (fib 6)) (assert-eq 13 (fib 7)) `); Documentation Functions You can define a function like so: (defun hello (x) (print x)) Rest/variadic arguments are also supported (defun variable-amount-of-args (...args) (print args)) (variable-amount-of-args "Hello" "World!") Lists Define a list like so: (let ((my-list (list 1 2 3 4))) (print my-list) (print (list-get my-list 1))) Internally, a list is just a Javascript array. So indexing is O(1), but that does mean cdr requires copying (vs the linked list implementation). Plists Property lists, or records. Internally these are Javascript objects. Create a plist like so: (set null :key "Value") TODO
traversePairwise
jdan
traversePairwise
An interactive, runnable TypeScript val by jdan
bonsaiReducer
beneskildsen
bonsaiReducer
An interactive, runnable TypeScript val by beneskildsen
karma
stevekrouse
karma
An interactive, runnable TypeScript val by stevekrouse
airtable_deno_sample
mattx
airtable_deno_sample
An interactive, runnable TypeScript val by mattx
tweetnacl
tmcw
tweetnacl
tweetnacl example An example of using tweetnacl from Val Town - this uses the keyPair method and then encodes the keypair using hex encoding.
truncateVal
stevekrouse
truncateVal
// Utility for saving a reasonable truncated version of a val
percentLiftGasNeededSTP
andrew
percentLiftGasNeededSTP
An interactive, runnable TypeScript val by andrew
big_stories_ranks
tmcw
big_stories_ranks
// set by tmcw.big_story at 2023-07-21T13:27:35.553Z
myApi
sairamoe
myApi
An interactive, runnable TypeScript val by sairamoe
products
colinespinas
products
An interactive, runnable TypeScript val by colinespinas
testHTML
sairamoe
testHTML
Remix of: tr3ntg/testHTML
dlock
karfau
dlock
Remix of: stevekrouse/dlock
testFormData
rafter
testFormData
An interactive, runnable TypeScript val by rafter
test_SignatureCheck
karfau
test_SignatureCheck
An interactive, runnable TypeScript val by karfau