80 lines
4.5 KiB
Plaintext
80 lines
4.5 KiB
Plaintext
# Tampiorama
|
|
#
|
|
# An index of annotated Tampio examples.
|
|
# This page is itself a Tampio program — the source on the left
|
|
# is what generates the links and descriptions on the right.
|
|
#
|
|
# "nykyinen sivu näyttää tekstin X" = document.write(X)
|
|
|
|
# Hei maailma — Hello World
|
|
#
|
|
# The simplest Tampio program.
|
|
# Entry point: Kun nykyinen sivu avautuu = When the current page opens
|
|
# "näytetään käyttäjälle" triggers a browser alert.
|
|
|
|
# Kertoma — Factorial
|
|
#
|
|
# Recursive factorial using the ternary:
|
|
# riippuen siitä ... joko ... tai
|
|
# = depending on whether ... either ... or
|
|
# Multiplication uses adessive case: kerrottuna kertomalla
|
|
|
|
# Fibonacci-kani — Fibonacci
|
|
#
|
|
# Recursive Fibonacci named "kani" (rabbit),
|
|
# after Fibonacci's original rabbit problem from 1202.
|
|
# Addition uses illative case: lisättynä kaniin
|
|
# n-2 computed by chaining: edeltäjän edeltäjä
|
|
|
|
# Lista — List Operations
|
|
#
|
|
# Built-in lista type: size, first element, iteration,
|
|
# ascending and descending sort.
|
|
|
|
# Vektori — Custom Class
|
|
#
|
|
# User-defined class with fields and recursive methods.
|
|
# Euclidean length of vector [3,4] = 5.
|
|
|
|
# Merkkijono — Strings
|
|
#
|
|
# Length, concatenation, trim, and comma-split.
|
|
|
|
# Nappi — DOM Events
|
|
#
|
|
# Click handlers with "X:tä painettaessa käyköön niin, että".
|
|
# Mutable counter state persists across button clicks.
|
|
|
|
Kun nykyinen sivu avautuu,
|
|
nykyinen sivu näyttää tekstin "<h1>Tampiorama</h1>",
|
|
nykyinen sivu näyttää tekstin "<p>Annotated examples for <a href='https://github.com/fergusq/tampio'>Tampio</a>, a natural-language OOP language using Finnish grammar that compiles to JavaScript.</p>",
|
|
nykyinen sivu näyttää tekstin "<h2>Basics</h2>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='hello.html'>Hei maailma →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Hello world. Page-load entry point, browser alert.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — it will alert 'Hei maailma!' immediately.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='factorial.html'>Kertoma →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Recursive factorial. Ternary branching, adessive multiplication.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — enter a number when prompted, e.g. 5, and see 120.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='fibonacci.html'>Fibonacci-kani →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Recursive Fibonacci. Illative addition, predecessor chaining.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — enter a number when prompted, e.g. 10, and see 55.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h2>Data Structures</h2>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='../data-structures/lista.html'>Lista →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Built-in list: size, first element, ascending and descending sort.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — see the list [3,1,4,1,5] sorted both ways.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='../data-structures/vektori.html'>Vektori →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Custom class with fields and recursive methods. Euclidean length of [3,4] = 5.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — see dimension, sum, and Euclidean length of vector [3,4].</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h2>Strings</h2>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='../strings/merkkijono.html'>Merkkijono →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>String length, concatenation, trim, and comma-split iteration.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — see string ops applied to 'Hei, Tampio!'.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h2>Async / Events</h2>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='../async/nappi.html'>Nappi →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>DOM click handlers. Mutable counter state persists across button clicks.</p>",
|
|
nykyinen sivu näyttää tekstin "<p><em>Open the page — click +1 or +10 and watch the counter update.</em></p>",
|
|
nykyinen sivu näyttää tekstin "<h2>Program</h2>",
|
|
nykyinen sivu näyttää tekstin "<h3><a href='../program/kasvutaulukko.html'>Kasvutaulukko →</a></h3>",
|
|
nykyinen sivu näyttää tekstin "<p>Capstone: recursive functions, list iteration, and a click handler together.</p>"
|
|
ja nykyinen sivu näyttää tekstin "<p><em>Open the page — see factorial and Fibonacci for n=1..7, then enter any n for both values.</em></p>".
|