Changeset 3526

Show
Ignore:
Timestamp:
05/20/05 20:10:14 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
5107
Message:

* inner take shall not affect outer gather.

Location:
src/Pugs
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Eval.hs

    r3524 r3526  
    400400                munge sub = updateSubPad sub symLast 
    401401            runBody elms $ munge sub 
     402    "gather" -> do 
     403        let [exp] = exps 
     404        sub     <- fromVal =<< evalExp exp 
     405        av      <- newArray [] 
     406        symTake <- genSym "@?TAKE" (MkRef av) 
     407        apply (updateSubPad sub symTake) [] [] 
     408        fmap VList $ readIVar av 
    402409    "loop" -> do 
    403410        let [pre, cond, post, body] = case exps of { [_] -> exps'; _ -> exps } 
  • src/Pugs/Prim.hs

    r3524 r3526  
    2828import Pugs.Types 
    2929import Pugs.Pretty 
    30 import Pugs.Monads 
    3130import Text.Printf 
    3231import Pugs.External 
     
    464463op1 "matches" = op1Cast (VList . matchSubPos) 
    465464op1 "gather" = \v -> do 
    466     av  <- newArray [] 
    467465    evl <- asks envEval 
    468     symTake <- genSym "@?TAKE" (MkRef av) 
    469     enterLex [symTake] $ evl (App (Val v) [] []) 
    470     fmap VList $ readIVar av 
     466    evl (Syn "gather" [Val v]) 
    471467op1 "Thread::yield" = const $ do 
    472468    ok <- tryIO False $ do { yield ; return True }