LoginSignup
10
0

More than 3 years have passed since last update.

次の関数の第二引数なんだよなー(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