background preloader

Scala

Facebook Twitter

Learning Scala Macros. Learning to Learn Scala Macros are powerful, but very daunting. I only had time to quickly poke at them in the past, and I always felt overwhelmed. I couldn’t figure out how to modify the existing examples to do what I wanted, even when I thought I wanted to implement something very basic. I finally had a chance to make some sense of them, so I’m sharing some tips I learned along the way. I had a specific goal in mind – I wanted my macro to supply definitions for abstract methods. My macro should generate the equivalent of The idea seemed pretty simple, but I knew there would be a lot to learn about macros before I could make it happen.

(This idea is related to another project of mine, Oleander, which will read data directly from ByteBuffers for a variety of reasons. WARNING This is not a tutorial. First Steps basic project setup simple macro defs a few basics on working with Abstract Syntax Trees (ASTs) At this point, I thought this was going to be a piece of cake. Hope and Despair Not bad!

Macros - Macro Paradise. Eugene Burmako I have always imagined that paradise will be a kind of library. Jorge Luis Borges, “Poem of the Gifts” Macro paradise is a plugin for several versions of Scala compilers. It is designed to reliably work with production releases of scalac, making latest macro developments available way before they end up in future versions Scala. ~/210x $ scalac -Xplugin:paradise_*.jar -Xshow-phases phase name id description ---------- -- ----------- parser 1 parse source into ASTs, perform simple desugaring macroparadise 2 let our powers combine namer 3 resolve names, attach symbols to trees in paradisepackageobjects 4 load package objects in paradise typer 5 the meat and potatoes: type the trees in paradise ... Some features in macro paradise bring a compile-time dependency on the macro paradise plugin, some features do not, however none of those features need macro paradise at runtime.

Sources of macro paradise are available at. GraphX - Spark 1.3.0 Documentation. GraphX is a new component in Spark for graphs and graph-parallel computation. At a high level, GraphX extends the Spark RDD by introducing a new Graph abstraction: a directed multigraph with properties attached to each vertex and edge. To support graph computation, GraphX exposes a set of fundamental operators (e.g., subgraph, joinVertices, and aggregateMessages) as well as an optimized variant of the Pregel API.

In addition, GraphX includes a growing collection of graph algorithms and builders to simplify graph analytics tasks. Migrating from Spark 1.1 GraphX in Spark 1.3.0 contains a few user facing API changes: To improve performance we have introduced a new version of mapReduceTriplets called aggregateMessages which takes the messages previously returned from mapReduceTriplets through a callback (EdgeContext) rather than by return value.

To get started you first need to import Spark and GraphX into your project, as follows: import org.apache.spark. Example Property Graph Join Operators. GraphX | Apache Spark. Graph Analytics With GraphX. In this chapter we use GraphX to analyze Wikipedia data and implement graph algorithms in Spark. The GraphX API is currently only available in Scala but we plan to provide Java and Python bindings in the future. 1. Background on Graph-Parallel Computation (Optional) If you want to get started coding right away, you can skip this part or come back later. From social networks to language modeling, the growing scale and importance of graph data has driven the development of numerous new graph-parallel systems (e.g., Giraph and GraphLab). The same restrictions that enable graph-parallel systems to achieve substantial performance gains also limit their ability to express many of the important stages in a typical graph-analytics pipeline.

These tasks typically require data-movement outside of the graph topology and are often more naturally expressed as operations on tables in more traditional data-parallel systems like Map-Reduce. 2. To get started you first need to import GraphX. 2.1. 2.2. 3. Akka. Typesafe Activator and sbt get you started with the Typesafe Reactive Platform. Typesafe Activator is a single download to get you started building Reactive applications.

To get started, you’ll need a JDK, your favorite editor or IDE, and Activator. Activator includes the sbt build tool, a quick-start GUI, and a catalog of template applications. Jump start development with tutorials and code samples in Activator Activator’s quick-start UI walks you through Typesafe Reactive Platform tutorials and is a hub for developers wanting to build Reactive applications.

Activator updates in real-time with new content from Typesafe and select third parties. Common development patterns are presented through reusable templates that are linked to in-context tutorials explaining step-by-step exactly how things work. Activator’s template catalog grows and evolves dynamically. Activator is powered by the sbt build engine sbt is an interactive build tool with customizable build tasks and an "execute-task-on-file-change" feature, allowing you to focus on writing your code.

Downloads sbt. Play Framework - Build Modern & Scalable Web Apps with Java and Scala. Download the 3.0 Release of the Scala IDE for Eclipse - Scala IDE for Eclipse. If you are new to Eclipse or Scala, watch the Getting Started with the Scala IDE above. The screencast will guide you through the installation of the Scala IDE for Eclipse, and you will also learn how to create and run your first Scala project. If you already know Eclipse and you want to find out more about features available in the Scala IDE, make sure not to miss the Scala IDE Features Overview, on the front page.

A complete list of features is available in the expandable menu on the front page. Highlight Implicits It has never been easier to know where implicits are applied. Implicit Hyperlinking Hold down Ctrl/Cmd and hover over an implicitly converted member to bring up a menu, and click to navigate through the source. Semantic Highlight Identifiers are colored based on their meaning, improving readability. Scala Debugger Stepping through closures and Scala-aware display of debugging information. New Refactorings Source Generators Show Type of Selection Scala JUnit4 Runner Requirements. Setup and use Lift framework 2.4 in Scala IDE 2.0 — Scala IDE 0.1-SNAPSHOT documentation. What is in this guide? This guide will show you how to configure a Lift web application to import it in Scala IDE, how to configure Scala IDE to work with the Lift framework and finally how to develop a Lift web application from inside Scala IDE.

Prerequisites Eclipse 3.7.2 (Indigo) with Scala IDE for Scala 2.9 installed (update site: the getting started page for instructions on how to install Scala IDE.Simple Build Tool sbt 0.11.2 installed.Check the sbt Getting Started Guide for instructions on how to install sbt.Basic knowledge of the Eclipse user interface is required (in this guide).Basic knowledge of the Scala language is required (in this guide).Basic knowledge of the Simple Build Tool (sbt) is required (in this guide).Basic knowledge of the Lift framework is required (in this guide).

Setting up a Lift project Start by creating a basic Lift project Create a file build.sbt with the following contents: Going further Feedback. Lift :: Home. Hadoop Wiki. Scala.js. The Scala Programming Language. Mikeaddison93/scala.