10
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Elixir その2Advent Calendar 2020

Day 6

次の関数の第二引数なんだよなー(Elixir)

Last updated at Posted at 2020-12-05

この記事は、Elixir その2 Advent Calendar 2020 6日目です。
前日は二次元リストの操作(Elixir) でした。


前の計算結果を次の関数の第二引数1にいれたい(Pipe operatorでつなぎたい)ことありませんか!?
ありますよね。 (そうじゃないと、この記事のレゾンデートルがない)

たとえば

content = DocomoTextToSpeech.run!("エリクサー")
File.write("output.wav", content)

docomo_text_to_speech

その1

DocomoTextToSpeech.run!("エリクサー")
|> (fn content -> File.write("output.wav", content) end).()

その2

DocomoTextToSpeech.run!("エリクサー")
|> (&File.write("output.wav", &1)).()

Wrapping Up :lgtm: :santa: :santa_tone1: :santa_tone2: :santa_tone3: :santa_tone4: :santa_tone5: :lgtm:

  1. 第二引数、第三引数、第四引数、...、第N引数――第一引数以外に指定したいという話です

10
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?