Talk:Sum and product puzzle: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
(→‎Scala: new section)
Line 3: Line 3:
Now that I improved the task description, is this task ready for prime time? --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 14:47, 5 August 2016 (UTC)
Now that I improved the task description, is this task ready for prime time? --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 14:47, 5 August 2016 (UTC)
: I went ahead and took it out of draft status. --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 12:35, 20 August 2016 (UTC)
: I went ahead and took it out of draft status. --[[User:Smls|Smls]] ([[User talk:Smls|talk]]) 12:35, 20 August 2016 (UTC)

== Scala ==

Could someone in the know please explain these two lines in plain English?

val step2 = step0 filter { sumEq(_) forall { prodEq(_).size != 1 }}

step2 contains the pairs whose product is unique and ??
val step3 = step2 filter { prodEq(_).intersect(step2).size == 1 }

Revision as of 08:07, 21 October 2016

Remove draft status?

Now that I improved the task description, is this task ready for prime time? --Smls (talk) 14:47, 5 August 2016 (UTC)

I went ahead and took it out of draft status. --Smls (talk) 12:35, 20 August 2016 (UTC)

Scala

Could someone in the know please explain these two lines in plain English?

val step2 = step0 filter { sumEq(_) forall { prodEq(_).size != 1 }}

  step2 contains the pairs whose product is unique and ??
 

val step3 = step2 filter { prodEq(_).intersect(step2).size == 1 }