diff options
| author | Hans Svensson <[email protected]> | 2014-01-23 09:41:55 +0100 | 
|---|---|---|
| committer | Hans Svensson <[email protected]> | 2014-01-24 22:55:56 +0100 | 
| commit | 6dd785c831ecbc9afcfbd33c604c7fc327e94c28 (patch) | |
| tree | 2f5049592ff5dabc8581432b12e240e9f6ea6020 /lib/compiler/src/v3_kernel.erl | |
| parent | 875b58c8119858676af0139b0f6b69537cae5706 (diff) | |
| download | otp-6dd785c831ecbc9afcfbd33c604c7fc327e94c28.tar.gz otp-6dd785c831ecbc9afcfbd33c604c7fc327e94c28.tar.bz2 otp-6dd785c831ecbc9afcfbd33c604c7fc327e94c28.zip | |
Import and use lists:droplast/1 in v3_core/v3_kernel
Also imported lists:last/1, and removed the local definition.
Diffstat (limited to 'lib/compiler/src/v3_kernel.erl')
| -rw-r--r-- | lib/compiler/src/v3_kernel.erl | 13 | 
1 files changed, 2 insertions, 11 deletions
| diff --git a/lib/compiler/src/v3_kernel.erl b/lib/compiler/src/v3_kernel.erl index 65f1251099..4a4900d0e1 100644 --- a/lib/compiler/src/v3_kernel.erl +++ b/lib/compiler/src/v3_kernel.erl @@ -81,7 +81,7 @@  -export([module/2,format_error/1]).  -import(lists, [map/2,foldl/3,foldr/3,mapfoldl/3,splitwith/2,member/2, -		keymember/3,keyfind/3,partition/2]). +		keymember/3,keyfind/3,partition/2,droplast/1,last/1]).  -import(ordsets, [add_element/2,del_element/2,union/2,union/1,subtract/2]).  -import(cerl, [c_tuple/1]). @@ -347,7 +347,7 @@ expr(#c_case{arg=Ca,clauses=Ccs}, Sub, St0) ->      {Kvs,Pv,St2} = match_vars(Ka, St1),		%Must have variables here!      {Km,St3} = kmatch(Kvs, Ccs, Sub, St2),      Match = flatten_seq(build_match(Kvs, Km)), -    {last(Match),Pa ++ Pv ++ first(Match),St3}; +    {last(Match),Pa ++ Pv ++ droplast(Match),St3};  expr(#c_receive{anno=A,clauses=Ccs0,timeout=Ce,action=Ca}, Sub, St0) ->      {Ke,Pe,St1} = atomic(Ce, Sub, St0),		%Force this to be atomic!      {Rvar,St2} = new_var(St1), @@ -826,15 +826,6 @@ foldr2(Fun, Acc0, [E1|L1], [E2|L2]) ->      foldr2(Fun, Acc1, L1, L2);  foldr2(_, Acc, [], []) -> Acc. -%% first([A]) -> [A]. -%% last([A]) -> A. - -last([L]) -> L; -last([_|T]) -> last(T). - -first([_]) -> []; -first([H|T]) -> [H|first(T)]. -  %% This code implements the algorithm for an optimizing compiler for  %% pattern matching given "The Implementation of Functional  %% Programming Languages" by Simon Peyton Jones. The code is much | 
