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

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

Expand Messages
  • Fabrice Marchant
    Jan 10, 2008
    • 0 Attachment
      Hi Eric !

      > 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

      As far as I understand that is really beautiful.

      > 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
      Nice idea to use ascii codes : 2 chars instead of 3, eight times !


    • Show all 20 messages in this topic