Hello List,

What would you recommend I do to store a list of 3 values as the value of a
relation in a class?  A class for the list of 3 values or some other better

(class +ALH +Entity)
(rel actual (+Need +Number))         # Actual value
(rel lo (+Need +Number))               # Low value
(rel hi (+Need +Number))               # High value

(dm T (Actual Lo Hi)
   (:= actual Actual)
   (:= lo Lo)
   (:= hi Hi) )

(class +Scores +Entity)
(rel round1 (+Need +ALH))          # Round 1
(rel round2 (+Need +ALH))          # Round 2
(rel round3 (+Need +ALH))          # Round 3

(dm T (Round1 Round2 Round3)
   (:= round1 Round1)
   (:= round2 Round2)
   (:= round3 Round3) )

Then use a helper function as sugar when creating a +Scores object:
(de new-ALH (actual lo hi)
   (new '(+ALH) 'actual actual 'lo lo 'hi hi) )

(new '(+Scores) 'round1 (new-ALH 2 0 5) 'round2 (new-ALH 1 0 5) 'round3
(new-ALH 5 0 5) )

I feel like there's a much simpler way or a more idiomatic method to do
this.  Also, how could I handle floats rather than integers, say to two
places?  With the format function?  Thank you in advance for your help.

Warm regards,
David Bloom

Reply via email to