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
JSON = Object clone | |
(s: String) as: JSON := s show | |
(d: Double) as: JSON := d show | |
(i: Integer) as: JSON := i show | |
(l: List) as: (j: JSON) := | |
"[" .. l (map: @(as: j)) (join: ", ") .. "]" | |
(b: Block) as: (j: JSON) := | |
Object clone (do: b) (as: j) |
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 | |
> Object clone (do: { a = 1; b = "hi" }) methods | |
<object (delegates to 1 object)> | |
keywords := [] | |
singles := [[<slot (a)>], [<slot (b)>]] | |
> Object clone (do: { a = 1; b = "hi" }) methods singles | |
[[<slot (a)>], [<slot (b)>]] | |
> Object clone (do: { a = 1; b = "hi" }) methods singles (map: @(map: @value)) | |
[[1], ["hi"]] | |
> Object clone (do: { a = 1; b = "hi" }) methods singles (map: @(map: @value)) concat |
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
{-# LANGUAGE QuasiQuotes, StandaloneDeriving, DeriveDataTypeable #-} | |
import Atomo.Environment | |
import Atomo.Haskell | |
import Data.Typeable | |
import System.Exit | |
import System.Process | |
deriving instance Typeable ProcessHandle |
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
Generator = Object clone | |
(g: Generator) yield: v := g yielder = { cc | | |
g control-state =! cc | |
g yielder yield: v | |
} call/cc | |
(b: Block) generator := | |
Generator clone do: { | |
next := control-state _? call/cc |
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
if: a? | |
then: { a } | |
else: { | |
if: b? | |
then: { b } | |
else: { c } | |
} |
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
["foo", | |
"bar", | |
"baz"] print | |
[ | |
"foo" | |
"bar" | |
"baz" | |
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
Parameter = Object clone | |
Parameter new: v := Parameter clone do: { | |
value: (self) = v | |
value: _ = v | |
} | |
(p: Parameter) _? := p value: self | |
(p: Parameter) set: v := | |
(p) value: (self) = v |
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 |
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
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, |