From 1a2b3cfb9ad383f1a67305595eb40664593d22be Mon Sep 17 00:00:00 2001 From: haskal Date: Mon, 14 Dec 2020 01:41:03 -0500 Subject: [PATCH] update common bitwise shorthands --- scripts/aoc.rkt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/aoc.rkt b/scripts/aoc.rkt index b42ea48..ff7136c 100644 --- a/scripts/aoc.rkt +++ b/scripts/aoc.rkt @@ -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)