New syntax to call a method.
a .. b
# need to add parenthesis
(a..b).each do
end
# introduce new operator to call a method
a .. b ??? each do
end
a .. b |> each do
end
# elixir
x |> func1 |> func2
func2(func1(x))
# ruby
x |> method1(1) |> method2(2) 👉 y
x |> method1(1) |> method2(2) =| y
x |> method1(1) |> method2(2) ==> y
x |> method1(1) |> method2(2) @> y
x ← method1(1) ← method2(2) |> y
x |>> method1(1) |>> method2(2) |> y
x |> method1(1) |> method2(2) |>> y
x @. method1(1) @. method2(2) |> y
x |> method1(1) |> method2(2) -=> y
x :: method1(1) :: method2(2)
x ::: method1(1) ::: method2(2)
x :: method1 :: method2(2)
x -> method1 -> method2 # like c++
# -> is used for -> x {...}
x -> .method1 -> .method2 -> result
Π = 3.14 # Constant
π = 3.14 # local variable
# Unicode記号は予約語化しておきたい
ℝuby = 3.0 # Constant
令和 = 平成 + 1
x + 1
x |> + 1 # prohibitted
y = x.method1(1).method2(2)
🍣 = Sushi.new
# Haskell: f(g(x)) == f $ g x
a .. b $ each do
end
a .. b $ each -> p @1
a .. b ← each do
end
a..$each {} # ?
[[1, 2]].each do |i,| p i end # => 1
[[1, 2]].each do |i| p i end # => [1,2]
4.times do p :1 end
31.times do p @@1 end
4.times do p @ end # only 1 arg
5.times do p @0 end
6.times do p ① end
7.times do p 🍣 end
8.times do p it end # Does anyone use RSpec? :p
9.times do p that end
10.times do p 🍥1 end
11.times do p _1 end # For one argument, maybe _
11.times do eat 🍜 end
12.times do p @1 end
[1, 2, 3].zip([4, 5, 6]).each do @₁ + @₂ end
[1, 2, 3].zip([4, 5, 6]).each do @¹ + @² end
[1, 2, 3].zip([4, 5, 6]).each do $₁ + $₂ end
[1, 2, 3].zip([4, 5, 6]).each do $¹ + $² end
%1とかはだめですかね?(会場より)
3.times do p%1 end # p(%1) or p.%(1) ?
# hello
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing