Miscellany
public text v1 · immutable1.
( define collectEvens
( lambda ( L )
( cond ( ( null? L ) '() )
( ( even? ( car L ) )
( cons ( car L )
( collectEvens ( cdr L ) )
)
)
( else ( collectEvens ( cdr L ) ) )
)
)
)
2.
( define replace-nth
( lambda ( a b c )
( cond ( ( = a 1 ) ( cons b ( cdr c ) ) )
( else ( cons ( car c ) ( replace-nth ( - p 1 ) b ( cdr c ) ) ) )
)
)
)
3.
( define consToEnd
( lambda ( a b )
( cond ( ( null? a ) ( cons b '() ) )
( else ( cons ( car b ) ( consToEnd a ( cdr b ) ) ) )
)
)
)