update common bitwise shorthands

This commit is contained in:
xenia 2020-12-14 01:41:03 -05:00
parent b3cda65a61
commit 1a2b3cfb9a
1 changed files with 5 additions and 2 deletions

View File

@ -1,10 +1,10 @@
#lang racket
#lang curly-fn racket
;; utilities for every challenge script
(require "aoc-lib.rkt" threading syntax/parse/define (for-syntax racket/syntax) graph)
(provide answer dbg memoize define/memoized
band bor bxor bshl bshr
band bor bxor bnot bshl bshr bset? bfield
(all-from-out threading syntax/parse/define graph)
(for-syntax (all-from-out racket/syntax)))
@ -16,8 +16,11 @@
(define band bitwise-and)
(define bor bitwise-ior)
(define bxor bitwise-xor)
(define bnot bitwise-not)
(define bshl arithmetic-shift)
(define bshr #{arithmetic-shift %1 (- %2)})
(define bset? bitwise-bit-set?)
(define bfield bitwise-bit-field)
;; makes a memoization wrapper around a function
(define (memoize func)