Hi Vish,
Thanks for the feedback! It'd be possible to use metadata on objects, but
I don't think EDN supports it. I could swap out and use a different format
for saving data, but I find it very handy at least to keep things as EDN,
as I can then load the .edn file with other tools (i.e. automate generating
reports from my data).
Another option would be to have "files" be maps with keys like :data and
:timestamp. If the built-in commands of mapfs are designed to identify
these file maps, that could make for convenient working with them. For
example, cat with a map might just report the :data value, and put could
assoc values into the :data part of the map.
However, this would impose a format into the system. One of the early
thoughts was that mapfs could be used with any plain old map (i.e. while
working on a project, load functions from mapfs.core then use to
interrogate something you're working on.) So using files as maps might not
work well with that goal.
For ls, I was thinking having a long format would be nice. Since commands
in mapfs are just clojure commands (the console loop just wraps given text
with "(" and ")" and evals), I think using -l wouldn't work. Using :long
should be fine though. Maybe a multimethod would do nicely here to
accommodate various data types and ls could use that to show long listings
of values within the map.
For now, I'm going to keep on working with it for some data tracking here
and will be making notes on what to implement. (I added a note about
metadata to the todo.edn file in the mapfs repo).
Thanks again!
steven
On Monday, March 16, 2015 at 1:19:57 PM UTC-4, VishK wrote:
>
> Sounds interesting. Could one attach metadata (such as a time-stamp) on a
> file-equivalent ? If one could then see that metadata using some parameter
> to your commands (ls -l), that would make this pretty powerful, IMHO.
>
> Thanks
> Vish
>
> On Monday, March 16, 2015 at 11:41:04 AM UTC-5, Steven Yi wrote:
>>
>> Hi All,
>>
>> I've posted a small experimental project I've been working on the past
>> day that I thought was somewhat novel called mapfs:
>>
>> https://github.com/kunstmusik/mapfs
>>
>> It allows using a Clojure map like a filesystem. An example recording of
>> it in use is here:
>>
>> http://kunstmusik.com/mapfs.gif
>>
>> The project is currently a command-line app that loads a map from an .edn
>> file and provides a shell. You can use familiar commands like cd, rename,
>> mv, cat, and pwd to navigate key paths in the map and read/modify values.
>>
>> The idea came as a result of reading all the REPL talk on clojure-dev,
>> and also that I wanted a simple way to track some data in some projects of
>> mine. I had already started on a simple todo system but then the idea to
>> have a generic fs on a map seemed fun and more useful for creating adhoc
>> structured data for various purposes.
>>
>> The result is the app acts somewhere between a REPL and shell. You can
>> execute functions as commands, so you can do things like pipe results using
>> threading macros, i.e.:
>>
>> mapfs> ->> (cat :key) (str "The value of :key is ")
>>
>> which would format the value of the key in the current path to a string.
>>
>> For my own purposes, this has been neat for recording notes and values
>> that I can later view or process with clojure functions. I can imagine
>> having a way to extend the available commands by registering namespaces
>> from other libraries, but I'm not certain yet what way to go for that.
>> It's somewhat at proof-of-concept stage at the moment, so there are
>> certainly bugs and things to work out, but I think it's already enough for
>> testing out the idea. Hopefully this makes making your own data and small
>> utility apps from just Clojure functions pretty easy. (That's the goal at
>> least!)
>>
>> If you'd like to take it for a spin, you can clone the repo and use "lein
>> run todo.edn". (There's also a mapfs shell script there for running with a
>> generated uberjar.) Also, running "help" in the shell shows built-in
>> functions. I'd also like to mention this uses jline[1] for console
>> processing, which provides a whole lot of great features (i.e. history,
>> vim/emacs key bindings, tab completion support).
>>
>> Cheers!
>> steven
>>
>> p.s. - I didn't see any existing projects like this, but if so, please
>> let me know, I'd be happy to learn more about them!
>>
>> [1] - https://github.com/jline/jline2
>>
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.