32 Matching Annotations
  1. Jul 2021
    1. Uber and Booking.com’s ecosystem was originally JVM-based but they expanded to support Python models/scripts. Spotify made heavy use of Scala in the first iteration of their platform until they received feedback like:some ML engineers would never consider adding Scala to their Python-based workflow.

      Python might be even more popular due to MLOps

    1. “Although a seemingly mundane and simple innovation, Linnaeus' use of index cards marks a major shift in how eighteenth-century naturalists thought about the order of nature,” says Mueller-Wille. The natural world was no longer ordered on a fixed, linear scale, but came to be seen as a map-like natural system of multiple affinities.


      Roughly the idea I'd just written!

      The idea of reordering nature this way would have been fantastic, particularly in light of the general prior order of the cosmos based on the scala naturae or Great Chain of Being.

      Compare this with Ernst Haeckel's Tree of Man. What year was this in relation? Was the idea of broader biological networks and network-like structure thought of prior to this?

  2. Mar 2021
  3. Feb 2021
  4. Dec 2020
    1. By harnessing emotion, the individual can move up the steps of

      the ladder of spiritual betterment."

      This evokes the idea of moving up the scala naturae.

  5. Oct 2020
    1. Finally, and as fundamentally as there is a numerical memory and a dia-lectical memory, there is a geometry of memory too. Almost every monas-tic mnemotechnical scheme—ladders, roses, buildings, maps—was based ongeometrical figures: squares, rectangles, triangles, circles, and complex refor-mations of these, including three-dimensional structures

      She doesn't mention it, but they're not only placing things in order for potential memory purposes, but they're also placing an order on their world as well.

      Ladders and steps were frequently used to create an order of beings as in the scala naturae or the Great Chain of Being.

      Some of this is also seen in Ramon Lull's Ladder of Ascent and Descent of the Mind, 1305 (Ars Magna)

  6. Jun 2020
  7. May 2020
    1. Programming languages These will probably expose my ignorance pretty nicely.

      When to use different programming languages (advice from an Amazon employee):

      • Java - enterprise applications
      • C# - Microsoft's spin on Java (useful in the Microsoft's ecosystem)
      • Ruby - when speed is more important then legibility or debugging
      • Python - same as Ruby but also for ML/AI (don't forget to use type hinting to make life a little saner)
      • Go/Rust - fresh web service where latency and performance were more important than community/library support
      • Haskell/Erlang - for very elegant/mathematical functional approach without a lot of business logic
      • Clojure - in situation when you love Lisp (?)
      • Kotlin/Scala - languages compiling to JVM bytecode (preferable over Clojure). Kotlin works with Java and has great IntelliJ support
      • C - classes of applications (operating systems, language design, low-level programming and hardware)
      • C++ - robotics, video games and high frequency trading where the performance gains from no garbage collection make it preferable to Java
      • PHP/Hack - testing server changes without rebuilding. PHP is banned at Amazon due to security reasons, but its successor, Hack, runs a lot of Facebook and Slack's backends
  8. Mar 2020
  9. Mar 2018
    1. Mixin’ traits ‘statically’

      静态的 mixin a trait 是说:这个 trait 的成员(method, field) 可以有一个 default implementation. 这样你 mixin 这个 trait 的时候,可以只提供那些没有 Implementation 的抽象函数。 当然也可以都自己实现一遍。

    2. val singingPerson = new Person with Singerperson.sing

      val singingPerson = new Person with Singer 倒是很像 组合

    1. A Scala function that’s created with val is very different than a method created with def.


    2. By all accounts, creating a Scala def method creates a standard method in a Java class

      当你用 def 创建了一个函数,你其实就是创建了一个 java class 中的方法(method)

    3. if i != 0


      if i != 0

      会被 compiler 自动解析为 PF 的 isDefinedAt() 函数,这个函数返回 boolean,用来确定 PF 的定义域。

    4. a val function, all you’re really doing with code like this is assigning a variable name to an anonymous function

      val function like

      val f = (a:Int, b:Int) => a+b

      就是定义了一个 literal function, 然后给他一个名字 : f

    5. A block of code with one or more case expressions is a legal way to define an anonymous function

      用 case 构建 literal function

    1. Ordered特质更像是rich版的Comparable接口

      Ordered 青出于 Comparable 而胜于 Comparable

  10. Sep 2017
    1. echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 sudo apt-get update sudo apt-get install sbt
  11. Jun 2017
    1. Vmay only extenduniversaltraitsTraits in Scala extendAnyRefby default, so value classes cannot extend them. Traitswhich explicitly extendAnyare called universal, they do not extendAnyRefand valueclasses can extend them. Like value classes and for the same reasons, universal traitsneed to be ephemeral.
    2. On line 2,xneeds to be boxed because the expected type of the expression isAnyValand primitives on the JVM do not have a common supertype.
  12. Aug 2016
    1. The stringSingleton() method of the Module object appears to be indistinguishable from a first-class function value. But the appearances are deceptive. The method isn’t free-standing: we could have used this in its body and it would have referred to the Module singleton object, even after the import. And it’s not the method which is passed to map — instead a transient function value is implicitly created to invoke the stringSingleton() method (this is a process known as eta-expansion) and it’s that function-value which is passed to map.
    2. Here the method subtypePolymorphic() has no type parameters, so it’s parametrically monomorphic. Nevertheless, it can be applied to values of more than one type as long as those types stand in a subtype relationship to the fixed Base type which is specified in the method signature — in other words, this method is both parametrically monomorphic and subtype polymorphic.
  13. Dec 2015
    1. Figuring out all subclasses of a class is called Class Hierarchy Analysis, and doing static CHA in a language with dynamic code loading is equivalent to solving the Halting Problem.

      Answer to question:

      Why can't the Scala compiler give pattern matching warning for nonsealed classes/traits?


      one of the goals of Scala is separate compilation and deployment of independent modules, so the compiler simply cannot know whether or not a class is subclass in another module, because it never looks at more than one module.

      Example: ??? When I try it, it seems to work, but this may be because everything I need is already loaded in the same compilation context. A subsequent answer seems to confirm this:

      It can be done (at least for all classes known at compile time), it's just expensive. You'd completely destroy incremental compilation, because everything that contains a pattern match would effectively have to be recompiled every time any other file changed.

  14. Jul 2015
  15. proquest.safaribooksonline.com proquest.safaribooksonline.com

      It would be good if there was a way to do effect-tracking, similar as in ATS, so you could enforce this rather than making it style only. But, not a huge issue either.

    1. Keeping unpure functions clearly named and organized in such a way that they can be easily identified versus pure functions is a common goal of modularizing and organizing Scala applications.
    2. Even though the value given to the match expression has the type Any, the data it is storing was created as an Int. The match expression was able to match based on the actual type of the value, not just on the type that it was given. Thus, the integer 12180, even when given as type Any, could be correctly recognized as an integer and formatted as such.

      This is interesting and I believe quite different from how ATS handles types, aside from the fact that it can't match against non-algebraic datatypes. I think this is probably easier to understand as well, since it appears to not rely on constraint solving in order to determine types.

    3. To prevent errors from disrupting your match expression, use a wildcard match-all pattern or else add enough patterns to cover all possible inputs. A wildcard pattern placed as the final pattern in a match expression will match all possible input patterns and prevent a scala.MatchError from occurring.

      In ATS you can specify 'case+' to denote an exhaustive pattern match and have it type checked (though here in Scala it would look more like 'match+'). There are other variations.

    4. | case

      These vertical bars do not seem to work for me, in either the regular input mode or ":paste" mode.

    5. An alternate form of creating a 2-sized tuple is with the relation operator (->). This is a popular shortcut for representing key-value pairs in tuples:

      Also very Perl-like.

    6. val pattern(amountText) = input

      I find this to be slightly strange syntax and non-functional; it is almost as if pattern is applied as if it were pattern-inverse.