Repository for the course: Advanced programming (adpro)
scala-cli test .scala-cli test . -- -f <exercise-name>scala-cli repl .Afterwards import necessary classes.
Often importing adpro.* is needed, thus write:
import adpro.<exercise-name>.*When running something in REPL and you want to check if the probability is correct, you can use the following:
import pigaro.*
val res = <your-expression>.sample(n)
println(res.pr(<your-condition>))In 10-prob the specific commands run were:
import pigaro.*
val res = pick(1000)
println(res.pr(Black))
println(res.pr(Red))Something about that if it says given somewhere you probably need to use with instead of =.
I have no idea why.
Often you can use below to import necessities to create a quick LazyList:
import adpro.laziness.LazyList.*
val testLazyList = from(4).take(2)To test a parser quick parser you have to import necessities and run the following:
import adpro.parsing.*
import adpro.parsing.Sliceable.*
<specific parser>.run(<some string>)Ensure imports and what the other thing is:
import pigaro.*
given rng: spire.random.rng.SecureJava = spire.random.rng.SecureJava.applyRun following to test uniform distribution:
val samples = <func>.sample(10000)
samples.pr(<option 1>)