Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

One Line Factorial

Name: Anonymous 2009-06-15 15:56

for(int a1=1,a2=1,i=scanf_s("%d",&i)+i-1;(i--)>2; a1=(a2+=a1)-a1,(i==2)?printf_s("Result=%d\n",a2):NULL)

Name: Anonymous 2009-06-16 18:51

>>9
I'm having trouble running it, what's going on here?

% ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude>
Prelude>
Prelude>     fact x = product [1..x]

<interactive>:1:7: parse error on input `='
Prelude> let fact x = product [1..x]
Prelude> fact 7
* Exception: Stack overflow

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List