Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. declare Pascal AddList ShiftLeft ShiftRight fun {Pascal N}
  2. if N==1 then [1] else
  3. {AddList {ShiftLeft {Pascal N-1}} {ShiftRight {Pascal N-1}}}
  4. end end
  5.  
  6. fun {ShiftLeft L} case L of H|T then H|{ShiftLeft T}
  7. else [0] end end
  8. fun {ShiftRight L} 0|L end
  9.  
  10. fun {AddList L1 L2} case L1 of H1|T1 then
  11. case L2 of H2|T2 then H1+H2|{AddList T1 T2}
  12. end
  13. else nil end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement