サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
Switch 2
www.lihaoyi.com
So, What's So Special About The Mill Scala Build Tool? Mill is a Scala build tool that offers an alternative to the venerable SBT toolchain. Mill aims for simplicity by reusing concepts you are already familiar with, borrowing ideas from Functional Programming and modern tools like Bazel. Feedback from users of Mill is often surprisingly positive, with people saying it is "intuitive" or feels "jus
Scala, first appearing in 2004, is neither an old stalwart nor a new player in the programming language market. This post will discuss the unique combination of features that Scala provides and how it compares to other languages on the market, diving beneath the superficial experience to explore the fundamentals of the language. From this, you will learn why you might consider including Scala as a
A recent tweet by a friend of mine noted how the public interest in the Scala programming language seems to have plateaued or waned, which matches my feeling of the latest trends and zeitgeist. This blog post will go into why I think that has happened, where Scala stands now, and what the future holds for the Scala community. About the Author: Haoyi is a software engineer, and the author of many o
Optimizing compilers are a mainstay of modern software: allowing a programmer to write code in a language that makes sense to them, while transforming it into a form that makes sense for the underlying hardware to run efficiently. The optimizing compiler's job is to figure out what your input program does, and create an output program that it knows will do the same thing, just faster. This post wi
The Visitor Pattern is one of the most mis-understood of the classic design patterns. While it has a reputation as a slightly roundabout technique for doing simple processing on simple trees, it is actually an advanced tool for a specific use case: flexible, streaming, zero-overhead processing of complex data structures. This blog post will dive into what makes the Visitor Pattern special, and why
SBT is the default build tool for the Scala programming community: you can build Scala using other tools, but the vast majority of the community uses SBT. Despite that, nobody seems to like SBT: people say it's confusing, complicated, and opaque. This post will deeply analyze what exactly it is about SBT that people don't like, so we can build a consensus around the problems and a foundation for h
Any software engineer who has ever looked for a job has had the interview experience: being locked in a small room for an hour, asked to write code to solve some arbitrary programming task, while being grilled by one or two interviewers whether or why the code they've written is correct. You can find lots of material online about how to ace the interview as an interviewee, but very little has been
One oft-repeated fact is that in the Scala language, immutable Vectors are implemented using a 32-way trees. This makes many operations take O(log32(n)) time, and given a maximum size of 2^31 elements, it never takes more than 6 steps to perform a given operation. They call this "effectively constant" time. This fact has found its way into books, blog posts, StackOverflow answers, and even the off
Scala is my current favorite general-purpose programming language. However, it definitely has its share of flaws. While some are deep trade-offs in the design of the language, others are trivial, silly issues which cause frustration far beyond their level of sophistication: "warts". This post will explore some of what, in my opinion, are the warts of the Scala programming language, to hopefully ra
There are many descriptions floating around the internet, trying to explain functional programming in simple terms. Unfortunately, most discuss details only loosely related to functional programming, while others focus on topics that are completely irrelevant. So of course, I had to write my own! This post is my own understanding of what is the "core" of "functional programming", how it differs fr
Apart from the old design patterns from the 1990s, the Scala programming language in 2016 has a whole new set of design patterns that apply to it. These are patterns that you see in Scala code written across different organizations, cultures and communities. This blog post will describe some of these design patterns around the use of Scala implicits: specifically around the use of implicit paramet
This post will dive into the runtime characteristics of the Scala collections library, from an empirical point of view. While a lot has been written about the Scala collections from an implementation point of view (inheritance hierarchies, CanBuildFrom, etc...) surprisingly little has been written about how these collections actually behave under use. Are Lists faster than Vectors for what you're
Parsing structured text into data structures has always been a pain. If you are like me, you may have wondered: why do all the parsing tools seem to be parser-generators instead of just configurable-parsers? After all, when you look at, say, a 2D physics library like Chipmunk2D, you just get a bunch of classes and functions you can call. In contrast, parsing libraries like YACC or ANTLR often seem
If you are a front-end engineer looking for a compile-to-JS language in Aug 2016, or a back-end Scala engineer looking for a way to re-use your Scala skills working on the web, the Aug 2016 version of Scala.js paints a pretty attractive picture. In contrast, the Sep 2013 version of Scala.js looks no where near as nice. In fact, if you were an engineer looking at making something "for real" in Sep
Everyone is used to programs printing out output in a terminal that scrolls as new text appears, but that's not all your can do: your program can color your text, move the cursor up, down, left or right, or clear portions of the screen if you are going to re-print them later. This is what lets programs like Git implement its dynamic progress indicators, and Vim or Bash implement their editors that
When programming in Scala, there are two main ways of avoiding repetition: you can define functions to represent commonly-used procedures or computations, and you can define data-types, e.g. using classes or case classes, to represent commonly-used bundles of data that you tend to pass around or use together. Lots of people have opinions about functions: they should be "pure", not too long, not be
A modern replacement for the Bash system shell. Provides a systems shell in the high-level Scala language, letting you seamlessly mix system operations with real code without the hassle or the frustration of trying to write complex code in Bash. If you use Ammonite, you will probably find the follow book by the Author helpful in using Ammonite to the fullest: https://handsonscala.com/ Ammonite is
This post will walk you through an exercise in diving into someone else's code. The goal will be to make an arbitrary change to the code of the Spyder Python IDE, a project I have never touched before in my life, and learn just enough about it to accomplish what I want without getting bogged down. You will learn how to approach problems without the rigour taught in formal education, and instead wi
The Scala language is large and complex, and it provides a variety of tools that a developer can use to do the same thing in a variety of ways. Given the range of possible solutions to every problem, how can a developer choose which one should be used? This is the first in a series of blog posts aiming to provide style guidelines at a "strategic" level. Above the level of "how much whitespace shou
ScalaTags is a small, fast XML/HTML/CSS construction library for Scala that takes fragments in plain Scala code that look like this: // import scalatags.Text.all._ // OR // import scalatags.JsDom.all._ html( head( script(src:="..."), script( "alert('Hello World')" ) ), body( div( h1(id:="title", "This is a title"), p("This is a big paragraph of text") ) ) ) And turns them into HTML like this: <htm
FastParse 2.2.2 Fast to write, Fast running Parsers in Scala import fastparse._, NoWhitespace._ def number[_: P]: P[Int] = P( CharIn("0-9").rep(1).!.map(_.toInt) ) def parens[_: P]: P[Int] = P( "(" ~/ addSub ~ ")" ) def factor[_: P]: P[Int] = P( number | parens ) def divMul[_: P]: P[Int] = P( factor ~ (CharIn("*/").! ~/ factor).rep ).map(eval) def addSub[_: P]: P[Int] = P( divMul ~ (CharIn("+\\-")
Hands-on Scala.js Writing client-side web applications in Scala var x = 0.0 type Graph = (String, Double => Double) val graphs = Seq[Graph]( ("red", sin), ("green", x => abs(x % 4 - 2) - 1), ("blue", x => sin(x/12) * sin(x)) ).zipWithIndex dom.window.setInterval(() => { x = (x + 1) % w; if (x == 0) clear() for (((color, f), i) <- graphs) { val offset = h / 3 * (i + 0.5) val y = f(x / w * 75) * h /
このページを最初にブックマークしてみませんか?
『Haoyi's Programming Blog』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く