This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alex@alex-laptop:~/the$ the | |
> [] includes?: _ := False | |
@defined | |
> (xs: List) includes?: y := if: (xs (take: y length) == y) then: { True } else: { xs tail includes?: y } | |
@defined | |
> [1, 2, 3, 4, 5] includes?: [2, 3] | |
True | |
> [1, 2, 3, 4, 5] includes?: [2, 4] | |
False | |
> "restaurant" includes?: "aura" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atomo $ atomo examples/error.atomo | |
traceback: | |
"examples/error.atomo" (line 6, column 1) | |
{ a print } call | |
... internal ... | |
"examples/error.atomo" (line 6, column 3) | |
a print | |
"examples/error.atomo" (line 6, column 3) | |
a | |
"examples/error.atomo" (line 1, column 6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> { [a, @+] -> 0 } contents head targets head as: Pattern | |
<pattern [a, @+]> | |
> { [a, @+] -> 0 } contents head targets head (as: Pattern) matches?: [1, 2] | |
@no | |
> { [a, @+] -> 0 } contents head targets head (as: Pattern) matches?: [1, @+] | |
@(yes: <object>) | |
> @(yes: o) = { [a, @+] -> 0 } contents head targets head (as: Pattern) matches?: [1, @+] | |
@(yes: <object>) | |
> o a | |
1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
atomo $ atomo | |
> { 1 -> 2 * 3 } | |
{ (1 -> 2) * 3 } | |
> operator right -> | |
@ok | |
> { 1 -> 2 * 3 } | |
{ 1 -> (2 * 3) } | |
> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ atomo | |
> load: "prelude/units.atomo" | |
@ok | |
> p = Timer do: { "hi!" print } every: 5 seconds | |
<process 92> | |
> hi! | |
hi! | |
hi! | |
hi! | |
hi! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v match: (b: <self>) := | |
if: b contents empty? then: { @no-match } else: { es = b contents; | |
[p, e] = es head targets; | |
match = (p as: Pattern) matches?: v; | |
if: (match == @no) then: { v match: (Block new: es tail in: b scope) } else: { @(yes: obj) = match; | |
obj join: (Block new: [e] in: b scope) } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load: "examples/html.atomo" | |
load: "examples/web.hs" | |
Demo = Website clone | |
Demo index := | |
HTML new (do: { | |
doctype | |
html: { | |
head: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load: "examples/html.atomo" | |
load: "examples/web.hs" | |
Association = Object clone | |
a -> b := Association clone do: { from = a; to = b } | |
Demo = Website clone do: { | |
routes = [ | |
"/" -> @index, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSS new (do: { | |
body: { | |
font-family: "Georgia" | |
} | |
header: { | |
font-family: "Arial" | |
h1.red: { | |
color: "red" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> File | |
<object (delegates to 1 object)> | |
canonicalize-path: (fn: <object>) := ... | |
rename: (from: <object>) to: (to: <object>) := ... | |
delete: (fn: <object>) := ... | |
new: (fn: <object>) := Port new: fn |