-
Notifications
You must be signed in to change notification settings - Fork 0
/
feels.hoon
61 lines (60 loc) · 1.92 KB
/
feels.hoon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|= [command=@t val=@t]
^- @t
=<
?: =(command 'pma')
(pma val)
?: =(command 'nma')
nma
'Mhm'
|%
++ pma
|= val=@t
^- @t
val
++ nma
'I hear you'
--
:: initial tinkerings for a potential "micro blogging" platform where
:: users can submit single line messages for how they feel, other users
:: see recent "feels" in a list. Started as a way to learn cores etc.
:: This is just a fun tinkering thing.
::
:: 1. Create a gate with a cell input of two cords (@t is utf-8 text)
:: 2. Use kethep (^-) to set the return value to a cord
:: 3. Use tisgal (=<) to invert the operations
:: This means the next chunk runs after the arms of the core are
:: defined (|% etc...) this is really just syntax sugar
:: 4-8. Use wutcol (?:) to check a conditional.
:: wutcol syntax can really be either:
::
:: ?: =(foo bar) true
:: false
::
:: or
::
:: ?: =(foo bar)
:: true
:: false
::
:: We check using wutcol if the value of command matches either pma
:: or nma. Then call a function based off of what it was equal too.
:: If the =(command 'nma') check fails we just return 'Mhm'
:: 9. Use barcen (|%) to create a core, this is really just "sub
:: functions" if you really want to think of it like that.
:: 10. Use luslus (++) to create an arm (one of these "sub functions")
:: 11. This arm is a gate which just takes val
:: 12. Again we use kethep (^-) to enforce the cord return type
:: 13. We then echo val back to the user
:: 14. Use luslus (++) to define another arm
:: 15. this arm imediatley returns a cord.
:: 16. Use hephep (--) to end the core expression
::
:: Final usage comes out as:
::
:: > +feels ['pma' 'I had a good day']
:: 'I had a good day'
::
:: Things I would like to be able to figure out:
:: - How do you concat strings?
:: - Store basic text in the graph store.
:: - Basic gal interface