Skip to content

Commit 08e4e9c

Browse files
dantmnfdantmnf
authored and
dantmnf
committed
chaos ruby
1 parent 038fc41 commit 08e4e9c

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
| 6 | [Jack-Works](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Jack-Works) | 126 bytes | JavaScript | |
3131
| 7 | [benpigchu](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/benpigchu) | 140 Bytes | Python | 大概还能再压,但是懒 |
3232
| 8 | [MistEO](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/misteo) | 163 Bytes | Bash | 大概没法压了,因为菜 |
33-
| 9 | [GalvinGao](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/GalvinGao) | 3.3 KB | JavaScript | 感谢鼹鼠( |
33+
| 9 | [dantmnf](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/dantmnf) | 247 Bytes | Ruby | 本来是一个字母数字都不带,随便改改( |
34+
| 10 | [GalvinGao](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/GalvinGao) | 3.3 KB | JavaScript | 感谢鼹鼠( |
3435
| - | [许兴逸](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/%E8%AE%B8%E5%85%B4%E9%80%B8) | 124Bytes | Haskell | 我import了Data.Char【
3536
| - | [谓道之求](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/%E8%B0%93%E9%81%93%E4%B9%8B%E6%B1%82) | 138 Bytes | Matlab | 过几天就符合规则了) |
3637
| - | [Nyaacinth](https://github.com/InvoluteHell/ThreeKeysProgramming/tree/master/Nyaacinth) | 248 Bytes | Lua (LuaJIT) | 做不到,但是 Lua 值得有姓名! |

dantmnf/@.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$.=$$/$$;$_=->(_){_<<$.};@_=$_<<$_;$><<(%%%<<(@_[@_[@_[$.]]]|@_[$_[$.]])<<($.|@_[$.]|@_[@_[$_[$.]]]|@_[@_[@_[$.]]]))<<'llo, '<<(%%%<<(@_[@_[@_[$.]]]|@_[@_[$.]]|@_[$.]|$_[$.]|$.)<<'orl'<<(@_[@_[@_[$.]]]|@_[@_[$_[$.]]]|@_[$.])<<(@_[@_[$_[$.]]]|$.))

dantmnf/readme.md

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## 1. `$$` is PID of interpreter
2+
3+
`$$/$$ = 1`
4+
5+
## 2. magic variables
6+
7+
`$.` and `$_` can be reassigned.
8+
9+
`@_` is a plain instance variable of `main`.
10+
11+
## 3. lambda syntax
12+
13+
```ruby
14+
l1 = lambda {|args| body}
15+
l2 = ->(args){body}
16+
17+
l1.call(args)
18+
l1.(args)
19+
l2[args]
20+
21+
l1<<l2 #=> ->(args){l1[l2[args]]}
22+
```
23+
24+
## 4. %-literals for string:
25+
26+
* `[` and `]`
27+
* `(` and `)`
28+
* `{` and `}`
29+
* `<` and `>`
30+
* **Any other character, as both beginning and ending delimiters.**
31+
32+
`%%% = ''`
33+
34+
## 5. `String#<<`
35+
36+
Append the string with value provided, then return the modified string (self).
37+
38+
`String#<<(Integer)` implies `Integer#chr`.
39+
40+
## 6. `$>`
41+
42+
Defaults to `$STDOUT`.
43+
44+
`io << value` prints `value` to `io` then return `io`.
45+
46+
## 7. Misc
47+
48+
Character `'l'`, `'o'`, `'r'` are kept according to the requirements.

0 commit comments

Comments
 (0)