Guest User

Untitled

a guest
Sep 22nd, 2016
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. w n=('0'<$[2..length a])++a where a=show n
  2. x s=tail.foldr(\a b->s:a++b)""
  3. ms n(r,s)|n`mod`2^(r+1)`div`2^r>0=s|1<2=""
  4. tm n=x ':'[w$n`div`2^11,w$n`mod`2^11`div`32,w$2*n`mod`64]
  5. dt n=x '/'[w$1980+n`div`2^9,w$n`mod`2^9`div`32,w$n`mod`32]
  6. k=snd.span(==' ')
  7. y a|all(==' ')a=""|1<2='.':k a
  8. nm=(\(a,b)->k a++y b).splitAt 8
  9. pa s=x ' '[nm.map(toEnum.v.take 8).takeWhile(not.null)$iterate(drop 8)a,t,dt$v i,tm$v g,dt$v o,tm$v m,show u]where{z n=splitAt(8*n);(a,b)=z 11 s;(c,d)=z 1 b;(e,f)=z 2 d;(g,h)=z 2 f;(i,j)=z 2 h;(k,l)=z 4 j;(m,n)=z 2 l;(o,p)=z 2 n;(q,r)=z 2 p;t=(zip[0..](words"RO H S VL SD A")>>=).ms$v c;u|any(`elem`t)"LD"=0|1<2=v r;v=foldl((+).(2*))0.map(read.pure)
  10. main=interact pa
RAW Paste Data