Hi, I'm Jess. I use Python to craft web apps and sift data. I'm honing my full-stack development chops on Author Alcove.

I found a few other sites out there that are writing about Scala and Project Euler: Dianne Marsh’s Blog Memetic Musings Blok Blogs

Nice. Thanks. :) Pak Tam

How does this filter out the multiples of 15? Does FoldLeft remove duplicates?

(1 until 1000).filter(n => n % 3 == 0 || n % 5 == 0).foldLeft(0)(_ + _)

@Jim H In that case we don’t need to subtract the multiples of 15 because they aren’t counted twice like they were in the first example. When foldLeft operates on the range, there is only one instance of 15 in the range.

Scala seems like messy Python. I probably need to look into it more though

Name (required)

Email (required)

Website

Cancel Reply

Notify me of follow-up comments by email.

Notify me of new posts by email.

## 5 Comments

## Jess Johnson

Tuesday, September 1636, 2008I found a few other sites out there that are writing about Scala and Project Euler:

Dianne Marsh’s Blog

Memetic Musings

Blok Blogs

## Pak Tam

Sunday, September 2850, 2008Nice. Thanks. :) Pak Tam

## Jim H

Monday, September 2901, 2008How does this filter out the multiples of 15? Does FoldLeft remove duplicates?

(1 until 1000).filter(n => n % 3 == 0 || n % 5 == 0).foldLeft(0)(_ + _)

## Jess Johnson

Monday, September 2914, 2008@Jim H In that case we don’t need to subtract the multiples of 15 because they aren’t counted twice like they were in the first example. When foldLeft operates on the range, there is only one instance of 15 in the range.

## G

Tuesday, November 444, 2008Scala seems like messy Python. I probably need to look into it more though