Hailstone sequence: Difference between revisions

Content added Content deleted
(Add CLU)
m (→‎{{header|R}}: Syntax highlighting.)
Line 8,201:
=={{header|R}}==
===Iterative solution===
<lang rrsplus>### PART 1:
makeHailstone <- function(n){
hseq <- n
Line 8,254:
===Vectorization solution===
The previous solution is entirely satisfactory and may be more efficient than the following solution. However, problems like these are a great chance to show off the strength of R's vectorization. Also, this lets us show off how the <- syntax can do multiple variable assignments in one line. Observe how short the following code is:
<lang rrsplus>###Task 1:
collatz<-function(n)
{