Created
February 24, 2022 23:39
-
-
Save bobbicodes/803542dd22493eae27c8f8d84c641e9a to your computer and use it in GitHub Desktop.
Tofino data processing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tofino | |
(:require [clojure.string :as str])) | |
(defn rows [page] | |
(map #(str/split % #"\s+") | |
(str/split-lines (slurp page)))) | |
(defn barcode [row] | |
(first row)) | |
(defn barcode3 | |
"Returns nil if item has only one barcode." | |
[row] | |
(when-not #(= % "$0.00") | |
(second row))) | |
(defn item | |
"The item # is always the one after the price, | |
and we are only dealing with $0.00 items." | |
[row] | |
(second (drop-while #(not= "$0.00" %) row))) | |
(defn dssi? [row] | |
(contains? (set row) "DSSI")) | |
(comment | |
(map item | |
(remove dssi? (drop 340 (rows "4")))) | |
(barcode (nth (rows "4") 382)) | |
(dssi? (nth (rows "4") 382)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment