Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2960

This challenge is related to the Scala language. Note that challenges that require the answers to be in a specific language are generally discouraged.

10 votes

Tips for golfing in Scala

Use infix syntax to remove the need for . characters. You don't need spaces unless adjacent items are both in alphanumeric or both in operator characters (see here), and not separated by reserved char …
Luigi Plinge's user avatar
10 votes

Tips for golfing in Scala

You can usually use map instead of foreach: List("a","b","c") foreach println can be replaced with List("a","b","c") map println The only difference is the return type (Unit vs List[Unit]), whic …
Luigi Plinge's user avatar
14 votes

Tips for golfing in Scala

The shortest way of repeating something is with Seq.fill. 1 to 10 map(_=>println("hi!")) // Wrong! for(i<-1 to 10)println("hi!") // Wrong! Seq.fill(10)(println("hi!")) // Right!
Luigi Plinge's user avatar