Copyright © 2000, 2001, 2002, 2003 by Michael Neumann (mneumann@ntecs.de)
Letzte Änderung: Sunday, 30.11.2003, 18:17:40 von Michael
Neumann
Wenn Sie Fehler auf dieser Seite finden sollten, Verbesserungsvorschläge, Fragen oder weitere Programmbeispiele haben, dann können Sie mir unter folgender Adresse eine E-Mail senden: mneumann@ntecs.de.
Hier können Sie sich alles in MEHREREN HTML-Dateien anschauen!
Sprachen: A+, ABAP, ABC, Ada ( Ada 83, Ada 95, Ada 9X(95) ), Aleph, Algae, ALGOL ( ALGOL 60 ), Amos, APL, ASP (Active Server Pages) ( JavaScript, VBScript ), Assembler ( 6502, Apple II (II+, IIe, IIC), IBM Assembler/370 (VM/CMS), Intel 80x86 (DOS, MASM), Intel 80x86 (DOS, TASM), Intel 80x86 (gas/NetBSD), Intel 80x86 (nasm/NetBSD(aout)), Intel 80x86 (nasm), MIDAS PDP-10 (MIT Incompatible Timesharing System), MIPS R2000, Motorola 68000 (ATARI), VAX ), awk, BASIC, BCPL, Befunge, BETA, Blue, Brain, BrainF*ck, C, C#, C++ ( DOS/Windows, DOS/Windows (obsolete C++) ), Cilk, CLAIRE, Clipper, COBOL, Concurrent Clean, Cook, COSY INFINITY, C-Talk, Curl, Cyclone, D, dBASE, DOS Batch, Dylan, E, Eiffel ( SmallEiffel ), Emerald, Erlang, Euphoria, FISh, FOP, Forth ( ANS Forth, ANS Forth, pForth ), Fortran ( Fortran 77, Fortran 90 ), FOX, Gofer, Haskell ( Glasgow Haskell Compiler (GHC) ), HB (Hyper Builder), Hope, HPGL, HTML, IBM EXEC ( IBM EXEC (VM/CMS), IBM EXEC2 (VM/CMS) ), Icon, J, Java, JavaScript, Jovial, K, Labview, LaTeX, Leda, LIRL, Lisp ( Common Lisp, Emacs Lisp ), Logo, Lout, Lua, Make, Mercury, merd, Miranda, Moby, Modula ( Modula-2, Modula-3 ), mpC, MUMPS, NESL, Oberon, Objective-C, Objective Caml, Obliq, Octave, Ook, Oz/Mozart, Parrot, Pascal ( ISO-7185 ), Perl, Phantom, PHP ( PHP3 ), Pico, Pike, PL/0, PL/0E, PL/1, PL/SQL, Pliant, Postscript, Profan, Prolog, Python, R, Ratfor, Rebol, REXX, Ruby, Sather, Scheme, Shell-Sprachen ( csh, es (Extensible Shell), sh,ksh,zsh,bash, sh,ksh,zsh,bash,csh,es, WSH (Windows Scripting Host), zsh ), Simula ( Simula 67 ), Sina, Sirius, Sisal, Smalltalk, SML ( SML/NJ ), SNOBOL ( SNOBOL4 ), SQL ( Oracle SQL ), Superbase, Tcl ( Tcl/Tk ), TI-83 Graphing Calculator, TOM, Turing, TXL, UFO, UML (Unified Modeling Language), VHDL, Vim, WebL, WML (Wireless Markup Language), XPL0, Yacas, YAFL, Yoix, Yorick
Folgende Sprachen fehlen noch (241, sind längst nicht alle!): 4DOS, 4TH, ABCL/1, ABE, Acore, Act/1, Act/2, Act/3, Actor, Actors, Actra, AeonicScript, Agora, Alfonzo, Algae, ANTLR, Argus, ART, ASP, B, BEAST, Befunge, Berkeley Smalltalk, BISON, Bistro, Blaze, Brouhaha, C mit Klassen, C+-, C-Linda, Caché ObjectScript, Caml, Cantor, Cause, Cayenne, Cecil, CH, Chakotay, Charm, Cid, Clarity, Clascal, Classic Ada, Clay, Clean, Clipper, CLOS, Clu, Cluster 86, ColdC, Common Loops, Common Objects, Common ORBIT, Concurrent Prolog, Concurrent Smalltalk, Coral66, CP, CSSA, CST, cT, Curl, Curry, Delphi, Demeter, Director, Distributed Smalltalk, Dynace, EB, EBL, Eclipse, EcmaScript, Elan, Elegant, Elf, Eli, Elisp (Emacs-Lisp), Escher, Esterel, Expect, ExperCommonLisp, Extended Smalltalk, Felix Pascal, Ficl, FIJI, Flavors, FOOPlog, FOOPS, Forte', Freemarker, FRL, Galileo, Garp, Gentle, GJ (Generic Java), GLISP, Goedel, Guile, Gypsy, HP VEE, HPGL2, Hybrid, ICI, IDL, Inferno, Inheritance, InnovAda, INTERCAL, Intermission, IPL, Jade, Jasmine, Joule, Jovial (Jules' own version of IAL (international algorithmic language)), KL-One, KL1, KRL, KRS, Lagoona, Laure, Lens, LEX, LIFE, Limbo, Linda, Little Smalltalk, LL, LOOPS, Lore, LPC (Lars Pensjö C), Lua, Lucid, Lyric, Mace, MACSYMA, MALAGA, Maple, Mathematica, Mawl, MELD, Mercury, MetaHTML, Mjolner, ModPascal, MOM, Morphe, mpC, Mutt, Napier88, Neon, New Flavors, NIL, O-CPU, OakLisp, Object Assembler, Object Cobol, Object Lisp, Object Logo, Object Oberon, Object Pascal, ObjVLisp, Occam, Omega, OmniMark, OOPC, OOPS+, OPAL, OPL, Orbit, Orca, Orient84/K, OTM, PaL, Parsec, pC++ Sage++, PCOL, PF, PIE, Pilot, Pizza, PL/LL, PLAN, Plankalkül, Plasma II, POOL-T, Pop-11, PROCOL, Prometheus, PROMOTER, Quick Pascal, Quicktalk, Rebus, RIGAL, ROIS NPL, ROSS, S3L, SAL, SAST, SCOOP, SCOOPS, Scotty, sed, Self, SGML, Simscript, Smalltalk AT, Smalltalk V, Smallworld, SOUL (Smalltalk Open Unification Language), Spanner, SPOOL, SR, SRL, STROBE, T, T-Cham, Tempo, Tex, Theta, Tipi, Transframe, Trellis/Owl, Turing, TXL, Tycoon, µLPC, Uniform, UNITS, V, VBScript, VHDL, VIRT, Vulcan, WebMacro, WML (Website Meta Language), XLISP, XML, XSL, YACC, Yodl, Z, Zoom/VM ...
ChangeLog A+ ![]() |
http://www.aplusdev.org |
ähnliche Sprachen: | APL J K | |
Beschreibung: | A+ ist eine APL-ähnliche Sprache. Sie ist unter der GNU GPL Lizenz freigegeben. Wichtige Bemerkung: APL's Vektoren beginnen mit 1 wohingegen in A+ es mit 0 beginnt. |
Hello World | Michael Neumann |
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
|
Gibt die Quadrate von 1 bis 10
aus. |
Squares 2-dimensional | Michael Neumann |
|
Gibt die Quadrate von 1 bis 9 als
2-dimensionales Array aus: 1 4 9 |
ABAP ![]() |
Beschreibung: | Programmiersprache von SAP. |
Hello World | Knut Lickert |
Report Hello_World.
Write: "Hello World".
|
Gibt "Hello World" auf dem Bildschirm
aus. |
ABC ![]() |
ähnliche Sprachen: | Amos BASIC Euphoria Profan REXX | |
Hello World | Michael Neumann |
WRITE "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
FOR i IN {1..10} WRITE i*i |
Gibt die Quadrate von 1 bis 10
aus. |
Ada ![]() |
ähnliche Sprachen: | ALGOL Simula | |
Hello World | Ada 83 | Michael Neumann |
-- Hello World with Text_IO; use Text_IO; procedure HelloWorld is begin Put_Line("Hello World"); end HelloWorld; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Ada 95 | Michael Neumann |
-- Hello World with Ada.Text_IO; use Ada.Text_IO; procedure HelloWorld is begin Put_Line("Hello World"); end HelloWorld; |
Gibt "Hello World" auf dem Bildschirm
aus. |
OO - Shape, Circle, Rectangle | Ada 95 | Michael Neumann |
-- File: oo.ads -- Author: Michael Neumann package OO is type Byte is range 0 .. 255; for Byte'Size use 8; type Color is record Red, Green, Blue : Byte; end record; type Shape is abstract tagged record X, Y : Integer; C : Color; end record; type Circle is new Shape with record Radius : Integer; end record; type Rectangle is new Shape with record Width, Height : Integer; end record; procedure Move ( Self : in out Shape'Class; DX, DY : Integer ); procedure Draw ( Self : in Circle'Class ); procedure Draw ( Self : in Rectangle'Class ); function Get_Area ( Self : in Circle'Class ) return Integer; function Get_Area ( Self : in Rectangle'Class ) return Integer; end OO; -- File: oo.adb -- Author: Michael Neumann package body OO is procedure Move ( Self : in out Shape'Class; DX, DY : Integer ) is begin Self.X := Self.X + DX; Self.Y := Self.Y + DY; end Move; procedure Draw ( Self : in Circle'Class ) is begin -- Do something here null; end Draw; procedure Draw ( Self : in Rectangle'Class ) is begin -- Do something here null; end Draw; function Get_Area ( Self : in Circle'Class ) return Integer is Pi : constant Float := 3.1415; begin return Integer( Pi * Float(Self.Radius) ); end; function Get_Area ( Self : in Rectangle'Class ) return Integer is begin return Self.Width * Self.Height; end; end OO; -- File: oo_test.adb -- Author: Michael Neumann with Ada.Text_IO, OO; use Ada.Text_IO, OO; procedure OO_Test is package MyInt is new Integer_IO(Integer); use MyInt; BLACK : constant Color := (0, 0, 0); WHITE : constant Color := (255, 255, 255); Circ : Circle; Rect : Rectangle; begin Circ := Circle'( X => 100, Y => 100, Radius => 50, C => BLACK); Rect := Rectangle'( X => 20, Y => 20, Width => 5, Height => 5, C => WHITE); Move(Circ, DY => 10, DX => 10); Circ.X := 50; Circ.Radius := 5; Put( Get_Area(Circ) ); -- => 16 (Ada always rounds numbers up) Put( Get_Area(Rect) ); -- => 25 Put( Rect.Width ); -- => 5 Rect.Width := 10; Put( Rect.Width ); -- => 10 Draw(Circ); Draw(Rect); end; |
Squares | Ada 9X(95) | Michael Neumann |
with Ada.Text_IO; procedure Squares is use Ada.Text_IO; package MyInt is new Integer_IO(Integer); begin for I in 1..10 loop MyInt.Put(I*I); Put(" "); end loop; New_Line; end Squares; |
Gibt die Quadrate von 1 bis 10
aus. |
Aleph ![]() |
http://www.aleph-lang.org |
Beschreibung: | Aleph ist eine interpretierte, objekt-orientierte, funktionale Sprache die viel von Scheme und C++ erbt. |
Fakultät | Michael Neumann |
trans fac (n) ( if (> n 1) (* n (fac (- n 1))) 1 ) println (fac 6) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
# Hello World in Aleph println "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
# deklariere Variable trans index 1 while (< index 11) { println (* index index) " " } |
Gibt die Quadrate von 1 bis 10
aus. |
Algae ![]() |
http://algae.sourceforge.net |
Beschreibung: | Algae is an interpreted language for numerical analysis and
matrix processing, similar to Octave or MATLAB. Algae is said to be
very fast. It is free software under the GNU General Public
License.
Some facts:
|
Hello World | Michael Neumann |
# Hello World in Algae printf("Hello World\n"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Misc | Michael Neumann |
# fill(shape; values) fill(3,4; 1,2,3,4) # => 3x4 matrix filled (row-wise) with 1,2,3,4 diag(1,2,3) # 3x3 matix with 1,2,3 on the diagonal # linspace(a; b; n) linspace(1;10;100) creates a vector with 100 elements from 1 to 10 # ident(n) # creates the nxn identity matrix |
Squares (1) | Michael Neumann |
# Note that functions can be applied to scalars as well as to vectors or matrices squares = function(x) { return x^2; } nums = 1:10:1; # a vector containing elements from 1 to 10 print( squares(nums) ); # or ... print( nums^2 ); |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
for (i in 1:10) { printf("%d "; i^2); } printf("\n"); |
Gibt die Quadrate von 1 bis 10
aus. |
ALGOL ![]() |
ähnliche Sprachen: | Ada Simula | |
Hello World (1) | ALGOL 60 | Michael Neumann |
'begin' outstring(2, 'Hello World'); 'end' |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | ALGOL 60 | Michael Neumann |
'begin' 'string' s := 'Hello World'; 'integer' i; 'for' i := 1 'step' 1 'until' length(s) 'do' outsymbol(2,s,i); 'end' |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | ALGOL 60 | Michael Neumann |
'begin' 'comment' gibt die Quadrate von 1 bis 10 aus; 'integer' i; 'for' i := 1 'step' 1 'until' 10 'do' 'begin' outinteger(2,i*i); 'end' --for-----diese Schleife gibt die Quadrate aus 'end' --Ende des Programmes |
Gibt die Quadrate von 1 bis 10
aus. |
Amos ![]() |
ähnliche Sprachen: | ABC BASIC Euphoria Profan REXX | |
Hello World | Michael Neumann |
PRINT "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
APL ![]() |
ähnliche Sprachen: | A+ J K | |
Beschreibung: | APL (A Programming Language) ist eine Vektor-basierte Sprache, d.h. eine Sprache die bevorzugt mit Vektoren oder Matrizen arbeitet. Sie wurde von IBM entwickelt. |
Hello World | Michael Neumann |
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
|
Gibt die Quadrate von 1 bis 10
aus. |
Squares 2-dimensional | Michael Neumann |
|
Gibt die Quadrate von 1 bis 9 als
2-dimensionales Array aus: 1 4 9 |
ASP (Active Server
Pages) ![]() |
Hello World | JavaScript | B. Bora Bali |
<%@ language="javascript" %>
<html><body>
<%
Response.Write('Hello World!');
%>
</body></html>
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | VBScript | B. Bora Bali |
<%@ language="vbscript" %>
<html><body>
<%
Response.write "Hello World!"
%>
</body></html>
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Assembler
![]() |
Hello World | 6502, Apple II (II+, IIe, IIC) | Steve Hawley |
; Uses S-C Assembler variant. ; .or is origin ; .as is ASCII String ; .hs is Hex String .or $300 main ldy #$00 .1 lda str,y beq .2 jsr $fded ; ROM routine, COUT, y is preserved iny bne .1 .2 rts str .as "HELLO WORLD" .hs 0D00 |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | IBM Assembler/370 (VM/CMS) | B. Bora Bali |
TITLE 'Hello World for IBM Assembler/370 (VM/CMS)' HELLO START BALR 12,0 USING *,12 * WRTERM 'Hello World!' * SR 15,15 BR 14 * END HELLO |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | IBM Assembler/370 (VM/CMS) | B. Bora Bali |
TITLE 'Squares from 1 to 10 - IBM Assembler/370 (VM/CMS)' * SQUARE START BALR 12,0 USING *,12 * LA 4,1 * Start value = 1 LR 2,4 * Increment by 1 LA 3,10 * Range value = 10 * LOOP EQU * LR 7,4 * Copy the loop value MR 6,7 * Multiply by itself * CVD 7,DW * Convert it to decimal MVC WORKAREA,PATTERN * Copy edit pattern EDMK WORKAREA,DW * Convert decimal value to character WRTERM WORKAREA,16 * Display * BXLE 4,2,LOOP * Iterate until R4 <= R3 * SR 15,15 BR 14 * DW DS D WORKAREA DS XL16 PATTERN DC X'40202020202020202020202020202120' * END SQUARE |
Gibt die Quadrate von 1 bis 10
aus. |
Hello World | Intel 80x86 (DOS, MASM) | Brad Coomer |
.MODEL tiny .CODE ORG 100h HELLO PROC MOV AH,09h LEA DX,msg INT 21h ;Display Hello World MOV AX,4C00h ;Exit to DOS INT 21h HELLO ENDP msg DB 'Hello World$' END HELLO |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Intel 80x86 (DOS, TASM) | Michael Neumann |
; WRITTEN IN TASM (Turbo Assembler) .MODEL TINY CODE SEGMENT ASSUME CS:CODE, DS:CODE ORG 100h START: mov ah,9 mov dx,OFFSET Msg int 21h int 20h Msg DB 'Hello World',13,10,'$' CODE ENDS END START |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Intel 80x86 (gas/NetBSD) | Michael Neumann |
/* * Hello World in gas/NetBSD * AT/T-Syntax * * Compile: * gas hw.s * ld -s -o hw a.out */ .data msg: .string "Hello World\n" len: .long . - msg .text .globl _start _start: push $len /* Laenge */ push $msg /* Adresse */ push $1 /* Stdout */ movl $0x4, %eax /* write */ call _syscall addl $12, %esp /* Stack bereinigen */ push $0 movl $0x1, %eax /* exit */ call _syscall _syscall: int $0x80 ret |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Intel 80x86 (nasm/NetBSD(aout)) | Michael Neumann |
; ; Hello World in nasm/NetBSD(aout) ; ; Compile: ; nasm -f aoutb hw.asm ; ld -s -o hw hw.o section .text _start: push dword len ; Länge push dword msg ; Adresse push dword 1 ; Stdout mov eax, 0x4 ; write call _syscall add esp, 12 ; Stack bereinigen push dword 0 mov eax, 0x1 ; exit call _syscall _syscall: int 0x80 ret msg db "Hello World",0xa len equ $ - msg |
Gibt "Hello World" auf dem Bildschirm
aus. |
Fast and Good Hash Function | Intel 80x86 (nasm) | Michael Neumann |
;; ;; A Fast and Good Hash Function ;; ;; Algorithm by Bob Jenkins, December 1996 ;; (see http://burtleburtle.net/bob/c/lookupa.c for C version) ;; ;; Implemented by Michael Neumann, June 2002. ;; ;; Requires NASM - the Netwide Assembler. ;; global s_lookup section .text %macro mix_line 6 ;;; parameters: r x y shift temp direction(left|right) ;;; r -= x; r -= y; r ^= (y(>>|<<)shift) ; r -= x sub %1, %2 ; r -= y sub %1, %3 ; r ^= (y>>shift) mov %5, %3 %ifidni %6,left shl %5, %4 %else shr %5, %4 %endif xor %1, %5 %endmacro %macro mix 4 ;;; parameters: a b c temp ;;;a -= b; a -= c; a ^= (c>>13); mix_line %1, %2, %3, 13, %4, right ;;;b -= c; b -= a; b ^= (a<<8); mix_line %2, %3, %1, 8, %4, left ;;;c -= a; c -= b; c ^= (b>>13); mix_line %3, %1, %2, 13, %4, right ;;;a -= b; a -= c; a ^= (c>>12); mix_line %1, %2, %3, 12, %4, right ;;;b -= c; b -= a; b ^= (a<<16); mix_line %2, %3, %1, 16, %4, left ;;;c -= a; c -= b; c ^= (b>>5); mix_line %3, %1, %2, 5, %4, right ;;;a -= b; a -= c; a ^= (c>>3); mix_line %1, %2, %3, 3, %4, right ;;;b -= c; b -= a; b ^= (a<<10); mix_line %2, %3, %1, 10, %4, left ;;;c -= a; c -= b; c ^= (b>>15); mix_line %3, %1, %2, 15, %4, right %endmacro jump_table: dd case0, case1, case2, case3, case4, case5, case6, case7, case8, case9, case10, case11 ; unsigned long s_lookup(void *key, int length, int level) s_lookup: %define temp edx ; temporary register: edx %define a ecx ; a %define b ebx ; b %define c eax ; c %define len edi ; len %define key esi ; key push ebp mov ebp, esp push esi push edi push ebx push ecx push edx ; -------------------------------------------------------- mov key, [ebp+8] ; first argument (key) ; Set up the internal state ;;; len = length mov len, [ebp+12] ; second argument (length) ;;; a = b = 0x9e3779b9 mov a, 9e3779b9h mov b, a ;;; c = level mov c, [ebp+16] ;;; while (len >= 12) while: cmp len, 12 jl near end_while ; exit if len < 12 ;;; a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24)); add a, [key] ;;; b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24)); add b, [key+4] ;;; c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24)); add c, [key+8] mix a, b, c, temp add key, 12 sub len, 12 jmp near while end_while: ;;; c += length; add c, [ebp+12] ;; jump table jmp [jump_table+len*4] case11: add a, [key] ; cases 1,2,3,4 add b, [key+4] ; cases 5,6,7,8 mov temp, [key+8] ; cases 9,10,11 shl temp, 8 add c, temp jmp ende case10: add a, [key] ; cases 1,2,3,4 add b, [key+4] ; cases 5,6,7,8 mov temp, [key+8] ; cases 9,10 shl temp, 8 and temp, 0FFFFFFh add c, temp jmp ende case9: add a, [key] ; cases 1,2,3,4 add b, [key+4] ; cases 5,6,7,8 mov temp, [key+8] ; cases 9 shl temp, 8 and temp, 0FFFFh add c, temp jmp ende case8: add a, [key] ; cases 1,2,3,4 add b, [key+4] ; cases 5,6,7,8 jmp ende case7: add a, [key] ; cases 1,2,3,4 mov temp, [key+4] ; cases 5,6,7 and temp, 0FFFFFFh add b, temp jmp ende case6: add a, [key] ; cases 1,2,3,4 mov temp, [key+4] ; cases 5,6 and temp, 0FFFFh add b, temp jmp ende case5: add a, [key] ; cases 1,2,3,4 mov temp, [key+4] ; cases 5 and temp, 0FFh add b, temp jmp ende case3: mov temp, [key] and temp, 0FFFFFFh add a, temp ; cases 1,2,3 jmp ende case2: mov temp, [key] and temp, 0FFFFh add a, temp ; cases 1,2 jmp ende case1: mov temp, [key] and temp, 0FFh add a, temp ; cases 1 jmp ende ;; the last case should be the most often occuring one (so we can save one jump instruction) case4: add a, [key] ; cases 1,2,3,4 case0: ende: mix a, b, c, temp ; return value in eax %ifnidni c,eax mov eax, c %endif ; -------------------------------------------------------- pop edx pop ecx pop ebx pop edi pop esi pop ebp ret |
Generates 32-bit hash values from a
given string. |
Hello World | MIDAS PDP-10 (MIT Incompatible Timesharing System) | Rob Austein |
;; Hello world in MIDAS title hello start: .open [.uao,,'tty ? 0 ? 0] .lose %lsfil move 1, [440700,,[asciz "Hello, world "]] loop: ildb 2,1 skipn 2 .logou 1, .iot 2 jrst loop end start |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | MIDAS PDP-10 (MIT Incompatible Timesharing System) | Rob Austein |
;; Squares of integers 1..10 in MIDAS title squares p==17 .vector pdl(lpdl==200) ttyo==:5 start: move p, [-lpdl,,pdl-1] .open ttyo, [.uao,,'tty ? 0 ? 0] .lose %lsfil move 1, [-12,,1] loop: hrrz 2, 1 imul 2, 2 pushj p, print movei 2, 15 .iot ttyo, 2 movei 2, 12 .iot ttyo, 2 aobjn 1, loop .logou 1, print: idivi 2, 12 push p, 3 skipe 2 pushj p, print pop p, 2 addi 2, "0 .iot ttyo, 2 popj p, end start |
Gibt die Quadrate von 1 bis 10
aus. |
Hello World | MIPS R2000 | Christian Heinig |
.data # Datensegment str: .asciiz "Hello World!\n" # String ablegen .text # Codesegment main: li $v0, 4 # 4 = Print_string la $a0, str # Adresse des Strings übergeben syscall # Systemfunktion aufrufen li $v0, 10 # 10 = Quit syscall # Programm beenden |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Motorola 68000 (ATARI) | Michael Neumann |
start: ; Message-String ausgeben move.l #msg,-(a7) move.w #9,-(a7) trap #1 addq.l #6,a7 ; auf Taste warten move.w #1,-(a7) trap #1 addq.l #2,a7 ; Programm beenden clr -(a7) trap #1 msg: dc.b "Hello World",10,13,0 |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | VAX | Daniel Lundin |
LL0: .data .text L .align 1 .globl _main _main: .word L12 jbr L14 L15: .data 1 L17: .ascii "Hello, world.2" .text pushl $L17 calls $1,_puts ret .set L12,0x0 L14: jbr L15 .data |
Gibt "Hello World" auf dem Bildschirm
aus. |
awk ![]() |
Hello World | Michael Neumann |
# # Hello World in awk # BEGIN { print "Hello World" } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
function sqr(n) { return n*n } BEGIN { for(i=1; i<=10; i++) { printf "%d ", sqr(i) } print # new line } |
Gibt die Quadrate von 1 bis 10
aus. |
BASIC ![]() |
ähnliche Sprachen: | ABC Amos Euphoria Profan REXX | |
Hello World | Michael Neumann |
PRINT "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
FOR I=1 TO 10 PRINT I*I; NEXT I |
Gibt die Quadrate von 1 bis 10
aus. |
BCPL ![]() |
http://www.tuxedo.org/~esr/jargon/html/entry/BCPL.html |
Beschreibung: | BCPL (Basic Combined Programming Language) was developed by Martin Richards in Cambridge in 1967. The language C inherited some of BCPL's features, and in C++ BCPL's line comments (//) were introduced again. |
Hello World | Daniel Lundin |
// BCPL 'Hello World' program GET "LIBHDR" LET START () BE $( WRITES ("Hello World!*N") $) |
Gibt "Hello World" auf dem Bildschirm
aus. |
Befunge
![]() |
Squares (1) | Chad Fowler |
55+82+*99*88*77*66*55*44*33*22*11*>v .: ^_@ |
Gibt die Quadrate von 1 bis 10 aus.
Note that formatting is important. Explanation: push 5, push
5, pop/pop/add/push, push 8, push 2, pop/pop/add/push,
pop/pop/multiply, push, etc... (until ">") go right, go down,
":" means duplicate of stack, compare to 0--if 0 go right,
otherwise left, go up ("^"), pop and print as integer (continue
up), go left, go down (looping until "@" on nonzero condition,
which means "end") |
Squares (2) | Chad Fowler |
a987654321>v .: *v :v ^_@ |
Gibt die Quadrate von 1 bis 10 aus. .
Refactored :-) |
BETA ![]() |
Hello World | Michael Neumann |
(# do 'Hello World' -> putline #) |
Gibt "Hello World" auf dem Bildschirm
aus. |
Schleifen-Test | Michael Neumann |
(# schleife: (# n: @integer enter n do (for n repeat inner for) #) do 9 -> schleife (# do 10-n -> schleife (# do n -> putint; ' ' -> put #) newline #) #) |
Gibt folgendes auf dem Bildschirm
aus:1 2 3 4 5 6 7 8 9 |
Squares | Michael Neumann |
(# do (for i:10 repeat i*i -> putint for) #) |
Gibt die Quadrate von 1 bis 10
aus. |
Blue ![]() |
ähnliche Sprachen: | Eiffel Sather | |
Hello World | Michael Neumann |
-- Hello World in Blue class HelloWorld is == == HelloWorld-Klasse == interface creation is == Erzeugt das HelloWorld-Objekt do printIt end creation routines printIt is == prints Hello World do print("Hello World\n") end printIt end class |
Gibt "Hello World" auf dem Bildschirm
aus. |
Brain ![]() |
http://brain.sourceforge.net |
Beschreibung: | Brain ist eine high-level, pure object-orientierte,
Prototyp-basierende Skriptsprache, die am meisten der Sprache Self
ähnelt. Einige Besonderheiten von Brain sind:
|
Fakultät | Michael Neumann |
fac = {|n|
(n > 1) if-true: { n * fac (n-1) }
if-false: { 1 }.
}.
-- call the code-block and output the value
fac (6); println.
|
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
-- Hello World in Brain #! this is also a single line comment {- and a multi-liine comment. -} "Hello World" println. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Chad Fowler |
#! Squares in Brain
1 to: 10 by: 1 do: { | i | (i * i) println. }
|
Gibt die Quadrate von 1 bis 10
aus. |
BrainF*ck
![]() |
http://www.catseye.mb.ca/esoteric/bf/index.html |
Hello World | Jesse Crocker |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .---.+++++++..+++.>++++++++++++++++++++++++++++++++.<++++++++.--------.+ ++.------.--------.>+.>++++++++++. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Chad Fowler |
+[>+[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<< -]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>> >[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<- <-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<< +>>-]<<-]>++++[<++++++++>-]<.[-] ++[>++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[ <<+>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-]++++ +++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-] <<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+ <-]+++++++[<+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<++++++++>-]<.[-] +++[ >+++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<< -]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>> >[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<- <-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<< +>>-]<<-]>++++[<++++++++>-]<.[-] ++++[>++++[>+<-]<-] >> [>+<-]>[[>+>+<<- ]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-] +++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>+++++++++<[>>>+<<[>+ >[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]< [[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<++++++++>-]<.[-] +++++[>+++++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[ >+>[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]< [>+<-]>>>[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>> >+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><. [-]>>[<<+>>-]<<-]>++++[<++++++++>-]<.[-] ++++++[>++++++[>+<-]<-] >> [>+< -]>[[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++ ++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>++++++++ +<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<< <<>[-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<+++++ +++>-]<.[-] +++++++[>+++++++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]<>++ +++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->- ]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-] >[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++++[ <+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<++++++++>-]<.[-] ++++++++[>+++++ +++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<<- ]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>>> [<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-< -]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<<+ >>-]<<-]>++++[<++++++++>-]<.[-] +++++++++[>+++++++++[>+<-]<-] >> [>+<-]> [[>+>+<<-]>>[<<+>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++> >-]<<-<-]+++++++++>[<->-]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>+++++++++<[ >>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<> [-]<<+>]<[[>+<-]+++++++[<+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<++++++++ >-]<.[-] ++++++++++[>++++++++++[>+<-]<-] >> [>+<-]>[[>+>+<<-]>>[<<+>>-]< >+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>-]<<-<-]+++++++++>[< ->-]<[>+<-]<[>+<-]<[>+<-]>>>[<<<+>>>-]<>+++++++++<[>>>+<<[>+>[-]<<-]>[<+ >-]>[<<++++++++++>>>+<-]<<-<-]>>>>[<<<<+>>>>-]<<<<>[-]<<+>]<[[>+<-]+++++ ++[<+++++++>-]<-><.[-]>>[<<+>>-]<<-]>++++[<++++++++>-]<.[-] |
Gibt die Quadrate von 1 bis 10
aus. |
C ![]() |
ähnliche Sprachen: | C# C++ C-Talk D Cilk Java Objective-C Pike TOM | |
Berechnen von PI | Michael Neumann |
/* * Calculating PI * * Author: Michael Neumann (mneumann@fantasy-coders.de) * Date: 03.12.2002 * * Requires GNU MP (tested with version 4.1) * (http://www.swox.com/gmp/) * * To compile: * cc pi.c -o pi -I/usr/local/include -L/usr/local/lib -lgmp */ #include "gmp.h" #include <stdio.h> int main(int argc, char **argv) { mpz_t k, a, b, a1, b1, p, q, d, d1; mpz_t t1, t2, t3, t4; /* temporary */ /* Initialize and assign integers */ mpz_init(p); mpz_init(q); mpz_init(d); mpz_init(d1); mpz_init(t1); mpz_init(t2); mpz_init(t3); mpz_init(t4); mpz_init_set_ui(k, 2); mpz_init_set_ui(a, 4); mpz_init_set_ui(b, 1); mpz_init_set_ui(a1, 12); mpz_init_set_ui(b1, 4); for(;;) { /* Next approximation */ mpz_mul(p, k, k); /* p = k * k */ mpz_mul_ui(q, k, 2); /* q = k * 2 */ mpz_add_ui(q, q, 1); /* q = q + 1 */ mpz_add_ui(k, k, 1); /* k = k + 1 */ mpz_set(t1, a1); /* t1 = a1 */ mpz_set(t2, b1); /* t2 = b1 */ /* a1 = p*a + q*a1 */ mpz_mul(t3, p, a); /* t3 = p * a */ mpz_mul(t4, q, a1); /* t4 = q * a1 */ mpz_add(a1, t3, t4); /* a1 = t3 + t4 */ /* b1 = p*b + q*b1 */ mpz_mul(t3, p, b); /* t3 = p * b */ mpz_mul(t4, q, b1); /* t4 = q * b1 */ mpz_add(b1, t3, t4); /* b1 = t3 + t4 */ mpz_set(a, t1); mpz_set(b, t2); /* Print common digits */ mpz_tdiv_q(d, a, b); /* d = a / b */ mpz_tdiv_q(d1, a1, b1); /* d1 = a1 / b1 */ while (mpz_cmp(d, d1) == 0) { /* d == d1 */ mpz_out_str(stdout, 10, d1); fflush(stdout); /* a = 10*(a mod b) */ mpz_tdiv_r(t1, a, b); /* t1 = a mod b */ mpz_mul_si(a, t1, 10); /* a = t1 * 10 */ /* a1 = 10*(a1 mod b1) */ mpz_tdiv_r(t1, a1, b1); /* t1 = a1 mod b1 */ mpz_mul_si(a1, t1, 10); /* a = t1 * 10 */ mpz_tdiv_q(d, a, b); /* d = a / b */ mpz_tdiv_q(d1, a1, b1); /* d1 = a1 / b1 */ } } return 0; } |
Berechnen der Zahl PI |
Hello World | Michael Neumann |
#include <stdio.h> main() { printf("Hello World\n"); } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Multi-Threaded (forking) Echo-Server | Michael Neumann |
/* * $Id: echo-mt.c,v 1.1 2002/01/09 14:28:43 michael Exp $ * * Copyright (c) 2001, 2002 by Michael Neumann * * Multiple Threaded (forking) Echo-Server. * * Platform: NetBSD (should run on other Unices, too). * */ #include <sys/types.h> /* htons() ... */ #include <sys/socket.h> /* socket(), bind(), listen(), accept() */ #include <netinet/in.h> /* sockaddr_in */ #include <sys/param.h> /* MAXHOSTNAMELEN */ #include <netdb.h> /* gethostbyname() */ #include <signal.h> /* signal() */ #include <sys/wait.h> /* waitpid() */ #include <unistd.h> /* close(), gethostname(), read() ... */ #include <stdio.h> /* perror() */ #include <strings.h> /* bzero(), bcopy() */ #define PORT_NR 8000 /* port number to listen on */ /** * Signal handler for SIGCHLD (child process changes state). * * Queries return status of terminated child processes, * otherwise zombie processes will occure. */ void child_sig_handler(void) { while (waitpid(-1, NULL, WNOHANG) > 0) ; } int main(int argc, char** argv) { int s, t; /* socket handles */ struct sockaddr_in sa; /* socket address */ char myhostname[MAXHOSTNAMELEN+1]; /* local host name */ struct hostent *hp; /* host informations */ int pid; /* proccess id of forked child process */ int count; char buffer[100]; /* get host informations */ gethostname(myhostname, MAXHOSTNAMELEN); if ( (hp = gethostbyname(myhostname)) == NULL ) { perror("Couldn't get informations about host name."); return -1; } /* initialize sockaddr_in struct */ bzero(&sa, sizeof (struct sockaddr_in)); bcopy(hp->h_addr, &sa.sin_addr, hp->h_length); sa.sin_family = hp->h_addrtype; sa.sin_port = htons(PORT_NR); /* create socket */ if ( (s = socket(PF_INET, SOCK_STREAM, 0)) == -1 ) { perror("Couldn't create socket."); return -1; } /* bind socket `s' to specific address (local host) */ if ( bind(s, (struct sockaddr*) &sa, sizeof (struct sockaddr)) == -1 ) { perror("Coudn't bind socket."); close(s); return -1; } /* allow incoming requests; queue up to 3 of them */ listen(s, 3); /* install signal handler */ signal(SIGCHLD, child_sig_handler); while (1) { /* accept a connection */ if ( (t = accept(s, NULL, NULL)) == -1 ) { perror("Couldn't accept socket."); close(s); return -1; } /* fork new subprocess, which handles the new connection */ switch (pid = fork()) { case -1: /* error */ perror("Could not fork!"); close(s); close(t); return -1; case 0: /* child process */ /* close handle `s' as it is a duplicate */ close(s); /* echo data */ while ( (count = read(t, buffer, sizeof (buffer)-1)) > 0 ) { write(t, buffer, count); } /* close connection */ close(t); return 0; default: /* parent process */ /* close handle `t' as it is a duplicate */ close(t); } } close(s); return 0; } |
Implements a multi-threaded (forking)
echo-server using BSD Sockets. Only tested on NetBSD! |
Single-Threaded (non-forking) Echo-Server | Michael Neumann |
/* * $Id: echo-st.c,v 1.2 2002/01/09 14:29:03 michael Exp $ * * Copyright (c) 2001, 2002 by Michael Neumann * * Single Threaded (non-forking) Echo-Server. * * Platform: NetBSD (should run on other Unices, too). * */ #include <sys/types.h> /* htons() ... */ #include <sys/socket.h> /* socket(), bind(), listen(), accept() */ #include <netinet/in.h> /* sockaddr_in */ #include <sys/param.h> /* MAXHOSTNAMELEN */ #include <netdb.h> /* gethostbyname() */ #include <unistd.h> /* close(), gethostname(), read() ... */ #include <stdio.h> /* perror() */ #include <strings.h> /* bzero(), bcopy() */ #define PORT_NR 8000 /* port number to listen on */ int main(int argc, char** argv) { int s, t; /* socket handles */ struct sockaddr_in sa; /* socket address */ char myhostname[MAXHOSTNAMELEN+1]; /* local host name */ struct hostent *hp; /* host informations */ int count; char buffer[100]; /* get host informations */ gethostname(myhostname, MAXHOSTNAMELEN); if ( (hp = gethostbyname(myhostname)) == NULL ) { perror("Couldn't get informations about host name."); return -1; } /* initialize sockaddr_in struct */ bzero(&sa, sizeof (struct sockaddr_in)); bcopy(hp->h_addr, &sa.sin_addr, hp->h_length); sa.sin_family = hp->h_addrtype; sa.sin_port = htons(PORT_NR); /* create socket */ if ( (s = socket(PF_INET, SOCK_STREAM, 0)) == -1 ) { perror("Couldn't create socket."); return -1; } /* bind socket `s' to specific address (local host) */ if ( bind(s, (struct sockaddr*) &sa, sizeof (struct sockaddr)) == -1 ) { perror("Coudn't bind socket."); close(s); return -1; } /* allow incoming requests; queue up to 3 of them */ listen(s, 3); while (1) { /* accept a connection */ if ( (t = accept(s, NULL, NULL)) == -1 ) { perror("Couldn't accept socket."); close(s); return -1; } /* echo data */ while ( (count = read(t, buffer, sizeof (buffer)-1)) > 0 ) { write(t, buffer, count); } /* close connection */ close(t); } close(s); return 0; } |
Implements a single-threaded
(non-forking) echo-server using BSD Sockets. Only tested on
NetBSD! |
C# ![]() |
ähnliche Sprachen: | C C++ C-Talk D Cilk Java Objective-C Pike TOM | |
Beschreibung: | C# (C sharp) ist Microsofts Antwort auf Suns Java. C# verbindet die Geschwindigkeit und Mächtigkeit von C++ und die hohe Produktivität von Visual Basic. Einziger Nachteil von C# ist die Plattformabhängigkeit, da es C# wohl nur für Windows geben wird. C# hat Garbage-Collection, jedoch ist es auch möglich in speziell deklarierten Blöcken Pointer-Arithmetik anzuwenden und somit selbst für die Speicherfreigabe verantwortlich zu sein. Alle Datentypen sind in C# Objekte, so kann man z.B. auf einen Integer eine Methode aufrufen. C# hat eingebaute COM-Funktionalitäten, so gibt es Getter/Setter-Methoden (Properties) und Events. Jedes C#-Objekt ist automatisch ein COM-Objekt, und somit lassen sich auch problemlos, in anderen Sprachen erstellte COM-Objekte, als C#-Objekte verwenden. Insgesamt eine für Windows-Entwickler sehr interessante Sprache, wobei gerade der Umstieg von C++ nicht schwer fallen wird! Sehr gefallen hat mir die Meta-Dokumentation. Jedem beliebigen Element (Klasse, Methode...) kann man eine Dokumentation hinzufügen, wobei die Art der Dokumentation selbst durch C#-Klassen festgelegt werden kann, und man zur Laufzeit auf die Dokumentation zugreifen kann. |
Hello World | Michael Neumann |
// Hello World in C# using System; class HelloWorld { static void Main() { Console.WriteLine("Hello World"); } } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
using System; class Squares1 { static void Main() { for (int i=1; i<=10; i++) { Console.WriteLine("{0} ", i*i); } } } |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
using System; class Squares2 { static void Main() { string res = ""; int[] arr = {1,2,3,4,5,6,7,8,9,10}; // short form for "new int[] = {1,2,...}" for (int i=0; i<arr.Length; i++) { res += (arr[i]*arr[i]).ToString() + " "; } Console.WriteLine("{0}", res); } } |
Gibt die Quadrate von 1 bis 10
aus. |
C++ ![]() |
ähnliche Sprachen: | C C# C-Talk D Cilk Java Objective-C Pike TOM | |
Beschreibung: | C++ wurde 1980 (1983 ist der Name C++ entstanden) von Bjarne Stroustrup entwickelt. C++ ist ein Superset von C, d.h. beinhaltet die komplette Syntax von C und erweitert diese um objektorientierte Fähigkeiten, die Simula (67) entstammen. C++ ist heute die populärste Sprache überhaupt. |
Boyer-Moore Search | Michael Neumann |
/* * Boyer-Moore Search * * 01.06.1998, implemented by Michael Neumann */ # include <algorithm> int BoyerMooreSearch(char* text, char* muster, int tlen, int mlen) { int i, j, skip[256]; for(i=0; i<256; ++i) skip[i]=mlen; for(i=0; i<mlen; ++i) skip[muster[i]]=mlen-1-i; for(i=j=mlen-1; j>=0; --i, --j) while(text[i] != muster[j]) { i += max(mlen-j,skip[text[i]]); if(i >= tlen) return -1; j = mlen-1; } return i; } |
Ein sehr guter Algorithmus um einen
Substring in einem String zufinden. |
BubbleSort | Michael Neumann |
/* * BubbleSort * * 20.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __BUBBLESORT_HEADER__ # define __BUBBLESORT_HEADER__ # include <algorithm> template <class itemType, class indexType=int> void BubbleSort(itemType a[], indexType l, indexType r) { static indexType i, j; for(i=r; i>l; --i) for(j=l; j<i; ++j) if(a[j] > a[j+1]) std::swap(a[j], a[j+1]); } # endif |
BubbleSort |
BucketSort | Michael Neumann |
/* * BucketSort (Distrubution Counting) * * 21.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __BUCKETSORT_HEADER__ # define __BUCKETSORT_HEADER__ # include <algorithm> // itemType must have an typecast to "int", which identifies the sortkey template <class itemType, class indexType=int> class BucketSort { public: // the array b[] had to be the same size like a[] void Sort(itemType a[], itemType b[], indexType l, indexType r) { a = &a[l]; b = &b[l]; for(int i=0; i<sizeof(int); ++i) { sort_byte(i,a,b,r-l+1); std::swap(a,b); } } protected: sort_byte(int bytenr, itemType a[], itemType b[], indexType count) { static indexType i; typedef unsigned char* UCP; for(i=0; i<256; ++i) occurences[i] = 0; // better: memset for(i=0; i<count; ++i) ++occurences[((UCP)&a[i])[bytenr]]; for(i=1; i<256; ++i) occurences[i] += occurences[i-1]; for(i=count-1; i>=0; --i) b[--occurences[((UCP)&a[i])[bytenr]]] = a[i]; } int occurences[256]; }; # endif |
BucketSort |
GgT | Michael Neumann |
/* Größter Gemeinsamer Teiler Es sind nur Werte größer als Null zulässig. */ int ggt( int a, int b ) { int temp; if( a < b ) { temp=a; a=b; b=temp; } while( (temp = a%b) != 0 ) { a = b; b = temp; }; return b; } |
Grösster Gemeinsamer
Teiler |
Hash1 | Michael Neumann |
/* * Hash1.Cpp * * 03.06.1998, implemented by Michael Neumann */ int hash1(int M, char* t) { unsigned h=0; for(;*t;++t) h = ((h << 8)+ *t) % M; return h; } |
Standard Hash Funktion |
hashpjw | Michael Neumann |
/* * hashpjw, algorithm by P.J.Weinberg * * 03.06.1998, implemented by Michael Neumann */ int hashpjw(int M, char* t) { unsigned h=0, g; for(;*t;++t) { h = (h << 4)+ *t; if(g=h&0xf0000000) { h ^= g>>24; h ^= g; } } return h%M; } |
Hashfunktion von P.J. Weinberg
|
Hello World (1) | Michael Neumann |
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello World\n"); return 0; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
#include <iostream.h> int main(int argc, char *argv[]) { cout << "Hello World" << endl; return 0; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (standard) | Daniel Kress |
#include <iostream> using namespace std; int main() { cout << "Hello World" << endl; return 0; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
InsertionSort | Michael Neumann |
/* * InsertionSort * * 20.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __INSERTIONSORT_HEADER__ # define __INSERTIONSORT_HEADER__ # include <algorithm> template <class itemType, class indexType=int> void InsertionSort(itemType a[], indexType l, indexType r) { static indexType i, j; static itemType v; for(i=l+1; i<=r; ++i) { for(j=i-1, v=a[i]; j>=l && a[j]>v; a[j+1]=a[j], --j); a[j+1] = v; } } # endif |
InsertionSort |
MergeSort | Michael Neumann |
/* * MergeSort * * 21.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __MERGESORT_HEADER__ # define __MERGESORT_HEADER__ # include <algorithm> // Array b[] must have same size like a[]; result is in a[]! template <class itemType, class indexType=int> void MergeSort(itemType a[], itemType b[], indexType l, indexType r) { indexType i, j, k, m; if(r > l) { m = (r+l)/2; MergeSort(a,b,l,m); MergeSort(a,b,m+1,r); for(i=m+1; i>l; --i) b[i-1] = a[i-1]; for(j=m; j<r; ++j) b[r+m-j] = a[j+1]; for(k=l; k<=r; ++k) a[k] = (b[i] < b[j]) ? b[i++] : b[j--]; } } # endif |
MergeSort |
QuickSort | Michael Neumann |
/* * QuickSort, algorithm by C.A.R. Hoare (1960) * * 01.06.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __QUICKSORT_HEADER__ # define __QUICKSORT_HEADER__ # include <algorithm> template <class itemType, class indexType=int> void QuickSort(itemType a[], indexType l, indexType r) { static itemType m; static indexType j; indexType i; if(r > l) { m = a[r]; i = l-1; j = r; for(;;) { while(a[++i] < m); while(a[--j] > m); if(i >= j) break; std::swap(a[i], a[j]); } std::swap(a[i],a[r]); QuickSort(a,l,i-1); QuickSort(a,i+1,r); } } # endif |
QuickSort |
SelectionSort | Michael Neumann |
/* * SelectionSort * * 20.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __SELECTIONSORT_HEADER__ # define __SELECTIONSORT_HEADER__ # include <algorithm> template <class itemType, class indexType=int> void SelectionSort(itemType a[], indexType l, indexType r) { static indexType i, j, min; for(i=l; i<r; ++i) { for(min=i, j=i+1; j<=r; ++j) if(a[j] < a[min]) min = j; std::swap(a[min], a[i]); } } # endif |
SelectionSort |
ShellSort | Michael Neumann |
/* * ShellSort * * 20.11.1998, implemented by Michael Neumann (mneumann@ntecs.de) */ # ifndef __SHELLSORT_HEADER__ # define __SHELLSORT_HEADER__ # include <algorithm> template <class itemType, class indexType=int> void ShellSort(itemType a[], indexType l, indexType r) { static indexType i, j, h; static itemType v; for(h=1; h<=(r-l)/9; h=3*h+1); for(; h>0; h/=3) { for(i=l+h; i<=r; ++i) { for(j=i-h, v=a[i]; j>=l && a[j]>v; a[j+h]=a[j], j-=h); a[j+h] = v; } } } # endif |
ShellSort |
Hello World (1) | DOS/Windows | Michael Neumann |
#include <stdio.h> void main() { printf("Hello World\n"); } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | DOS/Windows (obsolete C++) | Michael Neumann |
#include <iostream.h> void main() { cout << "Hello World" << endl; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Cilk ![]() |
ähnliche Sprachen: | C C# C++ C-Talk D Java Objective-C Pike TOM | |
Hello World | Michael Neumann |
#include <stdio.h> cilk void main() { printf("Hello World\n"); } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
/* Cilk ist fast C */ #include <stdio.h> cilk void main() { int i; for(i = 1; i <= 10; ++i) printf("%d ", i*i); } |
Gibt die Quadrate von 1 bis 10
aus. |
CLAIRE ![]() |
Hello World | Michael Neumann |
;; Hello World in CLAIRE [ main() -> printf("Hello World\n") ] |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
[ main() -> for i in (1 .. 10) printf("~S ",i * i) ] |
Gibt die Quadrate von 1 bis 10
aus. |
Clipper
![]() |
Hello World | Pablo Romero |
? "Hello World" quit |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Jürgen Müller |
for nI := 1 TO 10 ? nI*nI next |
Gibt die Quadrate von 1 bis 10
aus. |
COBOL ![]() |
Hello World | Fabritius |
IDENTIFICATION DIVISION. PROGRAM-ID. HelloWorld. AUTHOR. Fabritius. ENVIRONMENT DIVISION. CONFIGURATION SECTION. INPUT-OUTPUT SECTION. DATA DIVISION. FILE SECTION. WORKING-STORAGE SECTION. LINKAGE SECTION. PROCEDURE DIVISION. DISPLAY "Hello World". STOP RUN. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Concurrent Clean
![]() |
http://www.cs.kun.nl/~clean/ |
Beschreibung: | Clean is a pure functional, lazy evaluating programming
language (similar to Haskell). Features:
|
Ackermann | Michael Neumann |
// // File: Ackermann // Language: Concurrent Clean 2.0 // Author: Michael Neumann (mneumann@ntecs.de) // Date: 23 March 2002 // module Ackermann import StdEnv import ArgEnv Ack :: !Int !Int -> !Int Ack 0 n = n+1 Ack m 0 = Ack (m-1) 1 Ack m n = Ack (m-1) (Ack m (n-1)) Start :: String Start = "Ack(3," +++ toString n +++ "): " +++ toString (Ack 3 n) +++ "\n" where n = toInt (select getCommandLine 1) |
Calculates the Ackermann
function |
Array Access | Michael Neumann |
// // File: Array Access // Language: Concurrent Clean 2.0 // Author: Michael Neumann (mneumann@ntecs.de) // Date: 24 March 2002 // module ArrayAccess import StdEnv import ArgEnv RUNS :== 1000 doIt x y lix = loop RUNS y where // loop 'i' times loop :: !Int *{#Int} -> *{#Int} loop i y # y` = add lix y | i <= 1 = y` | otherwise = loop (i-1) y` where // adds 'x' to 'y' add :: !Int *{#Int} -> *{#Int} add i y #! e = y.[i] # y` = {y & [i] = e + x.[i]} | i == 0 = y` | otherwise = add (i-1) y` Start :: String Start # a = doIt (make_x n) (make_y n) (n-1) = toString a.[0] +++ " " +++ toString a.[n-1] +++ "\n" where n = toInt (select getCommandLine 1) // creates the 'x' array make_x :: !Int -> *{#Int} make_x n = fill_x (createArray n 0) (n-1) where fill_x :: *{#Int} !Int -> *{#Int} fill_x x i | i == 0 = x` | otherwise = fill_x x` (i-1) where x` = {x & [i] = i+1} // creates the 'y' array make_y :: !Int -> *{#Int} make_y n = createArray n 0 |
Fakultät | Michael Neumann |
module Fac fac :: !Int -> Int fac 0 = 1 fac 1 = fac 0 fac n = n * fac (dec n) // Tail recursive (much faster) fact :: !Int !Int -> Int fact 0 i = i fact n i = fact (n-1) (n*i) |
Fibonacci | Michael Neumann |
// // File: Fibonacci // Language: Concurrent Clean 2.0 // Author: Michael Neumann (mneumann@ntecs.de) // Date: 23 March 2002 // module Fibonacci import StdEnv import ArgEnv Fib :: !Int -> !Int Fib n | n < 2 = 1 | otherwise = Fib (n-2) + Fib (n-1) Start :: String Start = "Fib(" +++ toString n +++ "): " +++ toString (Fib n) +++ "\n" where n = toInt (select getCommandLine 1) |
Hello World | Michael Neumann |
// Hello World module helloworld import StdEnv Start :: String Start = "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Michael Neumann |
module HelloWorld Start = "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
module squares import StdEnv Start :: [(Int, String)] Start = [(a*a," ") \\ a <- [1..10]] |
Gibt die Quadrate von 1 bis 10
aus. |
String Concatenation | Michael Neumann |
// // File: String Concatenation // Language: Concurrent Clean 2.0 // Author: Michael Neumann (mneumann@ntecs.de) // Date: 25 March 2002 // module StringConcatenation import StdEnv import ArgEnv loop :: !Int *String -> *String loop 0 s = s loop i s = loop (i-1) (s +++. "hello\n") Start = toString (size s) +++ "\n" where s = loop n "" n = toInt (select getCommandLine 1) |
Appends n-times the string
"hello\n". |
Cook ![]() |
http://www.canb.auug.org.au/~millerp/cook |
Beschreibung: | Cook is a Dependency Maintenance Tool (DMT) and is used for constructing files from other, dependent files. It's purpose is similar to the popular UNIX 'make', but has more features and is easier to use. Cook has true variables (not simple macros as in 'make'); user defined functions; is very portable due to a lot of built-in functions; can build in parallel even across a network; doesn't use tabs to indent (as 'make' uses); can simply be told to use fingerprints (e.g. using a MD5 checksum) instead of timestamps. |
Hello World | Michael Neumann |
/* Hello World in Cook */ /* platform-independent using built-in function */ [print "Hello World"]; /* platform-dependent using `echo' */ echo "Hello World"; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
/** * * start from the command-line with: * * cook -Book squares.cook * * or rename as Howto.cook and invoke: * * cook * * Note that `expr' is a build-in cook command, * and not the UNIX /bin/expr program. * The same applies to `print'. */ loop n = 1 2 3 4 5 6 7 8 9 10 { [print [expr [n] * [n]]]; } |
Gibt die Quadrate von 1 bis 10
aus. |
COSY INFINITY
![]() |
http://cosy.nscl.msu.edu |
Hello World | Michael Neumann |
{ Hello World in COSY } BEGIN ; WRITE 6 'Hello World' ; { 6 ist Stdout } END ; |
Gibt "Hello World" auf dem Bildschirm
aus. |
C-Talk ![]() |
ähnliche Sprachen: | C C# C++ D Cilk Java Objective-C Pike TOM | |
Beschreibung: | C-Talk ist eine objekt-orientierte Sprache mit statischer, starker Typisierung, Mehrfachvererbung, parametisierten Klassen (Templates), Ausnahmen (Exceptions), Multitasking, persistenten Objekten und Garbage-Collection anstatt expliziter (manueller) Speicherfreigabe. C-Talk erbt beste Eigenschaften von Sprachen wie C++, Smalltalk, Lisp, CLU. |
Eulersche Zahl (1) | Michael Neumann |
(* e = Summe der Reziproken der Fakultäten *) // Fakultäts-Funktion function fac( int n ) returns int { if( n > 1 ) return n * fac(n-1); else return 1; } var arr := [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]; // filter_arr wendet die übergebene Funktion auf jedes Element des // Arrays arr an und schreibt den Rückgabewert zurück ins Array function filter_arr ( proc(float) returns float transform ) { for( var i := 0 ; i < 10; i := i + 1 ) { arr[i] := transform(arr[i]); } } // Fakultäten berechnen // lambda erzeugt eine namenlose Funktion // -> ist ein typecast filter_arr( lambda(float x) returns float { return fac(x -> int) -> float; } ); // Reziproken berechnen filter_arr( lambda(float x) returns float { return 1.0 / x; } ); // Summe bilden var float e := 0.0; filter_arr( lambda(float x) returns float { e := e + x; return x; } ); // e ausgeben cout << e; |
Berechnet die Eulersche Zahl
(e=2.71828). |
Eulersche Zahl (2) | Michael Neumann |
// Fakultäts-Funktion function fac( int n ) returns int { if( n > 1 ) return n * fac(n-1); else return 1; } var e := 0.0; for( var n := 0; n < 10; n := n + 1 ) { e := e + 1.0 / fac(n) -> float; } // e ausgeben cout << e; |
Berechnet die Eulersche Zahl
(e=2.71828). |
Fakultät | Michael Neumann |
/* * Berechnen der Fakultät */ function fac( int n ) returns int { if( n > 1 ) return n * fac(n-1); else return 1; } // Funktion aufrufen cout << fac(6); |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
// Hello World in C-Talk cout << "Hello World\n"; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
(* * Squares (* geschachtelter Kommentar *) *) for( var int i:=1; i<=10; i:=i+1 ) { cout << i * i << " "; } |
Gibt die Quadrate von 1 bis 10
aus. |
Curl ![]() |
www.curl.com |
Hello World | Brent A. Young |
{curl 1.7 applet} {applet license = "personal"} Hello World |
Gibt "Hello World" auf dem Bildschirm
aus. |
Cyclone
![]() |
http://www.research.att.com/projects/cyclone/ |
Beschreibung: | Cyclone is a safe dialect of C. It has lots of other features not found in C, e.g. tagged unions, ML-style datatypes, parametric polymorphism, pattern matching and exceptions. |
Hello World | Michael Neumann |
#include <stdio.h> int main() { printf("Hello World\n"); return 0; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
D ![]() |
http://www.digitalmars.com/d/index.html |
ähnliche Sprachen: | C C# C++ C-Talk Cilk Java Objective-C Pike TOM | |
Beschreibung: |
Features:
|
dBASE ![]() |
Hello World | Pablo Romero |
? "Hello World" return |
Gibt "Hello World" auf dem Bildschirm
aus. |
DOS Batch
![]() |
ähnliche Sprachen: | Shell-Sprachen | |
Hello World | Michael Neumann |
@ECHO OFF ECHO Hello World |
Gibt "Hello World" auf dem Bildschirm
aus. |
Numbers | Michael Neumann |
@ECHO OFF REM Gibt die Zahlen 0-99 aus REM Diese Datei muß numbers.bat heißen IF "%1" == "" GOTO outer IF "%1" == "output" GOTO output IF "%1" == "inner" GOTO inner GOTO exit :inner FOR %%i IN (0 1 2 3 4 5 6 7 8 9) DO CALL numbers output %2 %%i GOTO exit :outer FOR %%i IN (0 1 2 3 4 5 6 7 8 9) DO CALL numbers inner %%i GOTO exit :output IF "%2" == "0" ECHO %3 IF NOT "%2" == "0" ECHO %2%3 :exit |
Gibt die Zahlen von 0 bis 99
aus. |
Dylan ![]() |
http://www.gwydiondylan.org/ |
Beschreibung: | Features:
|
Hello World | Michael Neumann |
define method hello-world() format-out("Hello World\n"); end method hello-world; hello-world(); |
Gibt "Hello World" auf dem Bildschirm
aus. |
OO - Shape, Circle, Rectangle | Michael Neumann |
module: shape synopsis: OO - Shape, Circle, Rectangle author: Michael Neumann copyright: Copyright (c) 2002, Michael Neumann // note: // last two words after "end" are optional // all type specifiers after "::" are optional define class <color> (<object>) slot red :: <number>, init-value: 0, init-keyword: red:; slot green :: <number>, init-value: 0, init-keyword: green:; slot blue :: <number>, init-value: 0, init-keyword: blue:; end class <color>; define class <shape> (<object>) slot x :: <number>, required-init-keyword: x:; slot y :: <number>, required-init-keyword: y:; slot color :: <color>, required-init-keyword: color:; end class <shape>; define class <circle> (<shape>) slot radius :: <number>, required-init-keyword: radius:; end class <circle>; define class <rectangle> (<shape>) slot width :: <number>, required-init-keyword: width:; slot height :: <number>, required-init-keyword: height:; end class <rectangle>; /* Define the methods */ define method move(shape :: <shape>, xo :: <number>, yo :: <number>) shape.x := shape.x + xo; shape.y := shape.y + yo; end method move; define method draw(shape :: <shape>) // do something here end method draw; define method get-area(circle :: <circle>) => (area :: <number>) 3.1415 * circle.radius; end method get-area; define method get-area(rectangle :: <rectangle>) => (area :: <number>) rectangle.width * rectangle.height; end method get-area; /* Test the classes */ define constant $black :: <color> = make(<color>); define constant $white :: <color> = make(<color>, red: 255, green: 255, blue: 255); define variable circle :: <circle> = make(<circle>, x: 100, y: 100, radius: 50, color: $black); define variable rect :: <rectangle> = make(<rectangle>, x: 20, y: 20, width: 5, height: 5, color: $white); move(circle, 10, 10); circle.x := 50; circle.radius := 5; format-out("%=\n", get-area(circle)); // => 15 format-out("%=\n", get-area(rect)); // => 25 format-out("%=\n", rect.width); // => 5 width-setter(10, rect); // another way to set a slot format-out("%=\n", width(rect)); // => 10 draw(circle); draw(rect); |
Squares | Michael Neumann |
for (i :: <integer> from 1 to 10) format-out("%d ",i * i); end for; |
Gibt die Quadrate von 1 bis 10
aus. |
E ![]() |
http://www.erights.org |
Hello World | Michael Neumann |
# Hello World in E // by Michael Neumann println( "Hello World" ) |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
for i in 1..10 { print( i*i ) print( " " ) } |
Gibt die Quadrate von 1 bis 10
aus. |
Eiffel ![]() |
ähnliche Sprachen: | Blue Sather | |
Hello World | Michael Neumann |
indexing title: "Hello World"; author: "Michael Neumann"; class MAIN creation make feature make is do io.put_string("Hello World"); io.new_line end -- make end -- class MAIN |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | SmallEiffel | Michael Neumann |
-- -- compile with: smalleiffel compile helloworld -- indexing title: "Hello World"; author: "Michael Neumann"; class HELLOWORLD creation {ANY} make feature {ANY} make is do std_output.put_string("Hello World"); std_output.put_new_line; end -- make end -- class HELLOWORLD |
Gibt "Hello World" auf dem Bildschirm
aus. |
Emerald
![]() |
Hello World | Michael Neumann |
const HelloWorld == % % Hello World in Emerald % object HelloWorld process stdout.putstring["Hello World\n"] stdin.close stdout.close end process end HelloWorld |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
const Test == object Test process var i : Integer i <- 1 loop exit when (i>10) stdout.putint[i*i] stdout.putstring[" "] end loop stdin.close stdout.close end process end Test |
Gibt die Quadrate von 1 bis 10
aus. |
Erlang ![]() |
http://www.erlang.org |
Hello World | Michael Neumann |
io:fwrite("Hello World~n"). %% im Eingabemodus |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
%% %% language: Erlang 4.7.3 %% author: Michael Neumann %% file: test.erl %% -module(test). -export([main/1]). main(0) -> []; main(N) -> main(N-1), io:fwrite("~w ",[N*N]). %% Eingabemodus: c("test.erl"). %% lädt test.erl test:main(10). |
Gibt die Quadrate von 1 bis 10
aus. |
Euphoria
![]() |
ähnliche Sprachen: | ABC Amos BASIC Profan REXX | |
Abschreckungs-Beispiel | Johann Dieter R. |
-- abschreckendes Beispiel fuer HELLO WORLD! (jdr, 19.10.2000) -- -- -- Diese Routine arbeitet mit dem Software-Interrupt #0E der Video- -- BIOS-Services (#10) ("WRITE TEXT IN TELETYPE MODE"). include machine.e -- benoetigte Include global integer forecol -- Textfarbe global object instruc -- Objekt für die Werte, -- mit denen der Software- -- Interrupt angesprochen -- wird. forecol = 7 instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 72,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 101,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 108,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 108,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 111,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 32,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 87,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 111,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 114,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 108,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 100,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 33,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 10,0,0,0}) instruc = dos_interrupt(#10,{0,0,0,forecol,0,0,#0E00 + 13,0,0,0}) |
Dieses Beispiel dient nur der
Abschreckung! |
Hello World | Michael Neumann |
puts (1, "Hello World\n")
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
for i=1 to 10 do print(1,i*i) puts(1," ") end for |
Gibt die Quadrate von 1 bis 10
aus. |
FISh ![]() |
http://www-staff.it.uts.edu.au/~cbj/FISh/index.html |
Beschreibung: | FISh ist eine funktionale Sprache mit imperativen Eigenschaften. Der FISh Compiler ist in OCaml geschrieben und der erzeugte Code ist hochperformanter C-Code. Laut den Benchmark-Ergebnissen ist Quicksort in FISh doppelt so schnell wie die qsort Routine der C-Standard Bibliothek (weil C Pointer benutzt, FISh nicht). |
Hello World | Michael Neumann |
(* Hello World in FISh *) output "Hello World" ;; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
for 1 <= i < 11 do output (i*i) done;; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
(* Funktion sqr *) let sqr x = x * x ;; (* Array mit 10 Integern *) let a = fill { 10 : int_shape } with [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ;; (* Nun die Funktion sqr auf alle Elemente von Array a anwenden *) let res = map sqr a;; output res;; |
Gibt die Quadrate von 1 bis 10
aus. |
FOP ![]() |
Beschreibung: | Seit vielen Jahren gibt es unter Unix für die betriebswirtschaftliche Software auch eine Scriptsprache names FOP (Flexible Oberflächenprogrammierung) um diese Software anzupassen. |
Hello World | olios@gmx.de |
.box Hello world !!! .ende |
Gibt "Hello World" auf dem Bildschirm
aus. |
Forth ![]() |
http://www.forth.org |
ähnliche Sprachen: | Postscript | |
Abschreckungs-Beispiel | Michael Neumann |
10000 constant ztsd variable zs 2variable tr : zins ztsd m/mod swap zs @ ztsd */ swap zs @ 1 */ + 1 m* ; : restd1 2dup zins d+ tr 2@ d- ; ( d -- d ) : restd 0 do restd1 loop ; ( d -- d ) : tdauer 0 >r 2dup zins tr 2@ d< if begin r> 1 + >r restd1 2dup tr 2@ d< until 2dup d0= if 0 else 1 then r> + else ." keine Tilgung " then ; ( d -- d n ) |
Dieses Beispiel dient nur der
Abschreckung! |
CGI Squares | Michael Neumann |
\ #! /usr/bin/env gforth : HTTP-HEADER ." Content-type: text/html" CR CR ; : <HTML> ." <HTML>" ; : </HTML> ." </HTML>" ; : <HEAD> ." <HEAD>" ; : </HEAD> ." </HEAD>" ; : <TITLE> ." <TITLE>" ; : </TITLE> ." </TITLE>" ; : <BODY> ." <BODY>" ; : </BODY> ." </BODY>" ; : <P> ." <P>" ; : </P> ." </P>" ; : <BR> ." <BR> " ; : <H1> ." <H1>" ; : </H1> ." </H1>" ; \ ============================ : squares() 11 1 DO I DUP * . <BR> LOOP ; \ ============================ HTTP-HEADER <HTML> <HEAD> <TITLE> ." CGI-Squares in Forth" </TITLE> </HEAD> <BODY> <H1> ." CGI-Squares in Forth" </H1> squares() </BODY> </HTML> bye |
CGI - Gibt die Quadrate von 1 bis 10
aus. |
Hello World (1) | Michael Neumann |
( Hello World in Forth ) ." Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
\ Hello World in Forth : say_hello ." Hello World" ; say_hello |
Gibt "Hello World" auf dem Bildschirm
aus. |
Schleifen-Test | Michael Neumann |
: IS 0 DO I . LOOP ; : AS 0 DO CR 1 - DUP IS LOOP ; 11 10 AS |
Gibt folgendes auf dem Bildschirm
aus:0 1 2 3 4 5 6 7 8 9 |
Squares | Michael Neumann |
: squares ( to from --> ) SWAP ( to from --> from to ) 1 + ( from to --> from to+1 ) SWAP ( from to+1 --> to+1 from ) DO I DUP * . LOOP ; 10 1 squares |
Gibt die Quadrate von 1 bis 10
aus. |
Absolutbetrag | ANS Forth | Michael Neumann |
: abs ( value -- value' ) DUP 0< IF NEGATE ENDIF ; |
Fakultät | ANS Forth | Michael Neumann |
\ define function (definiere Funktion) : FAC recursive ( n-n) DUP 1 > IF \ if n > 1 DUP 1 - FAC * \ n * fac n-1 ELSE \ else DROP 1 \ 1 ENDIF \ end ; \ call function (Funtkion aufrufen) 6 FAC . |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät | ANS Forth, pForth | Michael Neumann |
\ define function (definiere Funktion) : FAC ( n-n) DUP 1 > IF \ if n > 1 DUP 1 - RECURSE * \ n * fac n-1 ELSE \ else DROP 1 \ 1 THEN \ end ; \ call function (Funtkion aufrufen) 6 FAC . |
Berechnet die Fakultät. Ergibt
720 . |
Fortran
![]() |
Hello World | Fortran 77 | Michael Neumann |
* C Hello World in Fortran 77 C (lines must be 6 characters indented) * PROGRAM HELLOW WRITE(UNIT=*, FMT=*) 'Hello World' END |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Fortran 77 | Michael Neumann |
PROGRAM SQUARE DO 15,I = 1,10 WRITE(*, *) I*I 15 CONTINUE END |
Gibt die Quadrate von 1 bis 10
aus. |
Hello World | Fortran 90 | Michael Neumann |
PROGRAM HelloWorld PRINT *, "Hello World" END PROGRAM HelloWorld |
Gibt "Hello World" auf dem Bildschirm
aus. |
Matrix Multiplication | Fortran 90 | Michael Neumann |
program TestMatrixMult real, dimension( 3, 3 ) :: A, B, C ! create identity matrix A = 0.0; do i = 1, size(A); A(i,i) = 1.0; end do ! initialize matrix randomly call random_number( B ) ! multiply matrices A and B C = matrixMult( A, B ) ! output the three matrices print *, A, B, C contains ! ! Alternatively use built-in function 'matmul' ! (another built-in is 'dot_product') ! function matrixMult( A, B ) result ( C ) implicit none real, dimension( :, : ), intent( in ) :: A ! m x n real, dimension( :, : ), intent( in ) :: B ! n x p real, dimension( size(A, 1), size(B, 2) ) :: C ! m x p integer i, j do i = 1, size(C, 1) do j = 1, size (C, 2) C(i, j) = sum( A(i, :) * B(:, j) ) end do end do end function matrixMult end program TestMatrixMult |
FOX ![]() |
Hello World | Pablo Romero |
? "Hello World" return |
Gibt "Hello World" auf dem Bildschirm
aus. |
Gofer ![]() |
ähnliche Sprachen: | ML Haskell Hope Objective Caml Miranda | |
Beschreibung: | Gofer ist eine funktionale, Haskell-aehnliche Programmiersprache. |
Ackermann | Michael Neumann |
ackermann 0 n = n + 1 ackermann m 0 = ackermann (m-1) 1 ackermann m n = ackermann (m-1) (ackermann m (n-1)) |
ADT Keller | Michael Neumann |
data Keller a = Create | Push (Keller a) a pop :: Keller a -> Keller a top :: Keller a -> a empty :: Keller a -> Bool empty (Create) = True empty (Push k x) = False pop (Push k x) = k top (Push k x) = x -------------------------------------------- f1 = top(Push (Create) 3) f2 = top(Push (Push (Create) 3) 4) f3 = empty(pop(Push (Push (Create) 3) 4)) f4 = Push (pop(Push (Push (Create) 3) 5)) 2 f5 = pop(Push (pop(Push (Push (Create) 3) 4)) 2) |
Implementation des ADT (abstrakten
Datentyps) Keller. |
Fakultät | Michael Neumann |
-- -- Fakultaet in Gofer -- fac :: Int -> Int fac 0 = 1 fac n = n * fac(n-1) -- Im Gofer-Interpreter folgendes eingeben: fac 6 |
Berechnet die Fakultät. Ergibt
720 . |
GgT | Michael Neumann |
ggt :: Int -> Int -> Int ggt p q = if p `rem` q /= 0 then ggt q (p `rem` q) else q |
Grösster Gemeinsamer
Teiler |
Hello World | Michael Neumann |
show "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Länge einer Liste | Michael Neumann |
len [] = 0 len (h:t) = len t + 1 |
Bestimmt die Länge einer
Liste. |
MergeSort | Michael Neumann |
mmerge :: [Int] -> [Int] -> [Int] mmerge [] [] = [] mmerge a [] = a mmerge [] b = b mmerge (ha:ta) (hb:tb) = if ha < hb then [ha] ++ mmerge ta (hb:tb) else [hb] ++ mmerge (ha:ta) tb mergesort :: [Int] -> [Int] mergesort [] = [] mergesort l = if length l == 1 then l else mmerge (mergesort (drop n l)) (mergesort (take n l)) where n = length l / 2 |
MergeSort |
Haskell
![]() |
http://www.haskell.org |
ähnliche Sprachen: | ML Gofer Hope Objective Caml Miranda | |
Beschreibung: | Haskell is a pure lazy functional programming language:
|
Fakultät (1) | Michael Neumann |
fac 0 = 1 fac n = n * fac (n-1) -- type "fac 6" to calculate the result |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
fac n | n == 0 = 1 | otherwise = n * fac (n-1) -- type "fac 6" to calculate the result |
Berechnet die Fakultät. Ergibt
720 . |
Fibonacci | Mirko Rahn |
-- ersten zwanzig Fibonacci-Zahlen -- by Mirko Rahn <mai99dla@studserv.uni-leipzig.de> module Main where fibs = 1 : 1 : zipWith (+) fibs (tail fibs) main = print $ take 20 fibs -- Ausgabe: -- [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765] |
Gibt die ersten 20 Fibonacci-Zahlen
aus. |
HaXml Demo Application | Michael Neumann |
{- Demo Application using HaXml 1.02 Copyright (c) 2001 by Michael Neumann $Id: haxml-demo.hs,v 1.1 2001/10/17 22:41:17 michael Exp $ HaXml: http://www.cs.york.ac.uk/fp/HaXml Compile with: hmake -nhc98 haxml-demo For sample XML file, see below. -} module Main where import XmlLib import XmlCombinators main = processXMLwith ( mkElem "HTML" [ mkElem "BODY" [ message `o` (tag "messages" /> tag "message") ] ] ) message = mkElem "DIV" [ -- Message Title mkElem "DIV" [ mkElem "B" [ ("["!) , tag "message" /> tag "category" /> txt , ("] "!) ] , mkElem "EM" [ txt `o` children `o` tag "title" `o` children `o` tag "message" ] , literal " at " , tag "message" /> tag "date" /> txt , literal " sent by " , tag "message" /> tag "author" ?> mkElemAttr "A" [ ("HREF", (tag "message" /> tag "author" /> tag "email" /> txt) ) ] [ tag "message" /> tag "author" /> tag "name" /> txt ] :> literal "Unknown Person" ] , -- Message Body mkElem "DIV" [ keep `o` (tag "message" /> tag "text") ] , mkElem "BR" [] ] {- Sample XML file follows: <?xml version="1.0"?> <messages> <message id="1"> <date>2001-12-31</date> <category>Admin</category> <title>CVS Updated</title> <text>CVS has been updated.</text> </message> <message id="2"> <author> <name>Michael</name> <email>mneumann@ntecs.de</email> </author> <date>2001-12-30</date> <category>Programming</category> <title>New function</title> <text>New method <font color="red">set_parser</font> in module XXX.</text> </message> </messages> -} |
Transforms a XML document. |
Hello World | Michael Neumann |
module HelloWorld (main) where main = putStr "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
InsertionSort | Michael Neumann |
module InsertionSort (insertionSort) where import List (insert) insertionSort :: Ord a => [a] -> [a] insertionSort = foldl (\ a b -> insert b a) [] |
Sortieren durch Einfuegen |
InsertionSort (2) | Michael Neumann |
module InsertionSort (insertionSort) where -- insert is already defined in module List of Haskell 98 insert e [] = [e] insert e lst@(x:xs) | e < x = e : lst | otherwise = x : (insert e xs) insertionSort lst = insertionSort' lst [] where insertionSort' [] lst = lst insertionSort' (x:xs) lst = insertionSort' xs (insert x lst) |
Sortieren durch Einfuegen |
Quicksort | Michael Neumann |
quicksort [] = [] quicksort (s:xs) = quicksort [x|x <- xs,x < s] ++ [s] ++ quicksort [x|x <- xs,x >= s] |
Quicksort-Sortieralgorithmus
|
Squares (1) | Michael Neumann |
-- -- written in Haskell 1.4 (Hugs 1.4 for Windows) -- by Michael Neumann -- module Squares (main) where square :: [Int] -> String square [] = "\n" square (h:t) = show (h*h) ++ " " ++ square t main = putStr (square [1..10]) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Matthias Mann |
-- -- von Matthias Mann -- module Squares (main) where import List main = putStr . concat . intersperse " " . map (show . (^2))) [1..10] |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | Michael Neumann |
-- construct a conceptual infinite list of numbers starting at 1 numbersFrom n = n : numbersFrom (n+1) -- conceptual infinite list of square numbers starting at 1 squares = map (^2) (numbersFrom 1) -- take the first 10 square numbers take 10 squares |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (4) | Mirko Rahn |
-- ersten zehn Quadrate -- by Mirko Rahn <mai99dla@studserv.uni-leipzig.de> module Main where squares n m = [ i^2 | i <- [n..m] ] main = print $ squares 1 10 -- Ausgabe: [1,4,9,16,25,36,49,64,81,100] |
Gibt die Quadrate von 1 bis 10
aus. |
Hello World | Glasgow Haskell Compiler (GHC) | Michael Neumann |
-- file: Main.hs -- compile: ghc --make Main -o main module Main (main) where main = putStr "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
HB (Hyper Builder)
![]() |
http://bachue.com/hb |
Beschreibung: | Hyper Builder (HB) ist eine Sprache, mit der sich sehr leicht dynamische Webseiten generieren lassen. Man kann eingene HTML-Tags erstellen, die durch einen selbst definierten Block ersetzt werden. In einer HB-Seite kann man mehrere Blöcke speziell kennzeichnen, die dann mittels einer URL von einem Webbrowser angezeigt werden können. Somit kann man sehr leicht zusammengehörige HTML-Seiten in einer HB-Datei unterbringen, die jedoch jeweils als eigene HTML-Seiten angezeigt werden. Es stehen schon fertige Tags für folgende Anwendungsgebiete zur Verfügung: Authentifizierung, SQL-Abfragen (MySQL, PostgreSQL), Umfragen, Counter, Emails, Cookies... Insgesamt eine, im Vergleich zu anderen Sprachen wie XML/XSL, PHP oder Perl, sehr einfach anzuwendende Sprache (auch für Designer), die trotzdem von der Leistungsfähigkeit diesen Sprachen in nichts nachsteht. |
Einfaches HTML-Formular | Michael Neumann |
:set page <html> <head><title>Einfaches HTML-Formular</title></head> <body> : :set /page </body></html> : # definiert das Formular :set formular.show <form action="formular.send"> Anrede: <input type="radio" name="Anrede" value="Herr"> Herr <input type="radio" name="Anrede" value="Frau" checked> Frau <br><br> Ihr Name: <input type=text name="Name"> <input type=submit value="Senden"> </form> : # wird aufgerufen, wenn das Formular abgesendet wird # "hb.cgi" liest die vom Formular übergebenen Parameter :out formular.send <page> Hallo <hb.cgi name="Anrede"> <hb.cgi name="Name">! <br><hr> <formular.show> <br> <a href="main">Start</a> </page> : # wird ganz am Anfang aufgerufen :out main <page> <formular.show> </page> : |
Zeigt ein Formular im Browser, wobei
nach dem Namen und Anrede gefragt wird. Wenn der Benutzer das
Formular absendet, wird er mit "Hallo Herr/Frau X"
begrüßt. Darunter wird das Formular wieder
angezeigt. |
Hello World | Michael Neumann |
# definiere ein Objekt HelloWorld :set HelloWorld <b>HelloWorld</b> : # definiert das Startobjekt, welches man mittels URL aufrufen kann :out main <html><head></head><body> <HelloWorld> <!-- ruft das Objekt HelloWorld auf --> </body></html> : |
Zeigt "Hello World" im Webbrowser
an. |
Hope ![]() |
ähnliche Sprachen: | ML Haskell Gofer Objective Caml Miranda | |
Hello World | Michael Neumann |
"Hello World\n";
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
! gibt die Quadrate von 1 bis 10 aus dec squares : num -> list(num); --- squares 0 <= nil; --- squares x <= squares(x-1) <> [x*x]; squares 10; |
Gibt die Quadrate von 1 bis 10
aus. |
HPGL ![]() |
Beschreibung: | HPGL - Hewlett-Packard Graphics Language. On certain machines (Laser printers), it may be necesary to issue the escape sequence ESC%1B to enter HPGL mode. ESC%1A will exit HPGL mode if you used the above escape sequence. |
Hello World | Jay Keck |
IN1; CO "Initialization string, restores defaults"; PA 0,0; CO "Absolute positioning at 0,0"; PR 1000,1000; CO "Relative postitioning - x+=1000 plu, y+=1000plu"; CO "1 mm = 40 PLU"; DT 1,*; CO "Use * as a label delimeter, and don't print it"; SP1; CO "Select Pen 1 (black)"; PD; CO "Pen down (like logo)"; LBHello world!*; PU; CO "Pen up"; PA0,0; CO "Back to the origin"; SP0; CO "Select Pen 0 (All done)"; |
Gibt "Hello World" auf dem Bildschirm
aus. |
HTML ![]() |
ähnliche Sprachen: | SGML WML (Wireless Markup Language) XHTML XML | |
Hello World | Michael Neumann |
<!-- Hello World in HTML --> <html> <head> <title>Hello World</title> </head> <body> Hello World </body> </html> |
Gibt "Hello World" auf dem Bildschirm
aus. |
IBM EXEC
![]() |
Hello World | IBM EXEC (VM/CMS) | B. Bora Bali |
&CONTROL * &TYPE Hello World! * &EXIT 0 |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | IBM EXEC2 (VM/CMS) | B. Bora Bali |
&TRACE OFF * &TYPE Hello World! * &EXIT 0 |
Gibt "Hello World" auf dem Bildschirm
aus. |
Icon ![]() |
Hello World | Michael Neumann |
procedure main(args) write("Hello World\n") end |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
# gibt die Quadrate von 1 bis 10 aus procedure main(args) every i := 1 to 10 do { write(i*i, " ") } end |
Gibt die Quadrate von 1 bis 10
aus. |
J ![]() |
ähnliche Sprachen: | A+ APL K | |
Eulersche Zahl (1) | Michael Neumann |
+/ % ! i. 9 |
Berechnet die Eulersche Zahl
(e=2.71828). |
Eulersche Zahl (2) | Martin Neitzel |
1x1 |
Berechnet die Eulersche Zahl
(e=2.71828). |
Hello World | Michael Neumann |
'Hello World'
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
a =. 1 + i. 10 a * a |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Javier Gamero |
*:>:i.10 |
Gibt die Quadrate von 1 bis 10
aus. |
Java ![]() |
ähnliche Sprachen: | C C# C++ C-Talk D Cilk Objective-C Pike TOM | |
Hello World (Applet) | Michael Neumann |
import java.applet.*; import java.awt.*; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello World",10,10); } } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (Application) | Michael Neumann |
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (Servlet) | Michael Neumann |
/* * Hello World in Java (Servlet) */ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet { public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out; String text = "Hello World in Java (Servlet)"; response.setContentType("text/html"); out = response.getWriter(); out.println("<html><head><title>"); out.println(text); out.println("</title></head><body>"); out.println(text); out.println("</body></html>"); out.close(); } } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (Swing-GUI) | Michael Neumann |
import javax.swing.*; class HelloWorldSwing { public static void main(String args[]) { JFrame mainWin = new JFrame("MainWindow"); JButton button = new JButton("Hello World"); mainWin.getContentPane().add(button); mainWin.pack(); mainWin.show(); } } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Multi-threading | Michael Neumann |
public class ThreadTest implements Runnable { public static void main(String args[]) { int i, j; // create 1000 threads for (i=0; i<=1000; i++) { Thread th = new Thread(new ThreadTest()); th.start(); } // do some calculation for(i=j=0; i<=100000; i++) { j = j + i; } } public void run() { try { // sleep forever Thread.currentThread().sleep(1000000); } catch (InterruptedException e) {} } } |
Create 1000 threads that
sleep. |
JavaScript
![]() |
Hello World (1) | Michael Neumann |
<html> <body onload="onload()"> <script language="JavaScript"> <!-- // JavaScipt in einer HTML-Seite eingebettet function onload() { document.writeln('Hello World'); } //--> </script> </body> </html> |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Gary Haran |
<html> <head> <title>Javascript Hello World</title> </head> <body> <script> document.write("Hello World!"); </script> </body> </html> |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Gary Haran |
<html> <head> <title>Javascript Squares</title> </head> <body> <script> for (var i = 1; i <= 10; ++i) { document.write( Math.pow(i, i) + "<br>" ); } </script> </body> </html> |
Gibt die Quadrate von 1 bis 10
aus. |
Jovial ![]() |
http://www.bath.ac.uk/~cs1lomp/jovial/index.php |
Beschreibung: | Jovial is Jules' own version of IAL (international algorithmic language). It's similar to ALGOL 60 and was mainly used by the US Air Force. |
K ![]() |
http://www.kx.com |
ähnliche Sprachen: | A+ APL J | |
Eulersche Zahl | Michael Neumann |
/ die Eulersche Zahl ist die Summe der Reziproken der Fakultäten fac:{*/1+!x} / Fakultät-Funktion +/ % fac' ! 10 / fac' wendet die Funktion auf eine Liste an (EACH) |
Berechnet die Eulersche Zahl
(e=2.71828). |
Fakultät (iterativ) | Michael Neumann |
fac:{ */ 1 + !x } / { ... } ist eine Fuktion fac @ 6 / Funktion aufrufen mit 6 als Parameter |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (rekursiv) | Michael Neumann |
fac: { if[ x>1; : x * fac[x-1] ] / wenn x>1, x * fac(x-1) zurückgeben :1 / ansonsten 1 zurückgeben } / oder kürzer: fac: {:[x>1; x * fac[x-1]; 1]} / oder ohne den Funktionsnamen zu verwenden: fac: {:[x>1; x * _f[x-1]; 1]} fac . 6 / Funktion aufrufen mit 6 als Parameter |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
/ Hello World in K ` 0:"Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
i:1 + !10 `0:5:i*i |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
i:1 + !10 / erzeugt liste von 1-10 und weist diese 'i' zu `0:5:i*i / `0:x gibt x auf Bildschirm aus / 5:x wandelt x in String |
Gibt die Quadrate von 1 bis 10
aus. |
Labview
![]() |
Beschreibung: | Labview is a visual programming tool. |
Complex Example | Norbert Silberhorn |
|
This screenshot shows a complex
program in Labview. |
LaTeX ![]() |
Fakultät | Mirko Rahn |
% Fakultät by Mirko Rahn <mai99dla@studserv.uni-leipzig.de> \documentclass{article} \usepackage{ifthen} \newcounter{multi} \newcounter{multa} % berechnet #1 * #2 in multa \newcommand{\mult}[2]{ \setcounter{multi}{1} \setcounter{multa}{#1} \whiledo{\themulti < #2}{ \addtocounter{multa}{#1} \stepcounter{multi} } } \newcounter{faki} \newcounter{faka} % berechnet #1! \newcommand{\fac}[1]{ \setcounter{faka}{1} \setcounter{faki}{2} \whiledo{\thefaki < #1}{ \mult{\thefaka}{\thefaki} \setcounter{faka}{\themulta} \stepcounter{faki} } \mult{\thefaka}{\thefaki} \themulta } \begin{document} $6!=\fac{6}$ \end{document} % Ausgabe: 6!=720 |
Berechnet die Fakultät. Ergibt
720 . |
Fibonacci | Mirko Rahn |
% ersten zwanzig Fibonacci-Zahlen % by Mirko Rahn <mai99dla@studserv.uni-leipzig.de> \documentclass{article} \usepackage{ifthen} \newcounter{fiba} \newcounter{fibb} \newcounter{fibc} \newcounter{fibrun} % fib{k} gibt die k-te Fibonaccizahl F_k \newcommand{\fib}[1]{ \init \whiledo{\thefibrun < #1}{ \step \stepcounter{fibrun} } \thefiba } \newcommand{\init}{ \setcounter{fiba}{1}\setcounter{fibb}{1}\setcounter{fibrun}{0} } \newcommand{\step}{\add \rotate} \newcommand{\add}{\setcounter{fibc}{\thefiba}\addtocounter{fibc}{\thefibb}} \newcommand{\rotate}{\setcounter{fiba}{\thefibb}\setcounter{fibb}{\thefibc}} \begin{document} \newcounter{i} \newcounter{en} \setcounter{en}{20} Die ersten \theen\ Fibonacci-Zahlen lauten:\\ \whiledo{\thei < \theen}{$\fib{\thei}$ \stepcounter{i}} \end{document} % Ausgabe: Die ersten 20 Fibonacci-Zahlen lauten: % 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 |
Gibt die ersten 20 Fibonacci-Zahlen
aus. |
Hello World | Michael Neumann |
% Hello World in LaTeX \documentclass[a4paper]{report} \title{Hello World in LaTeX} \begin{document} Hello World \end{document} |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Mirko Rahn |
% ersten zehn Quadrate % by Mirko Rahn <mai99dla@studserv.uni-leipzig.de> \documentclass{article} \usepackage{ifthen} \newcounter{multi} \newcounter{multa} % berechnet #1 * #2 \newcommand{\mult}[2]{ \setcounter{multi}{1} \setcounter{multa}{#1} \whiledo{\themulti < #2}{ \addtocounter{multa}{#1} \stepcounter{multi} } \themulta } \begin{document} \newcounter{i} \newcounter{en} \setcounter{i}{1} \setcounter{en}{10} Die ersten \theen\ Quadrate lauten: \stepcounter{en} \whiledo{\thei < \theen}{$\mult{\thei}{\thei}$ \stepcounter{i}} \end{document} % Ausgabe: Die ersten 10 Quadrate lauten: 1 4 9 16 25 36 49 64 81 100 |
Gibt die Quadrate von 1 bis 10
aus. |
Leda ![]() |
ähnliche Sprachen: | Modula Oberon Obliq Pascal Phantom PL/0 PL/0E YAFL | |
Hello World | Michael Neumann |
{ Hello World in Leda } include "std.led"; begin print("Hello World"); end; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
include "std.led"; var i:integer; begin for i:=1 to 10 do begin print("" + i*i + " "); end; end; |
Gibt die Quadrate von 1 bis 10
aus. |
LIRL ![]() |
Beschreibung: | Daniel Foesch <dfoesch@cs.nmsu.edu>: LIRL, "List Implicit Recursive Language" appears to be very similar to functional languages, but rather than everything being functions, everything is variables (a function is just an array of expressions executed in a particular order). There is no distinction given between functions, variables and arrays, except how they are used. It also oddly enough, has both lazy and eager evaluation, under particular circumstances. Something very interesting indeed... It could also be akined to LISP since it works on lists in a very similar way to the whole LISP/Scheme family, except that the lists are generally implicitly determined, and are extented or shortened by various operators. The only time explicit list construction is done is when you need a list within a list, where there is no operator. |
Fakultät | Daniel Foesch |
sub fac 1, if == 1 @[0] 1, ( * @[0] &fac -- @[0] ), |
Berechnet die Fakultät. Ergibt
720 . |
Fibonacci Sequence | Daniel Foesch |
sub fib 1, if <= 1 @[0] 1, &fib -- @[0] & fib - @[0] 2 |
Hello World | Daniel Foesch |
print "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Lisp ![]() |
ähnliche Sprachen: | Scheme | |
Hello World | Michael Neumann |
(print "Hello World")
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Fakultät (iterativ) | Common Lisp | Marco Baringer |
(defun fact (n) (loop for i from 2 to n for fact = 1 then (* fact i) finally (return fact))) (format t "Factorial of 6 is: ~A~%" (fact 6)) |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (rekursiv) | Common Lisp | Marco Baringer |
(defun fact (n) (if (zerop n) 1 (* n (fact (1- n))))) (format t "Factorial of 6 is: ~A~%" (fact 6)) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Common Lisp | Marco Baringer |
(write-line "Hello World!") |
Gibt "Hello World" auf dem Bildschirm
aus. |
OO - Shape, Circle, Rectangle | Common Lisp | Marco Baringer |
;; define the various classes (defclass shape () ((pos-x :type real :accessor pos-x) (pos-y :type real :accessor pos-y)) (:documentation "A generic shape in a 2 dimensial plane")) (defclass rectangle (shape) ((width :type real :accessor width) (height :type real :accessor height)) (:documentation "A rectangle")) (defclass cirle (shape) ((radius :type real :accessor x-radius)) (:documentation "An cirlce")) ;; define the methods (defmethod move-to ((thing shape) new-x new-y) "Move the shape THING to the new position (new-x, new-y)" (setf (pos-x thing) new-x (pos-y thing) new-y)) (defmethod shift-to ((thing shape) delta-x delta-y) "Move the shape THING by (delta-x, delta-y)" (incf (pos-x thing) delta-x) (incf (pos-y thing) delta-y)) (defmethod scale ((rec rectangle) factor) "Scale the rectangle REC by factor" (with-slots (width height) rec (setf width (* factor width) height (* factor height)))) (defmethod scale ((cir circle) factor) "Scale the circle CIR by factor" (setf (radius cir) (* (radius cir) factor))) |
Squares (1) | Common Lisp | Friedrich Dominicus |
(defun print-squares (upto) ( loop for i from 1 to upto do (format t "~A^2 = ~A~%" i (* i i)))) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Common Lisp | Marco Baringer |
(dotimes (i 10) (format t "~D " (expt i 2))) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | Common Lisp | Marco Baringer |
(loop for i from 1 upto 10 for i^2 = (expt i 2) do (format t "~D " i^2)) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares | Emacs Lisp | Michael Neumann |
(let ( (a 1) ) (while (<= a 10) (princ (* a a)) (princ " ") (setq a (+ a 1)) ) ) |
Gibt die Quadrate von 1 bis 10
aus. |
Logo ![]() |
Hello World | Michael Neumann |
print [Hello World] |
Gibt "Hello World" auf dem Bildschirm
aus. |
Lout ![]() |
Hello World | Michael Neumann |
@SysInclude {doc} @Doc @Text @Begin Hello World @End @Text |
Gibt "Hello World" auf dem Bildschirm
aus. |
Lua ![]() |
http://www.tecgraf.puc-rio.br/lua/ |
Beschreibung: | "Lua is a powerful, light-weight programming language designed for extending applications. Lua is also frequently used as a general-purpose, stand-alone language." "Lua combines simple procedural syntax (similar to Pascal) with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from bytecodes, and has automatic memory management, making it ideal for configuration, scripting, and rapid prototyping." Lua has a very small footprint and let's itself very easy embed into other languages. |
Fakultät | Michael Neumann |
function fac(n) if n < 2 then return 1 else return n * fac(n-1) end end print(fac(6)) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
-- Hello World in Lua print("Hello World\n") |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
-- for var = from, to [, step] do block end for i = 1, 10, 1 do print(i*i) end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
function range(from, to) arr, inx = {}, 0 for i = from, to do arr[inx] = i inx = inx + 1 end return arr end for index, value in range(1, 10) do print(index .. "^2 = " .. value) end |
Gibt die Quadrate von 1 bis 10
aus. |
Make ![]() |
Hello World | Michael Neumann |
#
# Hello World in Make
#
main-target:
@echo "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
RANGE=1 2 3 4 5 6 7 8 9 10 main: @for i in ${RANGE}; do \ echo `expr $$i \* $$i`; \ done |
Gibt die Quadrate von 1 bis 10
aus. |
Mercury
![]() |
http://www.cs.mu.oz.au/research/mercury/ |
Beschreibung: | From Mercurys homepage: "Mercury is a new logic/functional programming language, which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features. Its highly optimized execution algorithm delivers efficiency far in excess of existing logic programming systems, and close to conventional programming systems. Mercury addresses the problems of large-scale program development, allowing modularity, separate compilation, and numerous optimization/time trade-offs." |
Fakultät | Michael Neumann |
:- module factorial. :- interface. :- pred factorial(int::in, int::out) is det. :- implementation. :- import_module int. factorial(N, R) :- ( if N =< 1 then R = 1 else factorial(N - 1, R0), R = N * R0 ). |
Hello World | Michael Neumann |
% Hello World in Mercury % % compile with: % mmake hello.depend % mmake hello :- module hello. :- interface. :- import_module io. % di=desctructive input, uo=unique output :- pred main(io__state::di, io__state::uo) is det. :- implementation. % "-->" tells that we are using DCG (definite clause grammar), which frees us % from threading some extra arguments through the code. main --> io__write_string("Hello World\n"). |
Gibt "Hello World" auf dem Bildschirm
aus. |
Länge einer Liste | Michael Neumann |
% % Calculates the length of a list % :- import_module list, int. :- pred length(list(T)::in, int::out) is det. length(L, N) :- ( % if L is empty L = [], N = 0 ; % else L = [_Hd | Tl], length(Tl, N0), N = N0 + 1 ). |
Bestimmt die Länge einer
Liste. |
merd ![]() |
http://merd.sf.net |
Beschreibung: | From merd's homepage: merd is a language inspired (mainly) by Caml, O'Haskell and Ruby. It also has many features of Dylan. Features:
All in all, sounds like a really interesting languge, even if not yet an interpreter is available. |
Fakultät | Pixel |
# Drei Fakultäts Funktionen fact := 0 -> 1 n -> n * fact(n-1) fact'(n) := if n == 0 then 1 else n * fact'(n-1) fact''(n) := fact = 1 while n >= 0 do fact *= n n-- fact |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Pixel |
# Hello World in merd "Hello World!".println |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Pixel |
println( 1..10.map(n -> "{n ** 2}").join(" ") ) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Pixel |
1..10.map(** 2 ~ to_string).join(" ").println
|
Gibt die Quadrate von 1 bis 10
aus. |
Miranda
![]() |
ähnliche Sprachen: | ML Haskell Gofer Hope Objective Caml | |
Fakultät (1) | Michael Neumann |
fac 0 = 1 fac 1 = 1 fac n = n * fac (n-1) |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
fac n = n * fac (n-1), if n >= 2 = 1, if n < 2 |
Berechnet die Fakultät. Ergibt
720 . |
GgT | Martin Guy |
gcd a b = gcd (a-b) b, if a>b = gcd a (b-a), if a<b = a, if a=b |
Grösster Gemeinsamer
Teiler |
Hello World | Martin Guy |
"Hello World!"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Quicksort | Martin Guy |
qsort [] = [] qsort (a:x) = qsort [ b | b <- x; b<=a ] ++ [a] ++ qsort [ b | b <- x; b>a ] |
Quicksort-Sortieralgorithmus
|
Squares (1) | Martin Guy |
map (^2) [1..10] |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Martin Guy |
[ n*n | n <- [1..10] ] |
Gibt die Quadrate von 1 bis 10
aus. |
Moby ![]() |
http://moby.cs.uchicago.edu/ |
Beschreibung: | From Moby's homepage:
Moby is an experiment in language design and implementation. Our goal is to combine support for class-based object-oriented programming and higher-order concurrency with the desirable features of ML-like languages: advanced module systems, parametric polymorphism, inductive datatypes, pattern matching, and first-class functions. The Moby project started out as a testbed for the design of ML2000. Features:
|
Hello World | Michael Neumann |
// Hello World in Moby module Main { val () = ConsoleIO.print "Hello World\n" } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Modula ![]() |
ähnliche Sprachen: | Oberon Obliq Leda Pascal Phantom PL/0 PL/0E YAFL | |
Hello World | Modula-2 | Michael Neumann |
(* Hello World! *) MODULE HelloWorld; FROM InOut IMPORT WriteString, WriteLn; BEGIN WriteString('Hello World'); WriteLn; END HelloWorld. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Modula-3 | Michael Neumann |
(* Hello World! *) MODULE HelloWorld EXPORTS Main; IMPORT SIO; BEGIN SIO.PutText("Hello World\n"); END HelloWorld. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Modula-3 | Michael Neumann |
MODULE Squares EXPORTS Main; IMPORT SIO; BEGIN FOR i:=1 TO 10 DO SIO.PutInt(i*i); SIO.PutText(" "); END; END Squares. |
Gibt die Quadrate von 1 bis 10
aus. |
mpC ![]() |
http://www.ispras.ru/~mpc |
Beschreibung: | mpC ist eine Erweiterung von ANSI C für Paralleles Rechnen. |
MUMPS ![]() |
ähnliche Sprachen: | Caché ObjectScript | |
Beschreibung: | MUMPS (auch bekannt als M) steht für "Massachusetts general hospital Utility MultiPurpose System". Intersystems Caché ist MUMPS kompatibel! |
Hello World (1) | Connel MacKenzie |
HELLO W "Hello World",! Q |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Connel MacKenzie |
HELLO ; C. MacKenzie ; 3/30/2001 ; "Hello World" routine WRITE "Hello World",! QUIT |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (Interpretierter Modus) | Connel MacKenzie |
>W "Hello World",! |
Gibt "Hello World" auf dem Bildschirm
aus. |
Sortieren | Connel MacKenzie |
SORT ; C. MacKenzie ; 3/30/2001 ; print out array X sorted ZWRITE X QUIT ; Aufrufen vom interpretierten Modus aus: >KILL SET X("Hello")=" World?",X("WORLD")="Hi there." DO ^SORT ; result: ; X("Hello")=" World?" ; X("WORLD")="Hi there." ; Anderes Beispiel: >S X("Hello","World")="" ZW X ; result: ; X("Hello","World")="" |
Gibt ein Array sortiert
aus. |
Squares (1) | Connel MacKenzie |
SQUARES F I=1:1:10 W I*I," " W ! Q |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Connel MacKenzie |
SQUARES ; C. MacKenzie ; 3/30/2001 ; output squares from 1 to 10 FOR I=1:1:10 WRITE I*I," " WRITE ! QUIT |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (Interpretierter Modus) | Connel MacKenzie |
>F I=1:1:10 W I*I," " |
Gibt die Quadrate von 1 bis 10
aus. |
NESL ![]() |
Hello World | Michael Neumann |
% Hello World % print_string("Hello World\n"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
function pt(x) = print_string( @(a*a) ++ " " ); { pt(a) : a in [1..11] }; |
Gibt die Quadrate von 1 bis 10
aus. |
Oberon ![]() |
ähnliche Sprachen: | Modula Obliq Leda Pascal Phantom PL/0 PL/0E YAFL | |
Hello World | Michael Neumann |
MODULE HelloWorld; IMPORT Out; BEGIN Out.Open; Out.String('Hello World'); END HelloWorld. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Objective-C
![]() |
ähnliche Sprachen: | C C# C++ C-Talk D Cilk Java Pike TOM | |
Hello World (1) | Michael Neumann |
void main() { printf("Hello World\n"); } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
#import "objc/Object.h" // // Compile with: // // cc hw.m -o hw -lobjc -lm // @interface HelloWorld : Object { STR msg; // Instance Variable } + new; // Class/Factory method - print; // Instance method - setMessage: (STR) m; // " " @end @implementation HelloWorld + new { self = [super new]; msg = ""; return self; } - print { printf("%s\n", msg); return self; } - setMessage: (STR) m { msg = m; return self; } @end int main(int argc, char**argv) { id obj; obj = [HelloWorld new]; [[obj setMessage: "Hello World"] print]; return 0; } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
void main() { int i; for(i = 1; i <= 10; i++) printf("%d ", i*i); } |
Gibt die Quadrate von 1 bis 10
aus. |
Objective Caml
![]() |
http://caml.inria.fr |
ähnliche Sprachen: | ML Haskell Gofer Hope Miranda | |
Beschreibung: |
Objective Caml, kurz OCaml, ist eine objekt-orientierte, funktionale Sprache die auch den imperativen Programmierstil unterstützt. OCaml stammt von Caml ab. Beide gehören zur ML-Familie (MetaLanguage). Zwei OCaml Programme gewannen den ersten und zweiten Preis beim ICFP Programmierwettbewerb (http://www.cs.cornell.edu/icfp/). OCaml is strict-evaluating, has mutable datastructures, loops, classes, generic classes, modules, lazy streams.OCaml's Garbage Collector: Generational with two generations (old and new). Stop & Copy on new generation (minor GC), incremental Mark & Sweep on old generation (major GC). Compact memory (complete reordering; generate one large piece of free memeory instead of many small) if no more enough free memory is available. |
Fakultät (1) | Michael Neumann |
let rec fac n = if n > 1 then n * fac (n-1) else 1 ;; print_int fac(6);; |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
(* mit Pattern-Matching *) let rec fac n = match n with 0 -> 1 | n -> n * fac (n-1) ;; print_int fac(6);; |
Berechnet die Fakultät. Ergibt
720 . |
GgT | Michael Neumann |
let rec ggt p q = let r = p mod q in if r != 0 then ggt q r else q ;; |
Größter gemeinsamer
Teiler |
Hello World | Michael Neumann |
(* Hello World in Objective Caml *) print_string("Hello World\n");; |
Gibt "Hello World" auf dem Bildschirm
aus. |
InsertionSort | Michael Neumann |
(* insert e into ordered list lst *) let rec insert e lst = match lst with [] -> [e] | x :: xs -> if e < x then e :: lst else x :: (insert e xs) ;; let insertionSort = let insert' a b = insert b a in List.fold_left insert' [] ;; |
Sortieren durch Einfuegen |
Länge einer Liste | Michael Neumann |
let rec length l = match l with [] -> 0 | head :: tail -> 1 + length tail ;; |
Die Länge einer beliebigen Liste
wird berechnet. |
Squares (funktional) | Michael Neumann |
List.map(function n -> n * n) [1;2;3;4;5;6;7;8;9;10];;
|
Gibt die Quadrate von 1 bis 10
aus. |
Squares (imperativ) | Michael Neumann |
for i=1 to 10 do print_int (i*i); print_string " "; done;; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (rekursiv) | Michael Neumann |
let rec iter (a, b) = if a <= b then ( print_int(a*a); print_string(" "); iter(a+1, b); ) else print_newline();; iter(1,10);; |
Gibt die Quadrate von 1 bis 10
aus. |
XML-RPC parser | Michael Neumann |
(* * Copyright (c) 2001 by Michael Neumann * * this program parses a XML-RPC document * * $Id: parser.ml,v 1.1 2001/07/26 08:56:40 michael Exp $ *) open Pxp_yacc;; open Pxp_types;; open Pxp_document;; (* XML file to load *) let filename = "methodresponse.xml";; (*let filename = "methodcall.xml";;*) type xmlrpc_value = X_String of string | X_Integer of int | X_Boolean of bool | X_Double of float | X_Base64 of string | X_Array of xmlrpc_value list | X_Struct of (string * xmlrpc_value) list | X_DateTime_iso8601 of string ;; type xmlrpc_valtype = XV_Value | XV_Fault ;; type xmlrpc_type = XT_Call | XT_Response | XT_None ;; exception Wrong_boolean;; exception Wrong_struct;; (* returns the #PCDATA string of the child of node `n` *) let get_sub_data n = let children = n # sub_nodes in (List.hd children) # data ;; (* * applies function `fct` on all elements in list `lst` * and give the result of that call as parameter of the * next call to the next element of the list and so on. *) let rec apply_children lst fct value = match lst with hd :: tl -> apply_children tl fct (fct hd value) | [] -> value ;; (* parses the node `node` *) let rec parse node (typ, valtype, name, params) = match node # node_type with T_element "methodCall" -> let children = node # sub_nodes in apply_children children parse (XT_Call, XV_Value, name, params) | T_element "methodResponse" -> let children = node # sub_nodes in apply_children children parse (XT_Response, XV_Value, name, params) | T_element "fault" -> let children = node # sub_nodes in apply_children children parse (typ, XV_Fault, name, params) | T_element ("methodName" | "name") -> (typ, valtype, get_sub_data node, params) | T_element "string" -> (typ, valtype, name, params @ [X_String (get_sub_data node)]) | T_element ("int" | "i4") -> (typ, valtype, name, params @ [X_Integer (int_of_string (get_sub_data node))]) | T_element "boolean" -> let boolean = int_of_string (get_sub_data node) in ( match boolean with 0 | 1 -> (typ, valtype, name, params @ [X_Boolean (boolean=1)]) | n -> raise Wrong_boolean ) | T_element "double" -> (typ, valtype, name, params @ [X_Double (float_of_string (get_sub_data node))]) | T_element "base64" -> (typ, valtype, name, params @ [X_Base64 (get_sub_data node)]) (* TODO: decode *) | T_element "dateTime.iso8601" -> (typ, valtype, name, params @ [X_DateTime_iso8601 (get_sub_data node)]) (* TODO: decode *) | T_element "array" -> let children = node # sub_nodes in let (_,_,_,arr) = apply_children children parse (typ,valtype,"", []) in (typ, valtype, name, params @ [X_Array arr]) | T_element "struct" -> let children = node # sub_nodes in (* important because element can also be #PCDATA when in non-validating mode! *) let mem_children = List.filter (fun e -> match e # node_type with T_element "member" -> true | _ -> false) children in let members = List.map (fun ele -> let (_,_,name,value) = parse ele (typ,valtype,"",[]) in match value with value::[] -> (name,value) | _ -> raise Wrong_struct ) mem_children in (typ, valtype, name, params @ [X_Struct members]) | T_data -> let t = (typ, valtype, name, params) in (match node # parent # node_type with T_element "value" -> if List.length (node # parent # sub_nodes) = 1 then (typ, valtype, name, params @ [X_String (node # data)]) else t | _ -> t) | _ -> let children = node # sub_nodes in apply_children children parse (typ, valtype, name, params) ;; (* outputs a value of type `xmlrpc_value` *) let rec output_argument ele = match ele with X_String s -> print_endline s | X_Integer i -> print_int i; print_newline () | X_Boolean b -> if b then print_endline "true" else print_endline "false" | X_Double d -> print_float d; print_newline () | X_Base64 s -> print_endline s | X_Array a -> List.iter (fun v -> print_string " "; output_argument v) a | X_Struct s -> List.iter (fun (n,v) -> print_string (" " ^ n ^ " ==> "); output_argument v) s | X_DateTime_iso8601 d -> print_endline d ;; (*let xmlrpc_parse filename*) let d = parse_document_entity default_config (from_file filename) default_spec in let (typ, valtype, name, args) = parse (d # root) (XT_None, XV_Value, "", []) in print_endline ("methName: " ^ name); List.iter output_argument args ;; |
Parst ein XML-RPC Dokument. Mehr
Informationen unter: http://www.xmlrpc.com. |
Obliq ![]() |
ähnliche Sprachen: | Modula Oberon Leda Pascal Phantom PL/0 PL/0E YAFL | |
Hello World | Michael Neumann |
(* Hello World! *) sys_printText("Hello World\n"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
for i=1 to 10 do sys_printText( text_fromInt(i*i) & " " ); end; |
Gibt die Quadrate von 1 bis 10
aus. |
Octave ![]() |
Hello World | Michael Neumann |
# Hello World in Octave printf("Hello World\n") |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
for i = 1:10 printf("%d ", i*i); endfor |
Gibt die Quadrate von 1 bis 10
aus. |
Ook ![]() |
http://www.physics.usyd.edu.au/~mar/esoteric/ook.html |
Squares | Chad Fowler |
Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook? Ook? Ook. Ook! Ook! Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook? Ook. Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook? Ook! Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook? Ook! Ook? Ook. Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook. Ook? Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook? Ook! Ook? Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook? Ook. Ook! Ook! Ook? Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook. Ook! Ook? Ook! Ook! Ook? Ook! |
Gibt die Quadrate von 1 bis 10
aus. |
Oz/Mozart
![]() |
http://www.mozart-oz.org |
Fakultät (1) | Michael Neumann |
declare Fact = proc {$ N Z} if N > 1 then Z = N * {Fact N-1} else Z = 1 end end local Z in {Fact 6 Z} {Browse ['Fact(6) = ' Z]} end |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
declare proc {Fact N Z} if N > 1 then Z = N * {Fact N-1} else Z = 1 end end local Z in {Fact 6 Z} {Browse ['Fact(6) = ' Z]} end |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (3) | Michael Neumann |
declare proc {Fact N Z} case N of 0 then Z = 1 [] X then Z = X * {Fact X-1} end end local Z in {Fact 6 Z} {Browse ['Fact(6) = ' Z]} end |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (4) | Michael Neumann |
declare fun {Fact N} case N of 0 then 1 [] X then X * {Fact X-1} end end {Browse ['Fact(6) = ' {Fact 6}]} |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
% Hello World!!! {Show 'Hello World'} |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
% Compile: % > ozc -x hw.oz % Run: % > ./hw functor import Application System define {System.printInfo "Hello World\n"} {Application.exit 0} end |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
local ShowIt T in proc {ShowIt T} {Show T*T} end {For 1 10 1 ShowIt} end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Martin Henz |
for I in 1..10 do {Show I*I} end |
Gibt die Quadrate von 1 bis 10
aus. |
Parrot ![]() |
http://www.parrotcode.org |
Beschreibung: |
Parrot is register-based virtual machine (JavaVM is stack based). It may be used in forthcoming versions of Perl (Perl6) and Python. Parrot was initially introduced on April 1st, as an april joke of Larry Wall and G.v.Rossum. They considered to merge their languages Perl and Python into one called Parrot. |
Hello World | Michael Neumann |
# Hello World in Parrot print "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Chad Fowler |
# Squares by Chad Fowler main: set I0,1 $loop: mul I1,I0,I0 print I1 print "\n" inc I0,1 eq I0,11,$done branch $loop $done: end |
Gibt die Quadrate von 1 bis 10
aus. |
Pascal ![]() |
ähnliche Sprachen: | Modula Oberon Obliq Leda Phantom PL/0 PL/0E YAFL | |
Hello World | Michael Neumann |
PROGRAM HelloWorld; BEGIN WRITELN('Hello World'); END. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | ISO-7185 | Andreas K. Foerster |
PROGRAM HelloWorld (OUTPUT); BEGIN WRITELN('Hello World'); END. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Perl ![]() |
http://www.perl.com |
Fakultät (1) | Michael Neumann |
sub fac { my ($n) = @_; if ($n < 2) { return $n; } else { return $n * fac($n-1); } } print fac(6), "\n"; |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Arnaud ASSAD |
#!/usr/bin/perl sub fac { $_[0]>1?$_[0]*fac($_[0]-1):1; } print fac(6); |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
# Hello World in Perl print "Hello World\n"; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Referenzen | Michael Neumann |
# array -> reference @arr = (1, 2, 3); $arr_ref = \@arr; # reference -> array $arr_ref2 = [1, 2, 3]; @arr2 = @$arr_ref2; # array access $item = $arr[0]; $item = $arr_ref->[0]; |
Referenzen und Arrays;
Arrayzugriff |
Squares (1) | Michael Neumann |
for($i = 1; $i <= 10; ++$i) { print $i*$i, ' '; } |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
@squares = (); foreach my $i (1..10) { push(@squares, $i * $i); } print join(" ", @squares), "\n"; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | Pixel |
print join(" ", map { $_ ** 2 } 1..10), "\n"; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (4) | Arnaud ASSAD |
for (1..10) { print $_**2," "};print$/; |
Gibt die Quadrate von 1 bis 10
aus. |
Substitution | Michael Neumann |
$a = 3;
$b = 5;
$c = $a + $b;
print "$a + $b = $c";
|
Gibt 3 + 5 = 8 auf dem
Bildschirm aus. |
Phantom
![]() |
ähnliche Sprachen: | Modula Oberon Obliq Leda Pascal PL/0 PL/0E YAFL | |
Hello World | Michael Neumann |
(* Hello World! *) module helloworld; import stdio; begin stdio.puts("Hello World\n"); end helloworld. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
module Squares; import stdio, fmt; begin for i:=1 to 10 do stdio.puts(fmt.fint(i*i) @ " "); end; end Squares. |
Gibt die Quadrate von 1 bis 10
aus. |
PHP ![]() |
http://www.php.net |
Hello World | PHP3 | Michael Neumann |
<?php
echo "Hello World\n";
?>
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | PHP3 | Michael Neumann |
<?php // gibt die Quadrate von 1-10 aus for($i = 1; $i <= 10; ++$i) { echo $i*$i; echo " "; } ?> |
Gibt die Quadrate von 1 bis 10
aus. |
Pico ![]() |
http://pico.vub.ac.be/ |
Eulersche Zahl | Michael Neumann |
{ "Fakultät"; !n: if(n>1, n * !(n-1), 1); "Reziprok"; %n: 1 / n; e: 0; n: -1; lp[10]: { n := n+1; e := e + %(!n) }; "e ausgeben"; display(e) } |
Berechnet die Eulersche Zahl
(e=2.71828). |
Fakultät | Michael Neumann |
{ fac(n): if(n>1, n*fac(n-1), 1); display( fac(6) ) } |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
{ "da es in Pico keine Kommentare gibt,"; "verwende ich einfach Strings."; display('Hello World', eoln) } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
for (i:1, i:=i+1, i<11, display(i^2, " ")) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
{
n: 0;
t[10]: {n: n+1; n*n};
display(t)
}
|
Gibt die Quadrate von 1 bis 10
aus. |
Pike ![]() |
http://pike.ida.liu.se/ |
ähnliche Sprachen: | C C# C++ C-Talk D Cilk Java Objective-C TOM | |
Fakultät | Michael Neumann |
/* * Berechnen der Fakultät */ // Fakultät-Funktion int fac(int n) { if(n > 1) return n * fac(n-1); else return 1; } // Hauptprogramm void main() { write("" + fac(6)); } |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
// Hello World in Pike void main() { write("Hello World\n"); } |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
void main() { string str = ""; for(int i=1; i<=10; i++) { str += i*i + " "; } write(str); } |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
void main() { array arr = ({ 1,2,3,4,5,6,7,8,9,10 }); foreach(arr, int i) { write(i*i + " "); } } |
Gibt die Quadrate von 1 bis 10
aus. |
PL/0 ![]() |
ähnliche Sprachen: | Modula Oberon Obliq Leda Pascal Phantom PL/0E YAFL | |
Hello World | Michael Neumann |
"Hello World" ist leider in PL/0
nicht möglich, da es keine Strings gibt, nur Integer.
|
Squares | Michael Neumann |
VAR x, squ; PROCEDURE square; BEGIN squ := x * x END; BEGIN x := 1; WHILE x <= 10 DO BEGIN CALL square; !squ END END. |
Gibt die Quadrate von 1 bis 10
aus. |
PL/0E ![]() |
ähnliche Sprachen: | Modula Oberon Obliq Leda Pascal Phantom PL/0 YAFL | |
Hello World | Michael Neumann |
PROGRAM HelloWorld; BEGIN WRITELN('Hello World'); END. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
PROGRAM HelloWorld; VAR i : LONGINT; BEGIN i = 1; REPEAT WRITE(i*i,' '); inc(i); UNTIL i>10; END. |
Gibt die Quadrate von 1 bis 10
aus. |
PL/1 ![]() |
Hello World | B. Bora Bali |
HELLO: PROCEDURE OPTIONS (MAIN); PUT SKIP LIST('HELLO WORLD!'); END HELLO; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | B. Bora Bali |
SQUARE: PROCEDURE OPTIONS (MAIN); DECLARE I FIXED DECIMAL(5) INIT(1); DO WHILE (I <= 10); PUT SKIP LIST(I**2); I = I + 1; END; END SQUARE; |
Gibt die Quadrate von 1 bis 10
aus. |
PL/SQL ![]() |
Hello World | Michael Neumann |
BEGIN DBMS_OUTPUT.put_line('Hello World'); END; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
DECLARE square INT; BEGIN FOR i IN 1..10 LOOP square := i * i; DBMS_OUTPUT.put_line( to_char(square) || ' ' ); END LOOP; END; |
Gibt die Quadrate von 1 bis 10
aus. |
Pliant ![]() |
http://fullpliant.org |
Beschreibung: | Pliant's besondere Eigenschaft ist der dynamische Compiler. Kleine Programme lassen sich wie bei einem Interpreter sofort starten, große Programme kann man vorkompilieren, um so die Zeit bis das Programm startfähig ist zu reduzieren. Pliant ist eine offene Sprache, d.h. man kann den Parser und Compiler erweitern (natürlich in Pliant). |
Fakultät | Michael Neumann |
# shunt ist C's ?: Operator function fac x -> f arg Int x f f := shunt x>1 x*(fac x-1) 1 console fac:6 |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
# Hello World in Pliant console "Hello World" eol |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
function Squares var Int i for i 1 10 console i * i " " # Funktion aufrufen Squares |
Gibt die Quadrate von 1 bis 10
aus. |
Postscript
![]() |
ähnliche Sprachen: | Forth | |
Hello World | Michael Neumann |
% Hello World /Courier findfont 28 scalefont setfont 0 0 moveto (Hello World) show % Text links unten ausgeben showpage |
Gibt "Hello World" auf dem Bildschirm
aus. |
Profan ![]() |
http://www.profan.de |
ähnliche Sprachen: | ABC Amos BASIC Euphoria REXX | |
Hello World | Michael Neumann |
PRINT "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
' gibt die Quadrate von 1-10 aus DECLARE I% LET I% = 0 WHILENOT @Equ(I%, 10) INC I% PRINT @Sqr(I%); " "; WEND |
Gibt die Quadrate von 1 bis 10
aus. |
Prolog ![]() |
Fakultät | Michael Neumann |
% Berechnen der Fakultät
fak(0,1).
fak(N,R) :- N > 0, M is N - 1, fak(M,R1), R is N * R1.
?- fak(6,N).
|
Berechnet die Fakultät. Ergibt
N = 720 |
Finite Domain Constraint Programming | Michael Neumann |
solve(A, B, C, D, E, F, G, H, I) :-
(
between(1,9,A),
between(1,9,B), B =\= A,
between(1,9,C), C =\= B, C =\= A,
between(1,9,D), D =\= C, D =\= B, D =\= A,
between(1,9,E), E =\= D, E =\= C, E =\= B, E =\= A,
between(1,9,F), F =\= E, F =\= D, F =\= C, F =\= B, F =\= A,
between(1,9,G), G =\= F, G =\= E, G =\= D, G =\= C, G =\= B, G =\= A,
between(1,9,H), H =\= G, H =\= F, H =\= E, H =\= D, H =\= C, H =\= B, H =\= A,
between(1,9,I), I =\= H, I =\= G, I =\= F, I =\= E, I =\= D, I =\= C, I =\= B, I =\= A,
A + B + G =:= 15,
C + D + H =:= 15,
E + F + I =:= 15,
G + H + I =:= 15,
A + B + C + D + E + F =:= 30
).
/*
Call it from the Prolog command prompt as follows:
?- solve(A, B, C, D, E, F, G, H, I).
*/
|
The problem: Each questionmark
represents a number from 1 to 9 (no two questionmarks may have the
same number). Choose the numbers so that the sum of each triangle
in the picture below is 15 and the sum of all numbers on the circle
is 30.![]() |
Hello World | Michael Neumann |
?- write('Hello World'), nl.
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Python ![]() |
http://www.python.org |
GgT | Michael Neumann |
# # Größter Gemeinsamer Teiler # def ggt(a, b): if a < b: a,b = b,a while a%b != 0: a,b = b,a%b return b |
Grösster Gemeinsamer
Teiler |
Hello World | Michael Neumann |
# Hello World in Python print "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
OO - Shape, Circle, Rectangle | Michael Neumann |
from math import pi class Color: def __init__(self, red=0, green=0, blue=0): self.red = red self.green = green self.blue = blue # no abstract classes in Python! class Shape: def __init__(self, x, y, color): self.x = x self.y = y self.color = color def draw(self): raise "abstract method" def getArea(self): raise "abstract method" def move(self, x, y): self.x += x self.y += y class Circle(Shape): def __init__(self, x, y, radius, color): Shape.__init__(self, x, y, color) self.radius = radius def draw(self): pass # do something here def getArea(self): return int(pi * self.radius) class Rectangle(Shape): def __init__(self, x, y, width, height, color): Shape.__init__(self, x, y, color) self.width = width self.height = height def draw(self): pass # do something here def getArea(self): return self.width * self.height ## Test the Classes ## BLACK = Color() WHITE = Color(255, 255, 255) circle = Circle(100, 100, 50, BLACK) rect = Rectangle(20, 20, 5, 5, WHITE) circle.move(10, 10) circle.x = 50 circle.radius = 5 print circle.getArea() # => 15 print rect.getArea() # => 25 print rect.width # => 5 rect.width = 10 print rect.width # => 10 circle.draw() rect.draw() |
QuickSort | Michael Neumann |
# # QuickSort in Python # von Michael Neumann # def quicksort(arr): if len(arr) <= 1: return arr m = arr[0] return quicksort(filter(lambda i,j=m: i<j, arr)) + \ filter(lambda i,j=m: i==j, arr) + \ quicksort(filter(lambda i,j=m: i>j, arr)) # Aufruf print quicksort([5,99,2,45,12,234,29,0]) |
QuickSort |
Squares (1) | Michael Neumann |
arr = range(1,11) for i in arr: print i*i, |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
for i in map(lambda a: a*a,range(1,11)): print i, |
Gibt die Quadrate von 1 bis 10
aus. |
R ![]() |
http://www.r-project.org |
Beschreibung: | R ist GNU's Implementation der Programmiersprache S. Wird im Bereich der Statistik eingesetzt. |
Hello World | Michael Neumann |
# Hello World in R print("Hello World") |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
for (i in 1:10) print(i*i) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
r <- 1:10 # Zuweisung print(r*r) |
Gibt die Quadrate von 1 bis 10
aus. |
Ratfor ![]() |
http://sepwww.stanford.edu/software/ratfor.html |
Beschreibung: | NetBSD's devel/ratfor package description says: Ratfor is a preprocessor for Fortran code that allows the use C-like flow expressions. Ratfor was invented by Brian Kernigham. Statements on a line may be separated by a ";". Statements may be grouped together with braces }. Do loops do not require statement numbers because {} defines the range, etc. The Fortran relational operators .gt.,.ge,.ne., etc. may be written >,<=,!=,etc. All of these are translated into Fortran 77 by Ratfor. Ratfor also frees you from Fortran's strict indentation rules. Anything from a # to the end of the line is a comment. |
Hello World | Daniel Lundin |
# hello.ratfor print *, 'Hello, world' end |
Gibt "Hello World" auf dem Bildschirm
aus. |
Rebol ![]() |
http://www.rebol.com |
Fakultät (1) | chaz |
fact: func [nummer]
[either equal? nummer 1
[1]
[multiply nummer fact subtract nummer 1]
]
fact 6
|
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | chaz |
factorial: func [num][ fact: func [n a] [ any [ if lesser? n 0 [0] switch n [0 1 a] fact subtract n 1 multiply n a ] ] fact num 1 ] factorial 6 |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
print "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
repeat i 10 [prin i * i prin " "] |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
for i 1 10 1 [prin i * i prin " "] |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | chaz |
print repeat i 10 [append [] multiply i i]
|
Gibt die Quadrate von 1 bis 10
aus. |
REXX ![]() |
ähnliche Sprachen: | ABC Amos BASIC Euphoria Profan | |
Hello World | Michael Neumann |
/* Hello World (Kommentar ist notwendig!!!) */ SAY "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Quicksort | H. Wonner |
Quicksort: PROCEDURE expose A. PARSE ARG lo, hi /* lo ist der unterste Index, hi ist der oberste Index des zu sortierenden (Teil-)Feldes A. */ /* Aufteilung */ i = lo j = hi Pivot = (lo + hi) % 2 x = a.Pivot Do Until i > j Do While a.i < x i = i + 1 end Do While a.j > x j = j - 1 end if i <= j then do h = a.i a.i = a.j a.j = h i = i + 1 j = j - 1 end end /* Rekursion */ if lo < j then call quicksort lo, j if i < hi then call quicksort i, hi Return 0 ^Z |
Quicksort-Sortieralgorithmus
|
Squares (1) | Michael Neumann |
/* */ DO I=1 TO 10 SAY I*I END |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
/* */ I=1 DO 10 SAY I*I I = I + 1 END |
Gibt die Quadrate von 1 bis 10
aus. |
Ruby ![]() |
http://www.ruby-lang.org |
Beschreibung: | Ruby ist DIE interpretierte Programmier-Sprache für schnelles und einfaches, objekt-orientiertes Programmieren. Sie hat viele Fähigkeiten um Text-Dateien zu verarbeiten und Systemverwaltungs-Aufgaben zu bewältigen (wie Perl). Ruby ist einfach, unkompliziert und erweiterbar. |
Berechnen von PI | Yukihiro Matsumoto? |
k, a, b, a1, b1 = 2, 4, 1, 12, 4 while TRUE # Next approximation p, q, k = k*k, 2*k+1, k+1 a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 # Print common digits d = a / b d1 = a1 / b1 while d == d1 print d $stdout.flush a, a1 = 10*(a%b), 10*(a1%b1) d, d1 = a/b, a1/b1 end end |
Berechnen der Zahl PI |
Berechnen von PI | Michael Neumann |
# # From the paper "Un Unbounded Spigot Algorithm for the Digits of Pi" # http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/spigot.pdf # def pi q, r, t, k = 1, 0, 1, 1 loop do n = (3*q+r) / t if (4*q+r) / t == n then yield n q, r, t, k = 10*q, 10*(r-n*t), t, k else q, r, t, k = q*k, q*(4*k+2)+r*(2*k+1), t*(2*k+1), k+1 end end end pi {|n| print n; $stdout.flush } |
Berechnen der Zahl PI |
Binary Search Tree | Michael Neumann |
# # $Id: binary_tree.rb,v 1.1 2001/10/07 11:58:07 michael Exp $ # # BinaryTree by Michael Neumann # class BinaryTree class Node attr_reader :value, :left, :right def initialize( value, left=nil, right=nil) @value = value @left, @right = left, right end def insert( value ) if value >= @value then # insert right if @right.nil? @right = Node.new( value ) else @right.insert( value ) end else # insert left if @left.nil? @left = Node.new( value ) else @left.insert( value ) end end end # depth first (from left to right) def traverse(&b) @left.traverse(&b) if @left b.call(self) @right.traverse(&b) if @right end end attr_reader :root def initialize @root = nil end def insert( value ) if @root.nil? @root = Node.new( value ) else @root.insert( value ) end end def traverse(&b) return if @root.nil? @root.traverse(&b) end end def binary_sort( array ) tree = BinaryTree.new # fill tree with array elements array.each do |e| tree.insert( e ) end sorted_array = [] tree.traverse do |node| sorted_array << node.value end return sorted_array end if __FILE__ == $0 p binary_sort( [0,6,4,3,5,8,4,6] ) # => [0, 3, 4, 4, 5, 6, 6, 8] end |
Binary Search Tree used to sort an
array by traversing it with DFS (depth-first-search). |
Fakultät | Michael Neumann |
def fac(n) if n < 2 then n else n * fac(n-1) end end # Aufrufen print fac(6) |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
def fac(n)n>1?n*fac(n-1):1 end puts fac(6) |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (tail-rekursiv) | Michael Neumann |
def fac(n, res=1) if n < 2 then res else fac(n-1, n*res) end end # Aufrufen print fac(6) |
Berechnet die Fakultät. Ergibt
720 . |
GgT | Michael Neumann |
# # Größter Gemeinsamer Teiler # def ggt(a, b) a,b = b,a if a < b a,b = b,a%b while a%b != 0 return b end |
Grösster Gemeinsamer
Teiler |
Hash1 - Standard-Hash-Funktion | Michael Neumann |
def hash1( txt, m = 101 ) h = 0 txt.each_byte { |i| h = ((h<<8) + i) % m} return h end |
Einfacher Hash-Algorithmus
|
hashpjw | Michael Neumann |
# # hashpjw, algorithm by P.J.Weinberg # # implemented by Michael Neumann # def hashpjw(txt, m=101) h = 0 txt.each_byte {|i| h = (h << 4) + i g = h & 0xf0000000 h ^= (g >> 24) ^ g if g } return h%m end |
Hashfunktion von P.J. Weinberg
|
Heapsort | Michael Neumann |
# # $Id: heapsort.rb,v 1.1 2001/10/06 18:48:30 michael Exp $ # # in-place Heapsort by Michael Neumann # class Array def heapsort! a = self n = a.size a.unshift nil # add 0'th element ## # (1) construct heap # 2.upto(n) do | i | # insert element a[i] into heap a[1..i-1] cnode = i while cnode != 1 and a[cnode] > a[cnode/2] do a[cnode], a[cnode/2] = a[cnode/2], a[cnode] cnode /= 2 end end ## # (2) remove elements from heap # n.downto(2) do | i | a[1], a[i] = a[i], a[1] cnode = 1 while cnode*2 < i do if cnode*2+1 >= i or a[cnode*2] > a[cnode*2+1] # no right node exist or left > right if a[cnode] < a[cnode*2] # cnode < left a[cnode], a[cnode*2] = a[cnode*2], a[cnode] cnode *= 2 else break end else # right > left if a[cnode] < a[cnode*2+1] # cnode < right a[cnode], a[cnode*2+1] = a[cnode*2+1], a[cnode] cnode = cnode*2+1 else break end end end # do end a.shift # remove 0'th element return a end def heapsort self.dup.heapsort! end end if __FILE__ == $0 a = [6, 3, 5, 3 ,8, 5, 3, 7, 4, 2, 3] p a.heapsort end |
Heapsort (in-place), runtime is in
O(n * log(n)) |
Hello World (1) | Michael Neumann |
# Hello World in Ruby print "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
"Hello World\n".display
|
Gibt "Hello World" auf dem Bildschirm
aus. |
OO - Shape, Circle, Rectangle | Michael Neumann |
class Color attr_accessor :red, :green, :blue def initialize(red=0, green=0, blue=0) @red, @green, @blue = red, green, blue end end # no abstract classes in Ruby! class Shape attr_accessor :x, :y, :color def initialize(x, y, color) @x, @y, @color = x, y, color end def draw raise "abstract method" end def getArea raise "abstract method" end def move(x, y) @x += x @y += y end end class Circle < Shape attr_accessor :radius def initialize(x, y, radius, color) super(x, y, color) @radius = radius end def draw # do something here end def getArea Integer(Math::PI * radius) end end class Rectangle < Shape attr_accessor :width, :height def initialize(x, y, width, height, color) super(x, y, color) @width, @height = width, height end def draw # do something here end def getArea @width * @height end end ## Test the Classes ## BLACK = Color.new WHITE = Color.new(255, 255, 255) circle = Circle.new(100, 100, 50, BLACK) rect = Rectangle.new(20, 20, 5, 5, WHITE) circle.move(10, 10) circle.x = 50 circle.radius = 5 p circle.getArea # => 15 p rect.getArea # => 25 p rect.width # => 5 rect.width = 10 p rect.width # => 10 circle.draw rect.draw |
Quicksort | Michael Neumann |
def quicksort( arr ) return arr if arr.size <= 1 m = arr[0] return quicksort( arr.select { |i| i < m } ) + arr.select { |i| i == m } + quicksort( arr.select { |i| i > m } ) end # Aufruf print quicksort( [5, 99, 2, 45, 12, 234, 29, 0] ).join( " " ) |
Quicksort-Sortieralgorithmus
|
RC4 | Michael Neumann |
s, j, k = (0..255).to_a, 0, (ARGV[0]*256)[0,256].unpack('C*') (0..255).each{|x| j = (j + s[x] + k[x]) % 256; s[x], s[j] = s[j], s[x] } i = j = 0; $stdin.each_byte{|b| i = (i + 1) % 256; j = (j + s[i]) % 256 s[i], s[j] = s[j], s[i]; $stdout<<(b ^ s[(s[i] + s[j])%256]).chr } |
RC4 stream chiper (algorithm by Ron
Rivest, RSA) |
Sieb des Eratosthenes | Michael Neumann |
# $Id: prime.rb,v 1.2 2001/10/16 11:00:12 michael Exp $ class Primes def initialize(n = 10_000) @n = n @primes = 0 # Sieve of Eratosthenes k = 2 while k < Math.sqrt(@n) if @primes[k] == 0 j = 2*k while j <= @n @primes |= (1 << j) j += k end end k += 1 end end def is_prime?( number ) if number > @n raise "number to big" else @primes[number] == 0 end end alias prime? is_prime? end if __FILE__ == $0 x = Primes.new(10_000) p x.prime?(77) # => false p x.prime?(13) # => true p x.prime?(100) # => false end |
Erzeugt alle Primzahlen bis zu einer
gegebenen Zahl. |
Squares (1) | Michael Neumann |
for i in 1..10 do print i*i, " " end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
(1..10).each { |i| print i*i, " " }
|
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | Michael Neumann |
1.upto(10) do |i| puts i**2 end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (4) | Michael Neumann |
i = 1 until i > 10 do puts i**2 i += 1 end |
Gibt die Quadrate von 1 bis 10
aus. |
Sather ![]() |
http://www.gnu.org/software/sather |
ähnliche Sprachen: | Blue Eiffel | |
Beschreibung: | Sather is an Eiffel-like language. It features:
|
Fakultät | Michael Neumann |
class MAIN is fac(n : INT) : INT is if n <= 1 then return 1; else return n * fac(n-1); end end; main is #OUT + fac(6) + "\n"; end; end; |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
class MAIN is main is #OUT + "Hello World\n"; end; -- main end; -- class MAIN |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
class MAIN is squares : STR is r ::= ""; -- implicit type loop r := r + (1.upto!(10) ^ 2) + " " end; return r; end; main is #OUT + squares + "\n"; end; end; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
class MAIN is -- squares! is an iterator yielding the squares of the -- numbers from "from" to "to". squares!(once from : INT, once to : INT) : INT is loop i ::= from.upto!(to); yield i * i end end; main is loop #OUT + squares!(1, 10) + " " end; #OUT + "\n"; end; end; |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (3) | Michael Neumann |
class MAIN is squares is a : ARRAY{INT} := |1,2,3,4,5,6,7,8,9,10| ; b : ROUT{INT}:INT := bind(_.pow(2)); -- a closure a.map(b); loop #OUT + a.elt! + " " end; end; main is squares; #OUT + "\n"; end; end; |
Gibt die Quadrate von 1 bis 10
aus. |
Scheme ![]() |
ähnliche Sprachen: | Lisp | |
Beschreibung: | Eine Lisp-ähnliche Sprache. |
Fakultät | Michael Neumann |
; define function (define fak (lambda (n) (if (< n 2) 1 (* n (fak (- n 1))) ) ) ) ; call function (fak 6) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World (1) | Michael Neumann |
; Hello World in Scheme (display "Hello World") |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | J. A. Durieux |
; Hello World "Hello, world!" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
(do ; Initialize variables ( (i 1 (+ i 1)) ) ; while condition ( (> i 10) ) ; loop body (display (* i i)) (display " ") ) |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | J. A. Durieux |
; Squares
(define (squares from to)
(if (> from to) '()
(cons (* from from)
(squares (+ from 1) to) ) ) )
(squares 0 10)
|
Gibt die Quadrate von 1 bis 10
aus. |
Shell-Sprachen
![]() |
ähnliche Sprachen: | DOS Batch | |
Squares | csh | Michael Neumann |
# Kommentar in csh (nicht in der Kommandozeile!) set i=1 while ($i <= 10) @ square=$i * $i echo -n $square "" @ i++ end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares | es (Extensible Shell) | Michael Neumann |
for (i=1 2 3 4 5 6 7 8 9 10) { echo -n `{ expr $i \* $i }' ' } |
Gibt die Quadrate von 1 bis 10
aus. |
Fakultät | sh,ksh,zsh,bash | Michael Neumann |
#! /bin/sh # # Berechnet die Fakultät # if [ $# != 1 ] then echo "FEHLER: Aufruf $0 Wert" >&2 exit 1 fi case $1 in [01]) echo $1 ;; *) n=`expr $1 - 1` m=`$0 $n` # $0 ist der Programm-Name echo `expr $1 \* $m` ;; esac |
Berechnet die Fakultät. Der
Aufruf fac 6 ergibt 720 |
Squares | sh,ksh,zsh,bash | Michael Neumann |
squares= for i in 1 2 3 4 5 6 7 8 9 10 do squares=$squares`expr $i \* $i`" " done echo $squares |
Gibt die Quadrate von 1 bis 10
aus. |
Hello World | sh,ksh,zsh,bash,csh,es | Michael Neumann |
# Hello World! echo Hello World |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | WSH (Windows Scripting Host) | Eric Vitiello |
WScript.Echo "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Bookmark Script | zsh | Michael Neumann |
#!/usr/bin/env zsh # # $Id: c,v 1.1 2001/07/20 18:18:10 michael Exp $ # # Bookmark script for zsh # by Michael Neumann (mneumann@ntecs.de) # # You have to type: # # fpath=(.) # or directory in which "c" lies # autoload c # # to make sure, that the function c is # invoked by zsh when you type "c". # dirs=( /usr/pkgsrc ) if [[ $# == 0 ]] ; then cnt=1 for i in $dirs ; do echo "[$cnt]\t$i" cnt=`expr $cnt + 1` done else # reload array dirs if [[ $1 == -r ]] ; then unfunction $0 autoload $0 else nr=`expr $1 : '\([0-9]*\)$'` if [[ $nr != '' ]] ; then # it's a number if [[ $nr -le $#dirs && $nr -gt 0 ]] ; then cd $dirs[$nr] else echo "False bookmark number" fi else cnt=1 match_dirs=() for i in $dirs ; do if [[ `expr $i : '.*'$1` -gt 0 ]] ; then # matches entry match_dirs[$cnt]=$i cnt=`expr $cnt + 1` fi done if [[ $#match_dirs == 0 ]] ; then echo "Nothing found" elif [[ $#match_dirs == 1 ]] ; then cd $match_dirs[1] pwd else cnt=1 for i in $match_dirs ; do echo "[$cnt]\t$i" cnt=`expr $cnt + 1` done echo -n "? "; read i cd $match_dirs[$i] fi fi fi fi |
Bookmark Script |
Simula ![]() |
ähnliche Sprachen: | Ada ALGOL | |
Hello World | Simula 67 | Michael Neumann |
begin OutText("Hello World"); OutImage end |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Simula 67 | Michael Neumann |
comment gibt die Quadrate von 1 bis 10 aus; begin integer i; ! ein Integer; for i := 1 step 1 until 10 do begin OutInt(i*i,4); end--for-----diese Schleife gibt die Quadrate aus; OutImage end--Ende des Programmes |
Gibt die Quadrate von 1 bis 10
aus. |
Sina ![]() |
Hello World | Michael Neumann |
class HelloWorld interface methods show returns nil; inputfilters disp: Dispatch = {inner.*}; end; class HelloWorld implementation methods show begin self.printLine('Hello World'); end; end; main temps hello: HelloWorld; begin hello.show end |
Gibt "Hello World" auf dem Bildschirm
aus. |
Sirius ![]() |
Hello World | Michael Neumann |
@ Hello World in Sirius @ PROGRAM Hello_World OUTPUT ('Hello World') END |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
PROGRAM Squares PROCEDURE iterate (INTEGER start, ende) DECLARE i AS INTEGER WHILE (start <= ende) i := start * start OUTPUT (i) start := start + 1 NEXT END iterate (1, 10) END |
Gibt die Quadrate von 1 bis 10
aus. |
Sisal ![]() |
Hello World | Michael Neumann |
% % Hello World!!! % define main function main(returns array [Character]) "Hello World" end function |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
define main function main(returns array [Integer]) for i in 1, 10 x := i * i returns array of x end for end function |
Gibt die Quadrate von 1 bis 10
aus. |
Smalltalk
![]() |
Hello World | Michael Neumann |
"Hello World in Smalltalk" 'Hello World' out. |
Gibt "Hello World" auf dem Bildschirm
aus. |
Quicksort | Michael Neumann |
" This must be inserted into the class Array as an instance method " quicksort: l to: r " sorts the array between l and r after the quicksort method by Michael Neumann 1998 " | m il ir temp | (r > l) ifTrue: [ m := self at: ((l + r) // 2). il := l. ir := r. [ [(self at: il) < m] whileTrue: [il := il + 1.]. [(self at: ir) > m] whileTrue: [ir := ir - 1.]. (il < ir) ifTrue: [ " swap " temp := self at: il. self at: il put: (self at: ir). self at: ir put: temp. ]. ] doUntil: [il >= ir.]. self quicksort: l to: (il - 1). self quicksort: (il + 1) to: r. ]. ^self. |
Quicksort-Sortieralgorithmus
|
Squares (1) | Michael Neumann |
| someNumbers | someNumbers := {1 2 3 4 5 6 7 8 9 10} (someNumbers collect: [:i| i squared.]) out. |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Aaron Jon Reichow |
1 to: 10 do: [ :i | Transcript show: (i squared)] |
Gibt die Quadrate von 1 bis 10
aus. |
SML ![]() |
http://www.standardml.org/ |
Hello World | Michael Neumann |
print "Hello World\n";
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
fun iter (a,b) = if a <= b then (print(Int.toString(a*a) ^ " "); iter(a+1,b) ) else print "\n"; iter(1,10); |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
fun iter 0 = "" | iter n = (iter(n-1); print(Int.toString(n*n) ^ " "); "\n"); print(iter 10); |
Gibt die Quadrate von 1 bis 10
aus. |
Word Tokenizer | Michael Neumann |
fun wordTokenizer (reader : (char, TextIO.StreamIO.instream) StringCvt.reader) (strm : TextIO.StreamIO.instream) = let fun scan s (l: char list) (charState: bool) = case (reader s) of NONE => (l, s) | SOME (c, s) => if Char.isAlpha c then scan s (l @ [c]) true else if charState then (l, s) else scan s l charState val (res, s) = scan strm [] false in if res = [] then NONE else SOME (implode res, s) end fun lowerCaseFilter s = case s of NONE => NONE | SOME w => SOME (String.map Char.toLower w) fun main (cmd:string, args:string list):OS.Process.status = let val (fileName::_) = args val ins = TextIO.openIn fileName val ws = lowerCaseFilter o TextIO.scanStream wordTokenizer fun loop () = case ws ins of NONE => () | SOME word => (print word; print "\n"; loop ()) in loop (); 0 end fun test () = main ("tokenizer", ["tokenizer.sml"]) |
Splits a given file into words and
outputs them. Makes use of SML streams. |
Hello World | SML/NJ | Michael Neumann |
(* To make a heap image of this file, load it into the interactive compiler (you do this by starting "sml" at the command line; then issue a 'use "thisfile.sml"'). Type then: SMLofNJ.exportFn ("heapimage", main); Exit now the interactive compiler. To load the heap image, type (at the command line): sml @SMLload=/path/to/heapimage.ext (where ext is a platform dependend suffix, e.g. "x86-bsd", to distinguish heap images of different OSes and platforms) *) fun main (cmd:string, args:string list):OS.Process.status = ( print "Hello world\n"; 0 ); |
Gibt "Hello World" auf dem Bildschirm
aus. |
SNOBOL ![]() |
Beschreibung: | SNOBOL ist dynamisch typisiert, Garbage-Collected und hat eingebautes Pattern-Matching. Aufgrund dem eingebauten Pattern-Matching eignet sich SNOBOL vorallem für Textmanipulation und -verarbeitung. |
Fakultät | SNOBOL4 | Michael Neumann |
* * Berechnen der Fakultät * * Funktion-Deklaration DEFINE("FAC(N)") * springe zum Start :(START) * Funktions-Implementierung FAC FAC = 1 LE(N, 1) :S(RETURN) FAC = N * FAC(N - 1) :(RETURN) START OUTPUT = FAC(6) END |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | SNOBOL4 | Michael Neumann |
* * die Einrückung ist wichtig!!! * OUTPUT = 'Hello World' END |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | SNOBOL4 | Michael Neumann |
I = 1 TXT = '' LOOP * wenn I > 10 dann springe nach DONE GT(I, 10) :S(DONE) TXT = TXT (I ** 2) ' ' I = I + 1 :(LOOP) DONE OUTPUT = TXT END |
Gibt die Quadrate von 1 bis 10
aus. |
SQL ![]() |
Beschreibung: | SQL steht für Structured Query Language - Strukturierte Abfrage Sprache. |
Hello World | Michael Neumann |
SELECT 'Hello World' |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World | Oracle SQL | Michael Neumann |
SELECT 'Hello World' FROM dual; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Superbase
![]() |
Hello World | Marco Puchinger |
' Hello World in Superbase ? "Hello, World!" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Tcl ![]() |
Hello World | Michael Neumann |
puts "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
set i 1 while {$i <= 10} {puts [expr $i*$i];set i [expr $i+1]} |
Gibt die Quadrate von 1 bis 10
aus. |
Substitution | Michael Neumann |
set a 3 set b 5 puts "$a + $b = [expr $a + $b]" |
Gibt 3 + 5 = 8 auf dem
Bildschirm aus. |
Hello World | Tcl/Tk | Michael Neumann |
button .hello -text "Hello World" -command {destroy .} pack .hello |
Gibt "Hello World" auf dem Bildschirm
aus. |
TI-83 Graphing
Calculator ![]() |
Eulersche Zahl | Thomas John LaGatta |
:Disp e |
Berechnet die Eulersche Zahl
(e=2.71828). |
Hello World | Thomas John LaGatta |
:Disp "Hello World"
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Thomas John LaGatta |
:For(X,1,10) :Disp X² :End |
Gibt die Quadrate von 1 bis 10
aus. |
TOM ![]() |
http://www.gerbil.org/tom |
ähnliche Sprachen: | C C# C++ C-Talk D Cilk Java Objective-C Pike | |
Beschreibung: | TOM ist eine moderne, objekt-orientierte Programmiersprache. In TOM kann man, ohne den Sourcecode zu besitzen und ohne Neukompilation, eine vorhandene Klasse erweitern (z.B. eine Methode überschreiben). TOM's Methodenaufrufe bzw. deren Parameter ähneln denen von Smalltalk, da man diese benennen kann. Desweiteren ist TOM Garbage-Collected, hat Pre- und Post-Conditions, Mehrfachvererbung und eine C-ähnliche Syntax. |
Hello World | Michael Neumann |
/* Hello World in TOM */ implementation class HelloWorld int main Array argv { [[[stdio out] print "Hello World"] nl]; return 0; } end; implementation instance HelloWorld end; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
implementation class Squares int main Array argv { for( int i=1; i<=10; ++i ) [[stdio out] print (i*i, " ")]; return 0; } end; implementation instance Squares end; |
Gibt die Quadrate von 1 bis 10
aus. |
Turing ![]() |
http://www.holtsoft.com/turing/introduction.html |
Beschreibung: | Turing is a general purpose programming language designed for the convenient development of reliable, efficient programs. A descendant of Pascal, Turing is specifically designed to be easy to learn, to have a concise and expressive syntax, graceful and effective treatment of errors, effective control of program complexity, a mathematically precise language definition, and a small, fast implementation. It is particularly well suited to support computer science education. |
Fakultät | James R. Cordy |
function fac (n : int) if n > 1 then result n * fac (n - 1) else result 1 end if end fac put fac (6) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | James R. Cordy |
put "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | James R. Cordy |
for i : 1 .. 10 put i * i end for |
Gibt die Quadrate von 1 bis 10
aus. |
TXL ![]() |
http://www.txl.ca/allabouttxl.html |
Beschreibung: | TXL is a pure functional programming language and rapid prototyping system specifically designed to support source transformation tasks such as computer software analysis and reengineering. The paradigm involves transforming input to output by application of a rooted set of source transformation rules. |
Bubblesort | Jim Cordy |
% Bubblesort any sequence of numbers % Required description of input and output forms - a sequence of numbers define program [repeat number] end define % Transform any sequence to a sorted sequence by replacing % any unordered pair of adjacent numbers by an ordered pair. % The rule stops when there are no unordered pairs left. rule main replace [repeat number] N1 [number] N2 [number] Rest [repeat number] where N1 [> N2] by N2 N1 Rest end rule |
Bubblesort |
Hello World | Jim Cordy |
% Required description of input forms - in this case % any input will do define program [repeat token] end define % Main transformation rule - whatever the input, % transform it into Hello World function main replace [program] _ [program] by "Hello World" end function |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Jim Cordy |
% Transform any number to its square % Required description of input and output forms - both simply a number define program [number] end define % Transform the input number to its square function main replace [program] N [number] by N [* N] end function |
Gibt das Quadrat des Eingabewertes
aus. |
UFO ![]() |
Hello World | Michael Neumann |
main : String is "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
** ** ** main : String is { squares = for i in [1 to 10] do return all i*i od; output = initially txt = "" for i in squares do new txt = txt ++ print(i) ++ " " return txt od; return output ++ "\n" } |
Gibt die Quadrate von 1 bis 10
aus. |
UML (Unified Modeling
Language) ![]() |
OO - Shape, Circle, Rectangle (1) | Michael Neumann |
|
Diagram made with Dia. |
OO - Shape, Circle, Rectangle (2) | Michael Neumann |
|
Diagram made with Fujaba. |
VHDL ![]() |
Beschreibung: | VHDL = VLSI (Very Large Scale Integrity) Hardware Description Language. |
Hello World | Roger Daniel Pease |
ENTITY helloworld IS END helloworld; ARCHITECTURE bhv OF helloworld IS BEGIN ASSERT FALSE REPORT "HELLO WORLD" SEVERITY NOTE; END bhv; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Vim ![]() |
http://www.vim.org |
Beschreibung: | Vim ist ein Vi-ähnlicher, programmierbarer Text-Editor. |
Hello World | Michael Neumann |
:"Hello World in Vim :echo "Hello World" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Michael Neumann |
:func Squares(from, to) : let n = a:from : let r = "" : : while n <= a:to : let r = r . (n*n) . " " : let n = n + 1 : endwhile : : return r :endfunc :"Nun die Funktion aufrufen :echo Squares(1, 10) |
Gibt die Quadrate von 1 bis 10
aus. |
WebL ![]() |
Fakultät | Michael Neumann |
/* * Berechnet die Fakultät */ var fac = fun(n) if n==1 or n==0 then 1 else n*fac(n-1) end end; PrintLn( fac(6) ); |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
// Hello World in WebL PrintLn("Hello World"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
every i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] do Print(i*i, " ") end |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
var i=1; repeat Print(i*i, " "); i=i+1 until i>10 end |
Gibt die Quadrate von 1 bis 10
aus. |
WML (Wireless Markup
Language) ![]() |
ähnliche Sprachen: | HTML SGML XHTML XML | |
Hello World | Michael Neumann |
<?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> <!-- Hello World in WML --> <wml> <card id="Hello_World" title="Hello World"> <p>Hello World</p> </card> </wml> |
Gibt "Hello World" auf dem Bildschirm
aus. |
XPL0 ![]() |
http://www.idcomm.com/personal/lorenblaney/ |
Beschreibung: | XPL0 (zero) is similar to Pascal. It was created in the mid 70's by P.J.R. Boyle and the 6502 Group. It is free under the terms of the GNU General Public License. |
Hello World | Loren Blaney |
code Text=12; Text(0, "Hello World"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares | Loren Blaney |
code Crlf=9, Intout=11; int I; for I:= 1, 10 do begin Intout(0, I*I); Crlf(0); end; |
Gibt die Quadrate von 1 bis 10
aus. |
Yacas ![]() |
Fakultät (1) | Michael Neumann |
6!; |
Berechnet die Fakultät. Ergibt
720 . |
Fakultät (2) | Michael Neumann |
IsPosInt(_n) <-- IsInteger(n) and n > 0;
fac(0) <-- 1;
fac(n_IsPosInt) <-- n * fac(n-1);
fac(6);
|
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
WriteString("Hello World");
|
Gibt "Hello World" auf dem Bildschirm
aus. |
YAFL ![]() |
ähnliche Sprachen: | Modula Oberon Obliq Leda Pascal Phantom PL/0 PL/0E | |
Beschreibung: | YAFL ist eine sehr klar strukturierte und modularisierte, objekt-orientierte Programmiersprache. Es erbt Eigenschaften von Algol, Eiffel, Modula, Ada, C und C++. |
Hello World | Michael Neumann |
DEFINITION MODULE HelloWorld; CLASS HelloClass; METHOD CREATE; METHOD Main; END HelloClass; END HelloWorld; IMPLEMENTATION MODULE HelloWorld; FROM Streams IMPORT StdOut; CLASS HelloClass; METHOD CREATE; BEGIN -- wird aufgerufen um das Objekt zu initialisieren Main; END; METHOD Main; BEGIN StdOut.WriteLine ("Hello World"); END Main; END HelloClass; END HelloWorld; |
Gibt "Hello World" auf dem Bildschirm
aus. |
Yoix ![]() |
http://www.research.att.com/sw/tools/yoix/ |
Beschreibung: | Yoix is a scripting language and interpreter written in pure Java. The language itself resembles a bit of both Java's and/or C's syntax, but is much more usable for scripting. |
Fakultät | Michael Neumann |
/* * Berechnen der Fakultät */ fac(n) { if (n > 1) return n * fac(n-1); else return 1; } yoix.stdio.printf("fac(6) = %d\n", fac(6)); |
Berechnet die Fakultät. Ergibt
720 . |
Hello World (1) | Michael Neumann |
// Hello World in Yoix import yoix.stdio.*; printf("Hello World\n"); |
Gibt "Hello World" auf dem Bildschirm
aus. |
Hello World (2) | Michael Neumann |
stdout.nextline = "Hello World";
|
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
int i; String str = ""; for (i = 1; i <= 10; i++) { str += toString(i*i) + " "; } yoix.stdio.printf(str + "\n"); |
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
int i; Array arr = { 1,2,3,4,5,6,7,8,9,10 }; for (i = 0; i < arr@length; i++) { a[i] *= a[i]; } stdout.nextline = toString(a); |
Gibt die Quadrate von 1 bis 10
aus. |
Yorick ![]() |
Beschreibung: | Yorick ist eine C-ähnliche, interpretierte Sprache, die vorallem in der Physik Verwendung findet, aufgrund der vielen eingebauten, spezialisierten Funktionen. |
Eulersche Zahl | Michael Neumann |
// Fakultät func fac(n) { if(n>1) return n*fac(n-1) else return 1 } arr= span(0,9,10) // 10 Werte von 0-9 for(i=1; i<=numberof(arr); i++) { arr(i) = fac(arr(i)) } print, sum(1/arr) |
Berechnet die Eulersche Zahl
(e=2.71828). |
Fakultät | Michael Neumann |
func fac(n) { if(n>1) return n*fac(n-1) else return 1 } print, fac(6) |
Berechnet die Fakultät. Ergibt
720 . |
Hello World | Michael Neumann |
// Hello World in Yorick write, "Hello World\n" |
Gibt "Hello World" auf dem Bildschirm
aus. |
Squares (1) | Michael Neumann |
/*
indgen(n) erzeugt ein Array von 1-n
*/
print, indgen(10)^2
|
Gibt die Quadrate von 1 bis 10
aus. |
Squares (2) | Michael Neumann |
for(i=1; i<=10; i++)
{
print, i*i
}
|
Gibt die Quadrate von 1 bis 10
aus. |