carpentry-org / file Goto Github PK
View Code? Open in Web Editor NEWA simple file abstraction for Carp
Home Page: https://veitheller.de/file/
License: MIT License
A simple file abstraction for Carp
Home Page: https://veitheller.de/file/
License: MIT License
As of 0.0.5
, relative paths seem to be relative to the path of the library instead of to the current working directory. This needs to be fixed ASAP.
Cheers
I am new to carp and am seeing the following error when trying to load the library:
A file can't load itself: 'file.carp' at /Users/spencerking/.carp/libs/github.com_COLON_carpentry-org/file/0.0.4/file.carp:1:7.
Please correct me if I am wrong, but it appears the library is expected to have a main.carp file and file.carp would then need to define a File module.
I would be happy to assist with fixing this issue, assuming it is an actual issue and not a mistake on my part.
Edit:
I should probably note, I was unable to get the library to load automatically from git so I cloned it manually.
As it currently stands, we cannot use closure functions in our walkers. Consider this example (which would be File.contents
, but we have to use a hacky workaround to make this work):
(let-do [all-files []]
(ignore (File.walk "directory" &(fn [f] (Array.push-back! all-files f))))
(println* &all-files))
You’d expect all-files
to contain all the files in a directory here. Sadly, this is not currently the case, instead File.walk
will segfault. This is because File.walk
is internally implemented in C, and calling a Carp closure from C is currently not supported if it accesses the environment. This is documented in file’s documentation, but can still only be a temporary state of affairs. The current implementation in C lives here.
As I see it, we have two different alternatives here:
File.walk
in Carp, and only use C for system calls. This seems more prudent, but will require us to wrap the filesystem functions we need (ideally a comprehensive set of the functions in sys/stat.h
, dirent.h
, and sys/types.h
, in a different library that this one imports). This legwork will need to be done sooner or later anyway, so I guess we might as well do it ourselves.Cheers
w+
will truncate existing files. This is not safe!
I need to fix this ASAP!
Cheers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.