This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(; program to build houses and cities | |
(val do-nothing unit) | |
(def even (n) (eq (% n 2) 0)) | |
; build a pyramid! | |
(defrec pyramid (c m) | |
(begin | |
(cube:set-walls c m) | |
(let (closed (lam (c) (or (<= (- (.maxX c) (.minX c)) 1) (<= (- (.maxZ c) (.minZ c)) 1)))) | |
(unless (closed c) (pyramid (.shiftY (.shrinkIn c 1) 1) m)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Our next PL/SE Lunch will be: | |
Day: Tuesday, October 30 | |
Time: Noon to 1:30 | |
Place: 32-D463 (Star) | |
The speaker is Xipeng Shen. | |
Title: Do Computer Programs Have to Be As Dumb As They Are? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val utf8 = Write.utf8 | |
def stringF(s: Source): String = { | |
val n = Read.intF(s) | |
val buf = s.readBytes(n) | |
val cbuf = utf8.decode(java.nio.ByteBuffer.wrap(buf)).array | |
new String(cbuf) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
` | |
PatchesOwn.init(2) | |
world = new World(-5, 5, -5, 5); | |
function SETUP () { | |
world.clearall() | |
//AgentSet.ask(world.patches(), function(){ AgentSet.setPatchVariable(5,false) }) | |
//AgentSet.ask(Prims.patch(0, 0), function(){ AgentSet.setPatchVariable(5,true) }) | |
//AgentSet.ask(Prims.patch(-1, 0), function(){ AgentSet.setPatchVariable(5,true) }) | |
//AgentSet.ask(Prims.patch(0, -1), function(){ AgentSet.setPatchVariable(5,true) }) | |
AgentSet.ask(Prims.patch(0, 1), function(){ AgentSet.setPatchVariable(5,true) }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance Arbitrary Assoc where | |
arbitrary = Test.QuickCheck.elements [L, R, N] | |
genPrecedence = choose (0, 9) :: Gen Int | |
instance Arbitrary Fixity where | |
arbitrary = | |
oneof [ liftM2 Infix arbitrary genPrecedence, | |
liftM Prefix genPrecedence, | |
liftM Postfix genPrecedence, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Downloading the latest package list from hackage.haskell.org | |
Note: there is a new version of cabal-install available. | |
To upgrade, run: cabal install cabal-install | |
Resolving dependencies... | |
cabal: Could not resolve dependencies: | |
trying: ermine-0.6 (user goal) | |
next goal: void (dependency of ermine-0.6) | |
rejecting: void-0.5.12/installed-9b2... (conflict: ermine => void>=0.6 && <1) | |
trying: void-0.6 | |
trying: trifecta-1.0/installed-999... (dependency of ermine-0.6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Scope[+B,F[+_],+A] | |
trait ForallW[F[_]] { def apply[A](pa: A => Unit): F[A] => Unit } | |
def putScope[B, F[_], V]( | |
pb: B => Unit, | |
pf: ForallW[F], | |
pv: V => Unit): Scope[B, F, V] => Unit = (s:Scope[B, F, V]) => { | |
() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit def varEqual1[A:Equal]: Equal1[({type λ[α] = Var[A,α]})#λ] = new Equal1[({type λ[α] = Var[A,α]})#λ] { | |
def equal[B](a1: ({type λ[α] = Var[A,α]})#λ[B], a2: ({type λ[α] = Var[A,α]})#λ[B])(implicit a: Equal[B]): Boolean = | |
implicitly[Equal[({type λ[α] = Var[A,α]})#λ[B]]].equal(a1, a1) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait HardCore extends Core[Nothing] | |
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 | |
case class LitFloat(f: Float) extends HardCore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intro: E, D (8x) | |
E A-ish* E A-ish* *I could use a little help here, but it sounds good enough | |
Washington crossed the Delaware River | |
E A A B | |
Washington acted like a Rock Star | |
E A E A | |
Washington made America deliver | |
E A A B | |
Washington tried to be a Rock Star |