Loading ...
Sorry, an error occurred while loading the content.

9221Re: "ocaml_beginners"::[] Re: JFF: A little Challenge

Expand Messages
  • Fabrice Marchant
    Jan 12, 2008
    • 0 Attachment
      Hi Eric !
      > And here is the 447-byte obfuscated version.
      I only count 446.

      > let(!)(i,f)=f i
      > let r(i,f)=i+1,f
      > let l(i,f)=i-1,f
      > let u(i,f)x=i,fun j->if j=i then x else f j
      > let rec y p v=if!v=0 then v else y p(p v)let a v=u v(!v+1)let s v=u v(!v-1)let o v=output_byte stdout!v;v
      > let n v=u v(input_byte stdin)let f=open_in Sys.argv.(1)let i x=x
      > let($)f g x=g(f x)let rec c()=let k f=f$c()in
      > try match(input_byte f)with|62->k r|60->k l|43->k a|45->k s|46->k o|44->k n|91->k(y(c()))|93->i|_->c()with _->i
      > let _=(c())(0,fun _->0)

      Using Florent's trick "let z=input_byte " 1* +17 and "z" vs "input_byte" - 2* 9 -> -1
      Noticing r$l = i "let i x=x " 1* -10 and "r$l" vs "i" + 2* 2 -> -6

      Things becomes hard to save 7 poor bytes...

      let(!)(i,f)=f i
      let r(i,f)=i+1,f
      let l(i,f)=i-1,f
      let u(i,f)x=i,fun j->if j=i then x else f j
      let rec y p v=if!v=0 then v else y p(p v)
      let a v=u v(!v+1)
      let s v=u v(!v-1)
      let o v=output_byte stdout!v;v
      let z=input_byte
      let n v=u v(z stdin)
      let f=open_in Sys.argv.(1)
      let($)f g x=g(f x)
      let rec c()=let k f=f$c()in
      try match(z f)with
      |62->k r|60->k l|43->k a|45->k s|46->k o|44->k n|91->k(y(c()))|93->r$l|_->c() with _->r$l
      let _=(c())(0,fun _->0)

      439 bytes

      Regards,

      Fabrices
    • Show all 20 messages in this topic