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
###################################################### | |
# Algorithmus aus der Vorlesung | |
###################################################### | |
#text= "Die Giraffe trinkt Kaffee."; | |
#sub = "affe"; | |
#i=0; | |
#while i < text.length && text[i,sub.length] != sub do | |
# i = i + 1; | |
#end; |
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
#natRegexp = /(0|[1-9]([0-9])*)/; | |
# Definition einer FUNKTION(!) für natRegexp | |
# Matche natRegexp gegen `str` an Position `pos` | |
def match_0O1Bis90Bis9S(pos,str) | |
# Es kann folgende Unterscheidung für den nächsten Buchstaben gemacht werden: | |
# Matche /0/ gegen `str` an Position `pos` | |
p1 = match_0(pos,str); | |
# Matche /[1-9][0-9]*/ gegen `str` an Position `pos` | |
p2 = match_1Bis90Bis9S(pos,str); |
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
# Definition des regulären Ausdrucks | |
uhrzeitRegexp = /(2[0-3]|[0-1]?[0-9]):[0-5][0-9]/; | |
# Zeichenkette aus Datei "zeitplan.txt" auslesen | |
text = IO.read("zeitplan.txt"); | |
# Matche meinen regulären Ausdruck mit `text`, | |
# gebe alle Vorkommen aus und betrachte Reststring | |
# für weiteres Matching |
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
#nummern = IO.read("contacts.txt"); | |
class Contact | |
def initialize(name, phone) | |
@name = name; | |
@phone = phone; | |
end; |
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
# a ist ein eindimensionales array | |
def removeCell(a,k) | |
a = a[0,k] + a[k+1,a.size-1]; | |
end; | |
#p(removeCell([1,2,3,4], 3)); | |
# [1,2,3]; | |
#p("Hallo Welt"[6,4]); |
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
public class SyncPhilosopher implements Runnable { | |
private Object left; | |
private Object right; | |
private int num; | |
public SyncPhilosopher(int num, Object left, Object right) { | |
this.left = left; | |
this.right = right; |
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
public class Counter extends Thread { | |
private String name; | |
private int count; | |
private int delay; | |
public Counter(String name, int delay) { | |
this.name = name; | |
this.delay = delay; | |
this.count = 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
-- data IntTree = IntLeaf Int | |
-- | IntBranch IntTree IntTree | |
-- deriving Show | |
-- IntLeaf :: Int -> IntTree | |
-- IntBranch :: IntTree -> IntTree -> IntTree | |
intTree1 :: IntTree | |
intTree1 = Branch (Branch (Leaf 21) | |
(Leaf 5)) | |
(Branch (Leaf 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
module Set where | |
-- Menge als Funktion?! | |
type Set a = a -> Bool | |
-- empty | |
empty :: Set Int -- Int -> Bool | |
empty _ = False | |
-- empty x = const False x | |
-- empty = const False |
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 Automaton where | |
import Prelude hiding ( repeat ) | |
import Data.List ( find ) | |
data State = State | |
[(Char, State)] -- transitions | |
Bool -- final state? | |
-- prueft, ob ein Automat ein gegebenes Wort akzeptiert |
OlderNewer