diff options
author | Camil Staps | 2016-07-03 20:27:36 +0200 |
---|---|---|
committer | Camil Staps | 2016-07-03 20:27:36 +0200 |
commit | 520f25747d17ef651195b8fb98291b1b7a69ab1a (patch) | |
tree | e1de78ca66387eec55ba41deba7797f6892aa9af /ABC | |
parent | readme (diff) |
ProgramStore as array for efficiency
Diffstat (limited to 'ABC')
-rw-r--r-- | ABC/Program.icl | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/ABC/Program.icl b/ABC/Program.icl index 4a34ec6..28416bb 100644 --- a/ABC/Program.icl +++ b/ABC/Program.icl @@ -18,13 +18,10 @@ pc_end :: InstrId -> Bool pc_end i = i < 0 :: Location = I Instruction -:: ProgramStore :== [Location] +:: ProgramStore :== {Location} ps_get :: InstrId ProgramStore -> Instruction -ps_get 0 [I p:_] = p -ps_get _ [] = abortn "ps_get: index too large" -ps_get i [_:ps] = ps_get (i-1) ps +ps_get n p = let (I i) = p.[n] in i ps_init :: [Instruction] -> ProgramStore -ps_init [] = [] -ps_init [i:is] = [I i:ps_init is] +ps_init is = {I i \\ i <- is} |