Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:53:09+00:00 2026-06-06T23:53:09+00:00

I have often seen people spawning new functions with arity 0 (no arguments) as:

  • 0

I have often seen people spawning new functions with arity 0 (no arguments) as:

 spawn_link(fun function_name/0).

where function_name/0 can be for example:

function_name() -> 
                   io:format("hello~n", []) 
end.

Can I spawn in a similar way a function which takes a parameter? For example:

function_name(Arg) ->
                   io:format("hello ~p ~n", [Arg])
end.

Should I use

spawn_link(Module, Function, Arg)

or something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:53:11+00:00Added an answer on June 6, 2026 at 11:53 pm

    You can use that spawn_link with arguments, build a lambda function (fun) with the specified arguments or just with fixed ones. So for example you could use, as you say, just:

    spawn_link(Module, Function, Args).
    

    or export your own spawn_link (or start) in your module:

    spawn_link(Args) ->
        spawn_link(?MODULE, fun myfun/X, Args).
    

    or use a fun:

    spawn_link(Args) ->
        spawn_link(fun () -> apply(fun myfun/X, Args) end).
    

    or if you internally call some function with fixed parameters:

    spawn_link() ->
        spawn_link(fun () -> myfun(1,2,3) end).
    

    where X in this case is the arity of the myfun function in each case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have often seen the spinning gears OpenGL example ( I think originally done
I have seen people often use a separate table to store relations between tables.
I have often seen an init() within the constructor of AS3 classes, sometimes even
I have often heard people talking about hashing and hash maps and hash tables.
I have often seen tests where canned inputs are fed into a program, one
I have often seen the queries written in SQL in CAPITAL LETTERS . Though
In code I've seen, some people often use private variables, e.g. private static int
I have often seen cases where in a series of printf statements that ask
In some methods returning strings, I have often seen returned if the actual string
Often I have seen stored procs used for writing business logic in an application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.