[Rio-pm] [Golf] Fatorial

Fernando Oliveira fernandocorrea em gmail.com
Segunda Fevereiro 1 05:19:40 PST 2010


minha tacada:

perl -E'$n=$_=6;$_*=$n while--$n;say'

Just another Perl Hacker,
Fernando (SmokeMachine)
http://perl-e.org



Em 1 de fevereiro de 2010 11:17, Daniel de Oliveira Mantovani <
daniel.oliveira.mantovani em gmail.com> escreveu:

> Olá pessoal, ontem eu li no Twitter esse link:
> http://gist.github.com/290978
>
> Entre as coisas que estavam escritas nesse link, tinha algo do tipo
> #code golf programmer
> print(($_=sub{$_[0]?($_[0]*$_->($_[0]-1)):1})->(6))
>
> (Não sei pq isso não está mais lá, ontem estava)
>
> Fazer fatorial usando Perl 5.10.* <
>
> Eu fiz minha tacada:
> perl -E 'sub f{$_[0]<=0?1:f($_[0]-1)*$_[0]}say f(6)'
>
> Que comece o golf :)
>
> --
> "If you’ve never written anything thoughtful, then you’ve never had
> any difficult, important, or interesting thoughts. That’s the secret:
> people who don’t write, are people who don’t think."
> _______________________________________________
> Rio-pm mailing list
> Rio-pm em pm.org
> http://mail.pm.org/mailman/listinfo/rio-pm
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/rio-pm/attachments/20100201/b88ccaf8/attachment.html>


Mais detalhes sobre a lista de discussão Rio-pm