JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

defmacro

core-api


    macro
    boot.janet on line 46, column 1

    (defmacro name & more)

    Define a macro.


See also:macex1 exampleSign in to add an example
Loading...
# read inpu at compile-time and create a custom func to check whether a number is in one of the
# given ranges. This turned out to be almost 4x faster than writing it as a func
# from https://abhinavsarkar.net/notes/2025-aoc-1/#day-2

(defmacro in-range? [n & _]
  (def ranges (parse-input (slurp input-path)))
  ~(or ,;(map (fn [[s e]] ~(<= ,s ,n ,e)) ranges)))
veqqqPlayground