As a continuation of Using Lisp or Scheme for runtime configuration of Java programs, I am looking at having a Java property file "replacement" which can contain code in addition to plain Java strings. Java property files look like:
key1=value1
key2=value2
...
For fun I am playing with an elderly JScheme (due to size) but came to think of that it would be useful to have a file format that would be compatible with Clojure. This would allow the usage of the same syntax for just small "read my configuration"-usages as well as larger systems using Clojure. The idea is then that the values can now be evaluated instead of just being static strings.
I am not very experienced with Scheme or Clojure, but it appears that vector
is available in both, but the short-cut syntax is different (#(...)
compared to [...]
).
Is there a syntax for representing a "Java property" data structure which is both valid Scheme and Clojure programs? Please show actual code.
EDIT: After looking at the (props ...)
suggestion and brushing up my Lisp skills some more with ELisp and JScheme, I found that
(list
"key1" "value1"
"key2" "value"
)
might be the simplest way to do this with a syntax not too far from a property file.