This file contains 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
import scala.actors._ | |
import Actor._ | |
object YoDawg extends App { | |
val leonardo = actor { | |
def yo() { | |
println("yo") | |
reactWithin(1) { | |
case TIMEOUT => dawg() |
This file contains 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
import javax.swing._ | |
import java.awt.{List => _, _} | |
import scala.util.Random | |
import scala.actors._ | |
import Actor._ | |
import java.awt.event._ | |
object ActorContinuationTest extends App { | |
// The GUI |
This file contains 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
library ieee; | |
use ieee.std_logic_1164.all; | |
use std.textio.all; | |
use ieee.std_logic_textio.all; | |
use ieee.std_logic_1164.all; | |
entity Bar is | |
end entity Bar; |
This file contains 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
library ieee; | |
use ieee.std_logic_1164.all; | |
use std.textio.all; | |
use ieee.std_logic_textio.all; | |
use ieee.std_logic_1164.all; | |
entity Foo is | |
end entity Foo; |
This file contains 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
public class Polygon | |
{ | |
// define fields here | |
private int numvertices; | |
Point[] vertices; | |
public Polygon(int numvertices) | |
{ | |
this.numvertices = numvertices; |
This file contains 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
public class Spiral { | |
public static void main(String[] args) { | |
Drawing d = new Drawing(); | |
spiral(d, 4); | |
} | |
static void spiral(Drawing d, int n) { | |
// Base case |
This file contains 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
public class Round { | |
public static void main(String[] args) { | |
System.out.println(round(3.124, 2)); | |
} | |
static double round(double x, int n) { | |
double y = x * tenToN(n); | |
y = Math.round(y); |
This file contains 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
public class Hotel { | |
public static void main(String[] args) { | |
HotelRoom room = new HotelRoom(); | |
room.setGuestName("Joe"); | |
HotelRoom room2 = new HotelRoom(); | |
System.out.println(room.getGuestName()); | |
room.setGuestName("Melissa"); |
This file contains 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
public class Back { | |
public static void main(String[] args) { | |
System.out.println(backRec("cs-111")); | |
} | |
static String back(String x) { | |
String y = ""; | |
for (int i=0; i<x.length(); i++) { |
This file contains 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
public class Triangle { | |
public static void main(String[] args) { | |
Turtle.setSpeed(1000); | |
x(6); | |
} | |
static void x(int n) { | |
if (n == 0) { |