4
votes
1answer
113 views

Multiple down-values with exactly the same lefthand side

I was working on an answer to this question, when I was sidetracked by what I bring up here. I wanted a function, which when given a string representing a binary number, would convert the string to a ...
1
vote
1answer
67 views

Why is Return not forcing an exit from my function? [duplicate]

Here is simplified version of my code that exhibits the behavior troubling me: ...
1
vote
0answers
56 views

Function behavior based on Head

I'm figuring how to implement a function behavior based on the Head of its argument. I mean ...
3
votes
1answer
105 views

How to Override the Head of a Symbol

I was wondering if it is possible to override the head of symbols/operators. As a motivating example if I run: Then Ket will be returned. But lets say I want Bob to be returned instead of Ket. Is ...
0
votes
2answers
177 views

Unwrapping a list when invoking a function [duplicate]

The minimal working example of my problem is as follows: l = {1, 2, 3, 4} f[a_, b_, c_, d_] = a + b + c + d Now, I'd like to evaluate ...
2
votes
1answer
146 views

Difference between function definitions [duplicate]

Possible Duplicate: Functions vs. patterns I thought about describing the context in which I faced this problem, but I figured it is general enough and clear enough to pose it as it is. ...