💾 Archived View for thingvellir.net › log › 2022-06-04_tok.gmi captured on 2023-04-19 at 22:33:59. Gemini links have been rewritten to link to archived content
View Raw
More Information
⬅️ Previous capture (2023-01-29)
🚧 View Differences
-=-=-=-=-=-=-
lipu Soku pi tenpo 2022-06-04 — toki nanpa pi sike tu
English version
o sona e ni: mi sitelen e lipu ni la, mi nasa. ken la, nimi li pakala.
toki Lisapu en toki Sukimu li pona ala tawa ilo sin. sitelen pi toki Wepasenpali li sama. sina wile kepeken e toki Wepasenpali tawa anpa pi ilo sin anu seme?
mi wile pakala e toki Lisapu tawa ike. toki ni li lon ala la, jan li pakala ala.
selo sitelen
- ale li insa e sike tu. sitelen pi nanpa sin li ni: `(+ 1 1)`.
- nimi pi linja-sijelo li pona tawa ni. nimi pi linja_anpa li pona tawa toki ante.
- nimi `"` li sike e linja nimi. ona li sitelen Juniko lili.
- nimi `'` li sitelen Juniko suli e nimi wan taso.
- kule sitelen li ni: `nimi.kule`. sitelen `.&kule` li ante ala. sitelen `.*kule` li ante. sitelen `.[]kule` li linja suli. sitelen ala li kule ala.
- nimi `int` en nimi `uint` li nanpa pona tawa ijo sina. ilo li lili la, ni li `i32`, li `u32`. ilo li suli la, ni li `i64`, li `u64`.
- nimi `real` li nanpa kipisi pona tawa ijo sina. tenpo ni la, ni li `f32`.
- nimi `bool` li nimi `True` anu nimi `False`.
ilo sijelo
- `+ - * /` — sitelen pi sin, sitelen pi weka, sitelen pi suli, sitelen pi tu `(+ 1 2)`
- `^` — sitelen pi jo `(^ ijo [nanpa-nena-anu-ala])`
- `&` — sitelen pi jo e nanpa ijo `(& ijo)`
- `.` — sitelen pi jo e luka ijo `(. nimi-luka nimi-sijelo)`
- `:` — sitelen pi pana sijelo `(: ijo 123)`
- `not and or xor` — nimi pi nimi 'ala', nimi pi nimi 'en', nimi pi nimi 'anu', nimi pi wan taso
- `fn` — nimi pi nasin len `(fn (nimi-nasin.kule nimi-ijo.kule) ...)`
- `fn.export` — nimi pi nasin pi len ala
- `fn.import` — nimi pi nasin tan lipu ante. sijelo nasin li tawa ala ni.
- `let` — nimi pi pana nimi `(let (nimi.kule 123))`
- `ret` — nimi pi pini `(ret [sijelo-anu-ala])`
- `if` — sijelo wan li lon la, o tawa e nasin wan. ni li lon ala la, o tawa e nasin tu. `(if sijelo-wan (nasin-wan) [(nasin-tu-anu-ala)])`
- `while` — sijelo wan li lon la, o nasin mute e sijelo. ni li lon ala la, o pini. `(while ijo ...)`
- `trace` — nimi pi pana e sitelen. `(trace "toki")`
lipu lili
"ma o, toki!"
(fn.export (main.)
(trace "ma o, toki!"))
linja ijo en sitelen wan
(fn.export (main.)
(let (toki.[]u32 't 'o 'k 'i '!))
(trace toki))
o pana e suli pi linja wan tu
(fn (suli-pi-linja.real x.real y.real z.real)
(ret (sqrt (+ (* x x) (* y y) (* z z)))))
(fn.export (main.)
(trace (suli-pi-linja 0.0 0.5 1.0))) ; pana ~1.118
o nanpa e linja sitelen pi toki Si
(fn (strlen-mi.uint linja.&u8)
(let (a.uint 0))
(while (^ linja a) (: a (+ a 1)))
(ret a))
(fn.export (main.)
(trace (strlen-mi "suli pi sitelen ni li seme?"))) ; pana 27