Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 27 05:37

    47erbot on sbt-mdoc-2.2.13

    (compare)

  • Nov 27 05:37

    47erbot on master

    Update sbt-mdoc to 2.2.13 (compare)

  • Nov 27 05:37
    47erbot closed #894
  • Nov 27 05:31
    github-actions[bot] labeled #895
  • Nov 27 05:31
    github-actions[bot] labeled #894
  • Nov 27 05:31
    47erbot opened #895
  • Nov 27 05:31

    47erbot on cats-core-2.3.0

    Update cats-core to 2.3.0 (compare)

  • Nov 27 05:31

    47erbot on sbt-mdoc-2.2.13

    Update sbt-mdoc to 2.2.13 (compare)

  • Nov 27 05:31
    47erbot opened #894
  • Nov 25 05:41

    47erbot on master

    Update doobie-core, doobie-hika… (compare)

  • Nov 25 05:41

    47erbot on doobie-core-0.9.4

    (compare)

  • Nov 25 05:41
    47erbot closed #893
  • Nov 25 05:36
    github-actions[bot] labeled #893
  • Nov 25 05:35

    47erbot on doobie-core-0.9.4

    Update doobie-core, doobie-hika… (compare)

  • Nov 25 05:35
    47erbot opened #893
  • Nov 23 05:38

    47erbot on sbt-1.4.4

    (compare)

  • Nov 23 05:38

    47erbot on master

    Update sbt to 1.4.4 (compare)

  • Nov 23 05:38
    47erbot closed #892
  • Nov 23 05:37

    47erbot on testcontainers-scala-postgresql-0.38.7

    (compare)

  • Nov 23 05:37

    47erbot on master

    Update testcontainers-scala-pos… (compare)

hobovsky
@hobovsky
You are right. But working with the code locally in IDE can help a lot.
ashkolyar
@ashkolyar
so whats wrong with this

val c = 'a' //unicode for a
val e = '\"'
val f = '\'

"%c".format(c) should be(
"a"
)
"%c".format(e) should be(
"\""
)
"%c".format(f) should be(
"\"
)

it doesn't even compile
hobovsky
@hobovsky
Yup, it does not
Your literals are incorrect
ashkolyar
@ashkolyar
and yet when i do the following in a worksheet
"%c".format('a')
"%c".format('\"')
"%c".format('\')
i get the correct values of
a " and \
the double quote is the one that's probably wrong
but i don't understand what its expecting
hobovsky
@hobovsky
But is this part which does not compile?
Its expecting a valid string literal
Yours is not
ashkolyar
@ashkolyar
and whats a valid string literal for a double quote
"\"""""""""""
"\"" is a valid string literal for double quote is it not
hobovsky
@hobovsky
This one you got ok
ashkolyar
@ashkolyar
which one nothing i try works
hobovsky
@hobovsky
Why wont you add scalatest and recreate tests locally too?
The one for backslash
ashkolyar
@ashkolyar
but the one for double quote iis wrong
hobovsky
@hobovsky
Backslash is a special character, it must be escaped in string literals
ashkolyar
@ashkolyar
and i tried """""""
three double quotes followed by the double quote followed by three more double quotes
doesn't work
hobovsky
@hobovsky
Are you sure thats the one which is wrong?
ashkolyar
@ashkolyar
well its not "a"
its the same as the question aove
hobovsky
@hobovsky
For a double quote, string literal should be "\"" and character literal is '"' or '\"', cant remember which one exactly
ashkolyar
@ashkolyar
i tried that
"\"" doesnt work
hobovsky
@hobovsky
But for backslash, the last one, you got things wrong i think
ashkolyar
@ashkolyar
"\"
with a double \
surrounded by quotes
hobovsky
@hobovsky
Why dont you use markdown, would be easier to read
"\\"
ashkolyar
@ashkolyar
will do
hobovsky
@hobovsky
You just made me to solve it on a mobile and i hate you a bit :)
Also, the answers id expect to be correct, are accepted
Wha are your answers exactly, like you entered them into placeholders?
"a" - first one
"\"" - second
"\\" - third
ashkolyar
@ashkolyar
that is what i entered to get the tick
issuewas with the third
XiaoJinZi
@xiaojinzi3473
re-write IntSet with Type parameter
abstract class Set[A] {
  def incl(a: A): Set[A]
  def contains(a: A): Boolean
}

class NonEmpty[A <% Ordered[A]](elem: A, left: Set[A], right: Set[A]) extends Set[A]{
  def contains(x: A): Boolean = {
    if (x < elem) left contains x
    else if (x > elem) right contains x
    else true
  }

  def incl(x: A): Set[A] = {
    if (x < elem) new NonEmpty[A](elem, left incl x, right)
    else if (x > elem) new NonEmpty[A](elem, left, right incl x)
    else this
  }
}

class Empty[A <% Ordered[A]] extends Set[A] {
  def contains(a: A): Boolean = false
  def incl(a: A): Set[A] = new NonEmpty[A](a, new Empty[A], new Empty[A])
}