scala

Is there a Python equivalent for Scala's Option or Either?

Is there a Python equivalent for Scala's Option or Either? Question: I really enjoy using the Option and Either monads in Scala. Are there any equivalent for these things in Python? If there aren’t, then what is the pythonic way of handling errors or “absence of value” without throwing exceptions? Asked By: Melvic Ybanez || …

Total answers: 11

Interpreting a benchmark in C, Clojure, Python, Ruby, Scala and others

Interpreting a benchmark in C, Clojure, Python, Ruby, Scala and others Question: Disclaimer I know that artificial benchmarks are evil. They can show results only for very specific narrow situation. I don’t assume that one language is better than the other because of the some stupid bench. However I wonder why results is so different. …

Total answers: 13

Simple, hassle-free, zero-boilerplate serialization in Scala/Java similar to Python's Pickle?

Simple, hassle-free, zero-boilerplate serialization in Scala/Java similar to Python's Pickle? Question: Is there a simple, hassle-free approach to serialization in Scala/Java that’s similar to Python’s pickle? Pickle is a dead-simple solution that’s reasonably efficient in space and time (i.e. not abysmal) but doesn’t care about cross-language accessibility, versioning, etc. and allows for optional customization. What …

Total answers: 5

Slice notation in Scala?

Slice notation in Scala? Question: Is there something similar to the slice notation in Python in Scala? I think this is really a useful operation that should be incorporated in all languages. Asked By: Emil || Source Answers: See the ScalaAPI here So not the same notational convenience, but the operation is there def slice …

Total answers: 4

Abstract attributes in Python

Abstract attributes in Python Question: What is the shortest / most elegant way to implement the following Scala code with an abstract attribute in Python? abstract class Controller { val path: String } A subclass of Controller is enforced to define “path” by the Scala compiler. A subclass would look like this: class MyController extends …

Total answers: 13

Scala equivalent to Python generators?

Scala equivalent to Python generators? Question: Is it possible to implement in Scala something equivalent to the Python yield statement where it remembers the local state of the function where it is used and “yields” the next value each time it is called? I wanted to have something like this to convert a recursive function …

Total answers: 5

Which programming languages can I use on Android Dalvik?

Which programming languages can I use on Android Dalvik? Question: In theory, Dalvik executes any virtual machine byte code, created for example with the compilers of AspectJ ColdFusion Clojure Groovy JavaFX Script JRuby Jython Rhino Scala Are there already working versions of bytecode compilers for Dalvik available for other languages than Java? Asked By: mjn …

Total answers: 8