12
$\begingroup$

Are there practice notebooks or exercises for practising using pure functions and rule-patterns?

I've completed "An Elementary Introduction to the Wolfram Language" and "Fast Introduction for Programmers" but there were some examples missing for things like sequential slot (##1) or more complex combinations of using pure functions with rule-patterns.

I've taken a look at "Wolfram Programming Cloud" but the examples there are more to do with practical examples using Wolfram functions and datasets.

$\endgroup$
3
  • $\begingroup$ I'm in the same boat but generically across the language. I was thinking of a set of beginner/intermediate/advanced Q&A cue cards that used good SE questions and had links to the SE page for further info. $\endgroup$
    – Joe
    Commented Jun 14, 2017 at 23:48
  • $\begingroup$ The documentation for Function is quite good with respect to things like ##n and Attributes. See the Generalizations and Extensions. For patterns, what Ted Eresk suggested is useful, but I also have to highly recommend looking at Optional. I use variants on f[a:_Type:default]:=body all the time. See this as an example of how this works. $\endgroup$
    – b3m2a1
    Commented Jun 15, 2017 at 2:42
  • $\begingroup$ Found mathematica.stackexchange.com/questions/18/… and mathematica.stackexchange.com/questions/733/…. Whilst great resources for learning, does not contain practice .nb like "Elementary Introduction". $\endgroup$ Commented Jun 15, 2017 at 5:13

1 Answer 1

6
+25
$\begingroup$

Go here and read the sections about HoldPattern, Repeated, Slot SlotSequence. Then near the bottom of that page read the part about Pattern Matching. You can get lots of practice by using the features in code you write.... try solving problems that interest you.

$\endgroup$
1
  • $\begingroup$ I'm specifically looking for a more interactive practice like from "An Elementary Introduction to the Wolfram Language" exercise section. $\endgroup$ Commented Jun 16, 2017 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.