| Hello all, I've just built a special "collection" type which treats directories as if they were tables, with keys being files and values being the contents of the files. Deleting, creating/updating files is as easy as (= f-tb!file nil) and (= f-tb!file "the new contents"). The code is on the arc-wiki, making use of my settable-fn.arc, ($ ...), redef, and files.arc. arc> (load "lib/file-table.arc")
nil
arc> (= test (file-table "."))
#4(tagged table #<procedure: reader> #hash((keys . #<procedure: keys>) (= . #<procedure: writer>)))
arc> (keys test)
(".gitignore" "BUGS" "CONVENTIONS" "ac.sbcl.lisp" "ac.scm" "app.arc" "arc-exe.scm" "arc.arc" "arc.sh" "as.scm" "bitops.scm" "blog.arc" "brackets.scm" "code.arc" "copyright" "files.arc" "html.arc" "libs.arc" "pprint.arc" "prompt.arc" "robots.txt" "srv.arc" "strings.arc" "whtml.arc" "chismaksball.arc" "news.arc" "tl" "grayarrow.gif" "graydown.gif" "infix.arc" "s.gif" "y18.gif" ".arc.arc.swp")
arc> test!BUGS
"This file details known issues in Anarki. \n\n***************************************************************************\nCOMPATIBILITY ISSUES\nThis section documents incompatibilites between Anarki and Arc2.\nSee also the CONVENTIONS file.\n\nThe current thinking is that new macros generally don't need to be\nmentioned here. It should be understood that defining new macros could\npotentially break code. To get a list of the added macros in Anarki,\nuse: (load \"lib/new-macros.arc\") (new-macros)\n\n*2007/02/19* When loading lib/defpat.arc, the symbol p-m can't be safely\n used as a variable for a container, or as the symbol for a function. This\n problem will also apply for any macro defined in Anarki that is not\n already defined in Arc1.\n\n***************************************************************************\nARC1 ISSUES\n This section documents bugs in the official Arc distribution. They are \n also present in Anarki unless otherwise noted.\n\n*2007/02/19* Macros will override local variables in (let ...) and other\n local-variable-creating forms.\n\n*2007/02/18* Interpreter reads \".a\" as the EOF character. \n Arc1 treats EOF as an error, which this probably should be anyway.\n However, Anarki quits on EOF. This also applies to things like \"is!:.a\",\n which should arguably be equivalent to \"(is ': a)\".\n UPDATE: Other surprise EOFs include \"\\!\". Still present in Arc2.\n\n***************************************************************************\n"
arc> (= test!niaw "cat, cat")
"cat, cat"
arc> (file-exists "./niaw")
"./niaw"
arc> test!niaw
"cat, cat"
arc> (= test!niaw nil)
nil
arc> (file-exists "./niaw")
nil
arc> test!niaw
nil
|