How to parse argv in prolog -


when i'm trying pass list prolog program, string in argv. need recover list somehow string or find way pass list. thanks.

edit: i've tried opt_arguments, got error:

"error: validate_opts_spec/1: type error: flag_value' expected, found term' (an atom) (unknown type 'term' in option 'transactions')".

on linux:

$ swipl [a,b,c] welcome swi-prolog (threaded, 64 bits, version 7.5.1-31-gd53ee81) ... 

and then

?- current_prolog_flag(argv, argv),argv=[l|_],atom_to_term(l,t,[]). argv = ['[a,b,c]'], l = '[a,b,c]', t = [a, b, c]. 

after @boris comment, here better way, in sense covers both cases

$ swipl [a, b, c] welcome swi-prolog (threaded, 64 bits, version 7.5.1-31-gd53ee81) ... ?- current_prolog_flag(argv, argv),atomic_list_concat(argv,atom),atom_to_term(atom,term,[]). argv = ['[a,', 'b,', 'c]'], atom = '[a,b,c]', term = [a, b, c]. 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -