Snip2Code - Example smart constructor in Scala [PDF]

Sep 11, 2015 - Example smart constructor in Scala: DayOfWeek.scala.

4 downloads 27 Views 144KB Size

Recommend Stories


Manualul inginerului constructor pdf
Courage doesn't always roar. Sometimes courage is the quiet voice at the end of the day saying, "I will

PdF Scala Cookbook
And you? When will you begin that long journey into yourself? Rumi

Parallel Programming in Scala
Your big opportunity may be right where you are now. Napoleon Hill

14 Veicolo in Scala
Come let us be friends for once. Let us make life easy on us. Let us be loved ones and lovers. The earth

Scala Sockelleisten Scala Skirts
You often feel tired, not because you've done too much, but because you've done too little of what sparks

Code Cube Constructor
So many books, so little time. Frank Zappa

Smart Cities in India [PDF]
distance from Mumbai(150 km), is also one of India's major cities. Pune is renowned for its educational .... feasibility study of Pune-Mumbai-Ahmedabad corridor is now complete, with detailed surveys to be ..... Consultants Engaged in GIFT. • Desig

JavaCard APDU example pdf
Everything in the universe is within you. Ask all from yourself. Rumi

Example paper 2 in pdf format
Don’t grieve. Anything you lose comes round in another form. Rumi

Beaufort Scala
Come let us be friends for once. Let us make life easy on us. Let us be loved ones and lovers. The earth

Idea Transcript


Explore Channels Plugins & T ools Pro Login



RE P O RT

by Rob O'Doherty @ Rob O'D…

Example smart constructor in Scala

3

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

2,088

1

Top 1% !

Example smart constructor in Scala: DayOfWeek.scala post this code

A DD S NI P P E T

ASK

1

About Us

Famous Specified EMBED

C O PY C O D E

F U LL SC R EEN

sealed trait DayOfWeek { val value: Int /* * Core Abstraction */ override def toString = value match { case 1 => "Monday" case 2 => "Tuesday" case 3 => "Wednesday" case 4 => "Thursday" case 5 => "Friday" case 6 => "Saturday" case 7 => "Sunday" } } /* * The companion object or the module */ object DayOfWeek { private def unsafeDayOfWeek(d: Int) = new DayOfWeek { val value = d } private val isValid: Int => Boolean = { i => i >= 1 && i

Smile Life

When life gives you a hundred reasons to cry, show life that you have a thousand reasons to smile

Get in touch

© Copyright 2015 - 2024 PDFFOX.COM - All rights reserved.