Остання активність 2 weeks ago

A language to surpass Io

Версія 85ad36ae51062fd34a58b2b98681cdb650a8b8ea

StackTalkDesign.st Неформатований Playground
1title[ StackTalk ]
2
3"Stack Basics" note[
4
5 An object is a collection of named stacks
6 A quotation is a malleable list of code symbols, delimited by [ and ]
7 Strings can be written two ways:
8
9 "This is a conventional string"
10 this-is-a-symbol-string:
11
12 There are 4 baseline stack operations:
13
14 `$value $stack push`
15 `$stack pop`
16 `$stack peek`
17 `$stack run`
18
19 These let you manipulate arbitrarily named stacks.
20 `run` is a bit special. It'll run top of $stack, if it is a
21 quotation, otherwise it acts like peek
22
23 There are shortcuts for these operations:
24
25 [ 1 x: push ] can be writtn as [ 1 >x ]
26 [ x: peek ] can be written as [ x. ] when you need no ambiguity
27 [ x: pop ] can be written as [ x> ]
28 [ x: run ] can be written as [ x ]
29
30]
31
32"Quotation suffix autoswap" note[
33 This one is a little inspired by https://knucklecracker.com/wiki/doku.php?id=crpl:overview#warp_notation,
34 but is ultimately a bit less generalized.
35
36 I anticipate that quotations will be modified by a lot of words. Because of this, and because
37 I think it reads better in a lot of cases, there's another rewrite
38
39 [ 1 [ me> 1 + >me ] do ] can be written as [ 1 do[ me> 1 + >me ] ]
40
41 This is how `note` has been working.
42]
43
44
45Objects: note[
46
47 The current Object/scope is the top of the `me:` stack.
48
49
50 `do` executes the quotation inside the scope of object below
51 it in the stack.
52
53 `$subject $quotation do`
54
55 Shorthand
56 [ AnObject [ aThing ] do ] can be written as [ AnObject .aThing ]
57
58]
59
60Experimental: note[
61 Some code snippets that I'm noodling on.
62
63 experimental[
64 1 >x 2 >y 3 >z
65 [ x: y: z: ] from-stacks
66 ]
67]
68