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
grammar org.xtext.example.zebra.Zebra with org.eclipse.xtext.common.Terminals | |
generate zebra "http://www.xtext.org/example/zebra/Zebra" | |
Model: | |
houses+=House*; | |
enum Color: | |
Red | Blue | Green | Yellow | Ivory | |
; |
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
#lang racket | |
(require rackunit | |
"prover.rkt") | |
(check-equal? (resolve '(or P) '(or Q)) 'no-resolvent) | |
(check-equal? (resolve '(or P) '(or (not P))) '(or)) | |
(check-equal? (resolve '(or P (not Q)) '(or Q (not R))) '(or P (not R))) | |
(test-case |
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
// this script cannot be run at once, each block must be run separately | |
// relates seed to nearest cluster | |
MATCH (s:Seed), (c1:Centroid{index: 1, iteration: 1}), (c2:Centroid{index: 2, iteration: 1}), (c3:Centroid{index: 3, iteration: 1}) | |
SET s.distC1 = (s.area - c1.area)^2 + (s.perimeter - c1.perimeter)^2 + (s.compactness - c1.compactness)^2 + (s.kernelLength - c1.kernelLength)^2 + (s.kernelWidth - c1.kernelWidth)^2 + (s.asymmetryCoefficient - c1.asymmetryCoefficient)^2 + (s.kernelGrooveLength - c1.kernelGrooveLength) | |
SET s.distC2 = (s.area - c2.area)^2 + (s.perimeter - c2.perimeter)^2 + (s.compactness - c2.compactness)^2 + (s.kernelLength - c2.kernelLength)^2 + (s.kernelWidth - c2.kernelWidth)^2 + (s.asymmetryCoefficient - c2.asymmetryCoefficient)^2 + (s.kernelGrooveLength - c2.kernelGrooveLength) | |
SET s.distC3 = (s.area - c3.area)^2 + (s.perimeter - c3.perimeter)^2 + (s.compactness - c3.compactness)^2 + (s.kernelLength - c3.kernelLength)^2 + (s.kernelWidth - c3.kernelWidth)^2 + (s.asymmetryCoefficient - c |
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
#lang racket | |
(require 2htdp/universe) | |
(require 2htdp/image) | |
(require lang/posn) | |
(define speed 5) | |
(define (create-snake-scene snake) | |
(place-images (create-rectangles (length snake)) (create-positions snake) (rectangle 500 500 "solid" "white"))) |
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
#lang racket | |
(require pict) | |
(require pict/tree-layout) | |
(define star (scale (bitmap .) 0.3)) | |
(define (green-edge child) (tree-edge #:edge-width 3 #:edge-color "green" child)) | |
(define (ball color) (disk #:color color 20)) |
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
package haar; | |
import javax.imageio.ImageIO; | |
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.image.BufferedImage; | |
import java.awt.image.FilteredImageSource; | |
import java.awt.image.ImageFilter; | |
import java.awt.image.ImageProducer; | |
import java.io.IOException; |
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
package animal; | |
class Animal { | |
class Sound{ | |
final String sound; | |
public Sound(String sound){ | |
this.sound = sound; | |
} |
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
import tkinter as tk | |
import time | |
from tkinter import ttk | |
from threading import Thread | |
import random | |
from multiprocessing import Queue | |
def background_work(queue, rand): | |
time.sleep(rand.random() * 3) | |
msg = rand.random() |
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
data "local_file" "datafil" { | |
filename = "test-input.json" | |
} | |
locals { | |
inputdata = jsondecode(data.local_file.datafil.content) | |
size = length(local.inputdata.times) | |
speed = [for time in local.inputdata.times: [for i in range(1, time + 1): i * (time - i)]] | |
records = [for i in range(0, local.size): sum([for speed in local.speed[i]: speed > local.inputdata.distances[i] ? 1 : 0])] | |
} |
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
module BootstrappedHeap | |
open LazyBinomialHeap | |
let empty = E | |
let isEmpty = function | |
| E -> true | |
| _ -> false | |
let merge h1 h2 = |