This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (5)
- # beginners (36)
- # calva (2)
- # cider (26)
- # cljs-dev (2)
- # clojure (121)
- # clojure-spec (2)
- # clojure-uk (2)
- # clojurescript (12)
- # component (1)
- # conjure (6)
- # crux (7)
- # datomic (9)
- # docker (1)
- # fulcro (15)
- # lambdaisland (1)
- # malli (5)
- # meander (24)
- # off-topic (5)
- # re-frame (5)
- # reagent (3)
- # ring (3)
- # shadow-cljs (41)
- # sql (4)
- # vim (3)
hi, I have a big csv, is it possible to read lazily the lines in inverse order? from tail to head
You can reverse the file with
tac file.csv > rev_file.csv and then read
rev_file.csv normally. Definitely an option if the file isn't too large.
it's inefficient (requires consuming the whole thing and working backward) but doable
actually, mmap might be the one way to do this that doesn't use heap space inefficiently (if I'm remembering the API correctly)
you can use the memory mapped API to do this without putting the whole contents in heap, it even lets you skip to the end and work toward the front, without consuming what's in between https://howtodoinjava.com/java7/nio/memory-mapped-files-mappedbytebuffer/
I assume you have something accumulated in time order and you want to process from new to old
clever usage of tac and ProcessBuilder with output to an iostream instead of file might allow similar via the OS(?)
@drewverlee exactly as Alex said, I have a big cvs of timestamped data that I have to process it windowed by timeframe and the original source has it ordered by recent to old, but the window function needs old to recent
maybe ReversedLinesFileReader would work, http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/ReversedLinesFileReader.html
> Reads lines in a file reversely (similar to a BufferedReader, but starting at the last line). Useful for e.g. searching in log files.
But if you have to process the whole thing then the out put will be the same no? The window closing logic should handle any order of time stamped events.
Yes, but I think, for instance, onyxs semantics express the window closing trigger this way.
@drewverlee no, ordering matters because the window function needs to know the oldest timestamp to create sequence
hello again everyone! i have a question: is there a preferred structure in a repo for having both a client (cljs) and api (clj)?
i currently used
lein new shadow-cljs <app-name> +reagent but curious if there is another way to generate both the client template and a plain lein project? maybe i should just lein new my-app` and then
lein new shadow-cljs inside of that app?
luminus template has really good defaults and the overall structure(clj/cljs/cljc). lein new luminus new-app +cljs +shadow-cljs
haha sorry mate. I recommended you giving luminus a try and looks like you experienced the exactly the same issue I was fighting in the recent Luminus template 😄 Infinite build completed/compiling Referenced issue https://github.com/luminus-framework/luminus/issues/270 You may need to upgrade your shadow-cljs to 2.10.16 or use ~ month old luminus template as a workaround