Version: 2022.03.02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.public_domain.java.utils; | |
import java.util.*; | |
import java.util.Map.Entry; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
/** | |
* File: org.public_domain.java.utils.Memoizer.java | |
* <p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//StackOverflow Question: https://stackoverflow.com/q/77362860/501113 | |
//Updated/fixed the 5 code files to incorporate the answer by Turing85: https://stackoverflow.com/users/4216641/turing85 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.public_domain.java.utils; | |
import java.util.NoSuchElementException; | |
import java.util.Objects; | |
import java.util.Optional; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
import java.util.function.Supplier; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.public_domain | |
import zio.console._ | |
import zio.{ExitCode, UIO, URIO, ZIO} | |
import java.io.IOException | |
object PurelyFunctionalHangman extends zio.App { | |
def run(args: List[String]) : URIO[Console, ExitCode] = | |
hangman.exitCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalatags.JsDom.all._ | |
val textAreaInput = | |
textarea.render | |
val buttonExecuteTransform = | |
button("Execute Transform").render | |
val textAreaOutput = | |
textarea.render |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//C1 - Initial Scala solution attempt | |
val lettersToDigitsPrefixSize = 3 | |
val letterToDigits = | |
List( | |
'a' -> List(1, 3, 7, 9), | |
'b' -> List(2, 4, 6, 8), | |
'c' -> List(1, 3, 7, 9), | |
'd' -> List(2, 4, 6, 8), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.public_domain.scrabble | |
import scala.util.{Success, Failure, Random, Try} | |
object Bag { | |
//copy and paste directly from provided URL at "Tile count and value ordered by count" | |
// with "Blank" replaced with "_": | |
// http://scrabblewizard.com/scrabble-tile-distribution/ | |
private val countByTileFull = | |
"""E 12 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
README.txt - DIY Scala Enumeration | |
Copyright (C) 2014-2016 Jim O'Flaherty | |
Overview: | |
Provide in Scala the closest equivalent to Java Enum | |
- includes decorating each declared Enum member with extended information | |
- guarantees pattern matching exhaustiveness checking | |
- this is not available with scala.Enumeration | |
ScalaOlio library (GPLv3) which contains more up-to-date versions of both `org.scalaolio.util.Enumeration` and `org.scalaolio.util.EnumerationDecorated`: |