08.02.2015 Views

Programação Funcional e Concorrente com Scheme

Programação Funcional e Concorrente com Scheme

Programação Funcional e Concorrente com Scheme

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

notas de aula - Jerônimo C. Pellegrini<br />

lista-de-strings<br />

(if ( string ( car uma-lista ))<br />

( seleciona-strings ( cdr uma-lista )<br />

( cons ( car uma-lista )<br />

lista-de-strings ))<br />

( seleciona-strings ( cdr uma-lista )<br />

lista-de-strings )))))<br />

Resp. (Ex. 20) — Use um procedimento auxiliar recursivo <strong>com</strong>bine, que implementa os<br />

loops aninhados. Ele deve receber (start end n fun args), onde start e end são o valor<br />

inicial e final do loop, e args é um acumulador <strong>com</strong> os índices calculados anteriormente.<br />

( define <strong>com</strong>bine<br />

( lambda ( start end n fun args )<br />

...))<br />

( define with-<strong>com</strong>binations<br />

( lambda (n k fun )<br />

( <strong>com</strong>bine 0 (+ (- n k) 1) n fun ’())))<br />

Versão Preliminar<br />

60<br />

[ 27 de outubro de 2010 at 15:47 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!