Comments (6)
Strangely when I change the filter-empty-dirs
function by adding a println
at the start of its second header it works well with both babashka versions:
(defn filter-empty-dirs
([entries]
(let [groups (group-by #(dir? %) entries)
dirs (map #(.path %) (groups true))
files (map #(.path %) (groups false))]
(filter-empty-dirs files dirs)))
([files dirs]
(println (count files) (count dirs)) # This line makes it work
(if (empty? files)
dirs
(let [[current-file & rest-files] files]
(->> dirs
(remove (path-components current-file))
(recur rest-files))))))
from babashka.
I am repro-ing with docker with 1.3.185 and it also gives an SO:
docker run --rm -v $(pwd):/tmp babashka/babashka:1.3.185 bash -c 'cd /tmp; bb files.clj'
You can fix this by making remove
strict before doing the recur
:
(defn filter-empty-dirs
([entries]
(let [groups (group-by #(dir? %) entries)
dirs (map #(.path %) (groups true))
files (map #(.path %) (groups false))]
(filter-empty-dirs files dirs)))
([files dirs]
(if (empty? files)
dirs
(let [[current-file & rest-files] files]
(->> dirs
(remove (path-components current-file))
vec
(recur rest-files))))))
from babashka.
Thnks!!!!
from babashka.
Strangely it does not fail for me when I use 1.3.185 docker image as you do. But it does when I use 1.3.186.
https://asciinema.org/a/1CqV7e3aLnpLMqeSvwIbccpmt
from babashka.
It could be that the stack size is slightly different in your case, but lazy expression don't mix well with deeply recursive code and is known to cause such problems sooner or later.
from babashka.
Great!!! Thank you for your patience.
from babashka.
Related Issues (20)
- Feature flags ignored in custom builds with GraalVM 21 HOT 10
- Cannot import `shadow.css.build` HOT 5
- eximia compatibility
- empty bb.edn blowup babashka
- Unable to resolve classname: java.time.temporal.WeekFields HOT 2
- #{a b} set initialization doesn't throw if there are duplicates (in clj it does) HOT 6
- Command line parameters not being parsed by scripts, passing right through if Babashka has the same ones. HOT 2
- Change in v1.3.187 release breaks use of the `version` literal as an input to scripts
- Caching issue with relative local/root by same name, used in bb.edn in different directories HOT 1
- Resolve bb.edn when script is invoked via symlink HOT 1
- No dispatch macro for: ? HOT 9
- metadata added by read-string (as compared to clj implementation). HOT 9
- Embedding META-INF/bb.edn with :deps results in: Cannot run program "java"
- bb execution fails on Gentoo HOT 6
- Adding javax.net.ssl.SSLSocket and javax.net.ssl.SSLSocketFactory? HOT 33
- Static-linked binary file for armv7(32-bit) platform. HOT 1
- hash-ordered-coll not found in clojure.core HOT 1
- Try to support latest changes in at-at
- Wrapping built-in timbre/log! throws an error HOT 3
- exec-task description
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babashka.