What is ___ vs _ in Mathematica ?

  • Context: Mathematica 
  • Thread starter Thread starter Physics_rocks
  • Start date Start date
  • Tags Tags
    Mathematica
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 4K views
Physics_rocks
Messages
12
Reaction score
0
Hi guys ,

I have the next declaration in Mathematica :

myfunc [lis_list]

and myfync [x_,y___]

what does "lis_list" means ? I know that when I want to declare a variable of a function
I must write myfunc[SomeVar_] with one _
but what are 3 times _ (meaning ___)

I hope I'm no asking a stupid question :)

thanks !
 
Physics news on Phys.org
_ is a pattern which can stand for any single expression, whereas ___ is a pattern that can stand for any sequence of 0 or more expressions. There is also __ which is a pattern that can stand for any sequence of 1 or more expressions.
 
Physics_rocks said:
what does "lis_list" means ?
It means that "lis" is only allowed to match a list, methinks. Mathematica's help system has a section on pattern matching -- it might be useful to go read it.