PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: vaskoz/dailycodingproblem-go (go)

Issue:
Day 222
Good morning! Here's your coding interview problem for today.

This problem was asked by Quora.

Given an absolute pathname that may have . or .. as part of it, return the shortest standardized path.

For example, given `"/usr/bin/../bin/./scripts/../"`, return `"/usr/bin/"`.

Pull request:
Day222
Resolves #458.

Patch:
diff --git a/README.md b/README.md
index 3b06fbe..33dcb98 100644
--- a/README.md
+++ b/README.md
@@ -232,3 +232,4 @@ problems from
 * [Day 219](https://github.com/vaskoz/dailycodingproblem-go/issues/452)
 * [Day 220](https://github.com/vaskoz/dailycodingproblem-go/issues/453)
 * [Day 221](https://github.com/vaskoz/dailycodingproblem-go/issues/454)
+* [Day 222](https://github.com/vaskoz/dailycodingproblem-go/issues/458)
diff --git a/day222/problem.go b/day222/problem.go
new file mode 100644
index 0000000..683b230
--- /dev/null
+++ b/day222/problem.go
@@ -0,0 +1,22 @@
+package day222
+
+import (
+	"fmt"
+	"strings"
+)
+
+// ShortestStandardizedPath returns the shortest standardized path.
+func ShortestStandardizedPath(path string) string {
+	parts := strings.Split(path, "/")
+	var result []string
+	for _, part := range parts {
+		if part == ".." {
+			result = result[:len(result)-1]
+		} else if part == "." {
+			continue
+		} else {
+			result = append(result, part)
+		}
+	}
+	return fmt.Sprintf("%s", strings.Join(result, "/"))
+}


Test patch:
diff --git a/day222/problem_test.go b/day222/problem_test.go
new file mode 100644
index 0000000..dc1eecf
--- /dev/null
+++ b/day222/problem_test.go
@@ -0,0 +1,28 @@
+package day222
+
+import "testing"
+
+var testcases = []struct {
+	path, expected string
+}{
+	{"/usr/bin/../bin/./scripts/../", "/usr/bin/"},
+	{"/usr/bin/../bin/./scripts/../foobar.txt", "/usr/bin/foobar.txt"},
+	{"/usr/bin/../../bin/./scripts/foobar.txt", "/bin/scripts/foobar.txt"},
+}
+
+func TestShortestStandardizedPath(t *testing.T) {
+	t.Parallel()
+	for _, tc := range testcases {
+		if result := ShortestStandardizedPath(tc.path); result != tc.expected {
+			t.Errorf("Expected %v, got %v", tc.expected, result)
+		}
+	}
+}
+
+func BenchmarkShortestStandardizedPath(b *testing.B) {
+	for i := 0; i < b.N; i++ {
+		for _, tc := range testcases {
+			ShortestStandardizedPath(tc.path)
+		}
+	}
+}
Repository: rcardin/raise4s (scala)

Issue:
Add a bind function for `List[Either[E, A]]`
Add a bind function for `List[Either[E, A]]` to `List[A] raises E`.

Pull request:
Closes #25

Patch:
diff --git a/README.md b/README.md
index 43f0d9e..dbd8005 100644
--- a/README.md
+++ b/README.md
@@ -254,6 +254,13 @@ val three = Raise.either {
 
 The `value` function calls the `raise` function if the `Either` instance is a `Left`; otherwise, it returns the value wrapped by the `Right` instance. Despite the trivial logic implemented in the above example, it's a good example of how to compose functions that return an `Either[E, A]` using the Raise DSL without the use of any `flatMap` function.
 
+A useful shortcut is available when we need to transform a `List[Either[E, A]]` into a `List[A] raises E`. The eventual raised error `E` is the first error found in the list of `Either[E, A]`:
+
+```scala 3
+val eitherList: List[Either[String, Int]] = List(Right(1), Left("error"), Right(3))
+val raiseList: List[Int] raises String = listWithError.value
+```
+
 Be aware that before version 0.0.5, the `value` function was called `bind()`.
 
 We can do the same with `Try[A]` and `Option[A]` using the `asTry` and `option` builders, respectively. Let's start with the `asTry` builder. In this case, the only available type of error is `Throwable`:
diff --git a/src/main/scala/in/rcard/raise4s/Bind.scala b/src/main/scala/in/rcard/raise4s/Bind.scala
index 8508bb6..07b28e7 100644
--- a/src/main/scala/in/rcard/raise4s/Bind.scala
+++ b/src/main/scala/in/rcard/raise4s/Bind.scala
@@ -9,6 +9,9 @@ object Bind {
       case Right(value) => value
       case Left(error)  => Raise.raise(error)
     }
+    
+  extension [Error, A](list: List[Either[Error, A]])
+    def value(using Raise[Error]): List[A] = list.map(_.value)
 
   extension [A](option: Option[A])
     def value(using Raise[None.type]): A = option match {


Test patch:
diff --git a/src/test/scala/in/rcard/raise4s/BindTest.scala b/src/test/scala/in/rcard/raise4s/BindTest.scala
index 1e66df3..b9cc87b 100644
--- a/src/test/scala/in/rcard/raise4s/BindTest.scala
+++ b/src/test/scala/in/rcard/raise4s/BindTest.scala
@@ -46,4 +46,17 @@ class BindTest extends AnyFlatSpec with Matchers {
 
     actual should be(Success(2))
   }
+
+  "List[Either[Error, A]].value" should "return a value if the list doesn't contain errors and raise an error otherwise" in {
+    val list: List[Either[String, Int]] = List(Right(1), Right(2), Right(3))
+    val listWithError: List[Either[String, Int]] = List(Right(1), Left("error"), Right(3))
+
+    val actual = Raise.either {
+      val x = list.value
+      val y = recover({ listWithError.value }) { _ => List(1) }
+      x.sum + y.sum
+    }
+
+    actual should be(Right(7))
+  }
 }