erikerlandson/classad_pl — Issue #2: classad interface
Author: erikerlandson
Created: 2012-02-23 22:36:26+00:00
State: open
Labels: notes

% new empty classad:
new_classad(-Classad)

value_type(Value, Type)
types:
integer == integer
float == real
true/false == boolean
error == error
undefined == undefined
atom == string
[...] == list
'[classad]'(M) == classad
abstime(TS, Z) == abstime
date/9 == abstime
reltime(S) == reltime

% assign based on value type of Value, must be some valid type to succeed
assign(Var, Context, Value, -ClassadOut)

assign_integer
assign_real
...
% analogous to lookup_xxx variants below

assign_raw(Var, Context, ExprTree, -ClassadOut)
assign_native(Var, Context, ExprString, -ClassadOut)

% these will always succeed with some result, as long as Var and Context are of proper format:
% algorithm: identify innermost classad from context where Var appears (if any) and evaluate. Basis: evaluate with [], so will be undefined, and flag as not present.
% for not present, should return in Present, or just have predicate fail?
lookup(+Var,+ Context, -Result)
lookup(Var, Context, Result, Type)
lookup(Var, Context, Result, Type, Present)

% for scoping 'other', etc:
lookup(Var, Context, [var1=Context1], Result)
% etc

% to succeed, variable must be present, result must be of appropriate type
lookup_integer(Var, Context, Int
lookup_real
lookup_number
lookup_string
lookup_string_codes
lookup_bool
lookup_abstime
lookup_abstime_sec
lookup_abstime_date
lookup_reltime
lookup_reltime_sec
lookup_list
lookup_classad
lookup_raw