Thanx Alex.

The T appears to act as a function in your first option. Does that act like "If true 
return the cdr then break out of the for loop"?  Would this work correctly if 
something matched twice?  I expect only one match and woulk like the match and break 
behavior.

I could do this in perl, but I wouldn't be building character ;-)

On Wed, Jan 25, 2017 at 08:03:03AM +0100, Alexander Burger wrote:
Hi Joe,

(de account-list
        ("Bank Charge"."Expenses:Bank Fee")         # matches if in last 
position
        ("City Market"."Expenses:Groceries")        # ONLY this line works to 
match
)
(de determine-acct (desc)
        (for x account-list                     # go through account list
                (when (sub? (car x) desc)
                        (cdr x))))                              # on match 
return expense category

The problem is that the loops does not exit upon a match.

You could either do

  (de determine-acct (Desc)
     (for X account-list
        (T (sub? (car X) Desc)
           (cdr X) ) ) )

or use 'find'

  (de determine-acct (Desc)
     (find
        '((X) (sub? (car X) Desc))
        account-list ) )

♪♫ Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

--
Joe Golden --
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe

Reply via email to