Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: Problematic...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 2797 of 2842
Post > Topic >>

Re: Problematic data structure in functional language

by "Geoff. Dash" <nospam@[EMAIL PROTECTED] > Mar 16, 2008 at 12:40 PM

Francis wrote:
> I am trying to build an efficient data structure for representing
> boolean expressions in Erlang. I am having trouble producing a good
> data structure in a functional context, although there are very fast
> data structures for imperative languages like C. The data structure is
> to be used for a functional SAT solver.

snip

> Alternately we could represent the expression as a list of lists where
> just the variable name and negation are recorded {name,negation} and
> have the assignment values stored as a separate mapping. This makes
> assignments fast and safer, but we still need to traverse every
> sublist to see that it does not now contain a literal evaluating to
> true. Is there a better way, I suspect that I am thinking about it in
> the wrong way. Thanks.

I haven't implemented this, but:

Construct a set of pairs of indexes, one pair for each variable - One 
for the variable and one for its negation.

Pre-process your expression, assigning each sub-expression a unique id 
and store those ids in each index that corresponds to a variable (or 
negation) in the sub-expression.

You now have a list of ids and a set of indexes.  For each trial 
assignment pass over the list removing all ids in the appropriate index, 
no re-examination of the sub-expressions required.

Regards,

Geoff.




 2 Posts in Topic:
Problematic data structure in functional language
Francis <francisstephe  2008-03-12 13:32:31 
Re: Problematic data structure in functional language
"Geoff. Dash" &  2008-03-16 12:40:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:39:35 CDT 2008.