Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

- Code Retreat Graz, Austria 2013 by Peter Kofler 778 views
- TDD and Related Techniques for Non ... by Peter Kofler 420 views
- Concepts of Functional Programming ... by Peter Kofler 1353 views
- The Brutal Refactoring Game (2013) by Peter Kofler 1330 views
- Designing Test Cases for the Gilded... by Peter Kofler 1209 views
- Prime Factors Code Kata (2010) by Peter Kofler 1065 views

879 views

777 views

777 views

Published on

Published in:
Technology

License: CC Attribution License

No Downloads

Total views

879

On SlideShare

0

From Embeds

0

Number of Embeds

35

Shares

0

Downloads

5

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Idiomatic R for Rosetta CodeVienna<-R Meetup II, March 2013 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
- 2. Peter Kofler• Ph.D. (Appl. Math.)• Java et.al. Software Developer for 13 years• „fanatic about code quality“• R “developer” since 2012
- 3. The opinions expressed here are myown and do not necessarily represent those of current or past employers.
- 4. RosettaCode
- 5. Rosetta Code● http://rosettacode.org/● programming chrestomathy site ● solutions to same task ● in many different languages ● demonstrate how languages are similar/different
- 6. R „Easy Picks“● Some basic samples not set, e.g. ● http://rosettacode.org/wiki/Include_a_file#R ● http://rosettacode.org/wiki/Element-wise_operations#R● We should search for them and fix ● now you know where to go in your lunch break (instead of Facebook ;-) ● http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_R
- 7. Solve a Task● before editing the Rosetta Code page ● read the task ● solve it ● check your solution● add your code to web ● hit the preview button ● add descriptions to code● GNU Free Documentation License● http://rosettacode.org/wiki/Rosetta_Code:Solve_a_Task
- 8. <markdown> =={{header|R}}== In R most operations work on vectors and matrices: <lang R># create a 2-times-2 matrix mat <- matrix(1:4, 2, 2)</lang> {{out}} <pre>> mat <- matrix(1:4, 2, 2) [,1] [,2] [1,] 1 3 [2,] 2 4</pre> </markdown>
- 9. Lets See Some Code
- 10. For Review● Arithmetic-geometric mean ● http://rosettacode.org/wiki/Arithmetic-geometric_mean ● http://rosettacode.org/wiki/Arithmetic-geometric_mean#R Is it idiomatic? ●● Fibonacci sequence ● http://rosettacode.org/wiki/Fibonacci_sequence ● http://rosettacode.org/wiki/Fibonacci_sequence#R ● Recursive, iterative or mapping?
- 11. Work in Progress● Zeckendorf number representation● http://rosettacode.org/wiki/Zeckendorf_number_representation● Algorithm: ● get an upper limit on Fibonacci numbers needed to cover number ● return the sequence as digits, sorted descending ● drop leading 0 and convert to String● Is this nice R?
- 12. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Help Needed ● Pythagorean triples ● http://rosettacode.org/wiki/Pythagorean_triples ● I am stuck! ● How to find all tripples with diameter x in a functional way? ● Is this part of Project Euler problems? Oops!
- 13. Thank You
- 14. Peter Kofler @codecopkoflerwww.code-cop.org
- 15. CC Images● Rosetta Stone: http://www.flickr.com/photos/nrbelex/454711486/● Judge Dredd: http://www.flickr.com/photos/eldave/6169431454/● Matrix: http://www.flickr.com/photos/trinity-of-one/20562069/● Questions: http://www.flickr.com/photos/seandreilinger/2326448445/

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment