Skip to content

Instantly share code, notes, and snippets.

View SethTisue's full-sized avatar

Seth Tisue SethTisue

View GitHub Profile
sealed trait HardCore extends Core[Nothing]
object HardCore {
case class Super(i: Int) extends HardCore
case class Slot(i: Int) extends HardCore
case class LitInt(i: Int) extends HardCore
case class LitInt64(l: Long) extends HardCore
case class LitByte(b: Byte) extends HardCore
case class LitShort(s: Short) extends HardCore
case class LitString(s: String) extends HardCore
case class LitChar(c: Char) extends HardCore
"Smokescreen" by Desperate Bicycles
please send corrections to seth@tisue.net
bringing good news on a fast train
bringing fast news on a goods train
they're running (?) sometime after midnight (somebody?)
all covered in dirt
and I had nothing but a good deal
and I had a good deal full of nothing
Welcome to Scala version 2.10.2
scala> val x: Any = "foo"
x: Any = foo
scala> val y: String = x.asInstanceOf
java.lang.ClassCastException: java.lang.String cannot be cast to scala.runtime.Nothing$
@SethTisue
SethTisue / sham-shack.txt
Last active December 23, 2015 09:58
my best guess at the lyrics to “Sham Shack” by Ut
This holly
Faces blank in focus
Center of attention
Displacement of the dance
Fog in the square
Did anybody notice
The houses on the outside
Bruised (?) from abutment
There are houses on the inside
Sink in a cushion
@SethTisue
SethTisue / 2014.txt
Created February 4, 2014 20:26
NE Scala 2014 talk winners
the people have spoken
45-minute talks:
- Heather Miller, “Academese to English: Scala's Type System, Dependent Types and What It Means To You”
- Daniel Spiewak, “May Your Data Ever Be Coherent”
- Eugene Burmako & Lars Hupel, “Macros vs. Types”
30-minute talks:
- Eugene Yokota, “Learning Scalaz”
- P. Oscar Boykin, “Summingbird: a streaming map-reduce API for Storm, Hadoop and more”
@SethTisue
SethTisue / gist:8977033
Last active November 27, 2018 21:16
Example of `lazy val` inside `implicit class`
// `lazy val` inside `implicit class`
implicit class RichStream[T](s: Stream[T]) {
lazy val circular: Stream[T] =
s #::: circular
}
// in order to make this work with `extends AnyVal`, you have to make the
// lazy val local, as follows:
@SethTisue
SethTisue / gist:8980701
Created February 13, 2014 18:18
Six NetLogo-based papers in latest JASSS
The Journal of Artificial Societies and Social Simulation
Volume 17, Number 1, January 2014
Agent-Based Simulation of Pedestrian Behaviour in Closed Spaces: A Museum Case Study
http://jasss.soc.surrey.ac.uk/17/1/16.html
"Both the code and the interface of our model have been originally developed by us within the NetLogo software environment"
Agent-Based Simulation of the Search Behavior in China's Resale Housing Market: Evidence from Beijing
http://jasss.soc.surrey.ac.uk/17/1/18.html
"NetLogo requires less computational power and offers multiple visible extensions (Wilensky 1999), so we develop our housing market simulation model based on NetLogo"
@SethTisue
SethTisue / gist:9013595
Created February 15, 2014 02:18
SleepAdd in NetLogo
to-report add [a b]
reset-timer
wait a
wait b
report timer
end
observer> show add 2 2
observer: 4
observer> show add 2 2
// pseudo-Scala with nonexistent "yield" in while
val generator =
while(true) {
val in = readLine()
if (in == null)
break
yield in
}
% cd /usr/local/nescala
% echo full details at nescala.org (mobile-friendly)
zsh: number expected
% scala
Welcome to Scala
scala> :power
** Power User mode enabled
scala> ^Z
zsh: suspended scala