JSON might work but then the inputs are not very human readable (as I may 
have large arrays assigned to some of the keys). I did investigate using 
JLD but looks like it stores file in HDF5 format, which is not human 
readable/editable. 

On Saturday, November 21, 2015 at 2:21:47 AM UTC-8, Eric Forgy wrote:
>
> Is JSON an option for you? That was my first thought.
>
> Have you seen https://github.com/JuliaLang/JLD.jl ? This is probably the 
> best solution.
>
> On Saturday, November 21, 2015 at 6:11:38 PM UTC+8, Nitin Arora wrote:
>>
>> Found a workable solution using  https://github.com/r2dbg/ConfParser.jl  
>> , but its ugly, with custom code each new variable I ass.
>>
>> A direct read on the text file, similar to NAMELIST feature in Fortran 
>> will be useful. Then we can just update the Dict and it will be able to 
>> read the updated input file seamlessly.
>>
>> thanks,
>> Nitin
>>
>> On Saturday, November 21, 2015 at 1:07:38 AM UTC-8, Nitin Arora wrote:
>>>
>>> Hi All,
>>>
>>> I am creating a text base user-input interface for an optimization 
>>> framework I am developing in Julia. I am relatively new to Julia and have 
>>> only previously programmed in Fortran (mostly) and in C.
>>>
>>> I am planning to read in/out my variables and their corresponding value 
>>> (which can by any type) as key/value pairs of a Dict. This is equivalent to 
>>> Fortran's NAMELIST feature (in a crude way).
>>>  
>>> As an example, I can easily write out a Dict to a text file as below:
>>>
>>> writedlm("test.txt",dd,"=")
>>>
>>> where dd is a example Dict:
>>>
>>> dd = Dict([("A", 0), ("B", false),("C", [199,199,199]) ])
>>>
>>> But when I try to do the inverse (read back the Dict) using the readdlm 
>>> command , I get the following error.
>>>
>>>
>>> f = open("test.txt"
>>>
>>> readdlm(f,dd)
>>>
>>> ERROR: MethodError: `readdlm` has no method matching readdlm(::IOStream, 
>>> ::Dict{ASCIIString,Any})
>>>
>>>
>>> I know, I can use "Regex" but I wanted to see if there is a more 
>>> straight forward way of doing this.
>>>
>>>
>>> Any help is greatly appreciated.
>>>
>>>
>>> thanks,
>>>
>>> Nitin
>>>
>>>
>>>
>>>
>>>

Reply via email to