Show
Ignore:
Timestamp:
08/20/06 06:48:22 (2 years ago)
Author:
audreyt
Message:

* Implement ($lhs &code) correctly. Previously the

value of $lhs is ignored and only $_'s value is considered.
I wonder who implemented that... ;)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Match.hs

    r12324 r12503  
    105105op2Match :: Val -> Val -> Eval Val 
    106106 
    107 op2Match _ y@(VCode _) = do 
     107op2Match x y@(VCode _) = do 
    108108    (arity :: Int) <- fromVal =<< op1CodeArity y 
    109109    res <- fromVal =<< case arity of 
    110         0 -> evalExp $ App (Val y) Nothing [] 
     110        0 -> do 
     111            writeVar (cast "$*_") x 
     112            evalExp $ App (Val y) Nothing [] 
    111113        1 -> do 
    112              topic <- readVar (cast "$_") 
    113              evalExp $ App (Val y) Nothing [Val topic] 
     114            evalExp $ App (Val y) Nothing [Val x] 
    114115        _ -> fail ("Unexpected arity in smart match: " ++ (show arity)) 
    115116    return $ VBool $ res