Questions tagged [slot]
The slot tag has no summary.
60 questions
5
votes
1
answer
159
views
Using a variable in a named slot that refers to a column in either a Dataset or Tabular?
I would like to use variables in named slots referencing columns in Tabulars as I am used to in Dataset. But the behavior appears to be different, and I am hoping someone can explain what's actually ...
0
votes
1
answer
126
views
"{" cannot be followed by "[ " when using pure function [closed]
It may be a basic question, but if I use my pure function like the 4th line below, I got a syntax error. Could I know what I did wrong?
...
4
votes
1
answer
151
views
How to shorten the plotting code using slots and table? [closed]
Background Information
I have the following Mathematica code:
...
3
votes
2
answers
149
views
Multiple append over a Dataset
I have the following association :
...
0
votes
0
answers
56
views
How to programmatically generate Slot expressions for the function in FormFunction?
I am making a FormFunction expression programmatically, based on external lists of questions and possible answers. Here is a toy example:
...
0
votes
0
answers
88
views
Trouble using list of slot variables?
When I run this code:
...
1
vote
0
answers
106
views
get the first from a list using slots [closed]
Problem. I work with a list and want to get the first element. For specific reasons I want to use # in combination with Map
For example
...
2
votes
0
answers
97
views
Is there a way to refer to the value of another key in the same association?
I have an association like below and want to know how to properly phrase the value for winner. in this example, the answer should be "a".
...
1
vote
2
answers
141
views
Table doesn't work with Slot [closed]
Using Mathematica, I was trying to get {#1,#2,#3,#4,#5}, using Table[#n, {n, 1, 5}] Instead I only got {#n, #n, #n, #n, #n} How can I get {#1,#2,#3,#4,#5},
7
votes
4
answers
486
views
Apply pattern using a Slot (#) to each list element using a second slot
I am trying to find a neat way of applying an operation to each list element, but do not know how to properly use multiple slots or whether it is actually possible to solve this with multiple slots.
I ...
3
votes
1
answer
228
views
How to replace a multiple iterator Table to speed up computation
I need to create an array of data which resembles to something like this
Table[{i, Sin[j^2*i]}, {j, 2000}, {i, 0., Pi, Pi/10000.}]
where each "row" of ...
0
votes
1
answer
209
views
Defining a general function f with slot-holder arguments #1, #2
I am trying to get a general function $f$ accept slot-holder arguments #1, #2, where the actual arguments are lists {a1, a2,...} and {b1, b2,....}. I thought that this would involve some combination ...
0
votes
1
answer
144
views
How to use map and slot effectively?
I want to change my code from :
f[n_, x_] := n Sin[x ]
Table[{x, f[0, x], f[1, x], f[2, x], f[3, x]}, {x, -\[Pi], \[Pi],1.0}] // Chop
with OUTPUT :
...
2
votes
1
answer
140
views
Activating part without resolving [[1]]
I'll try to make this question more clear in a little while. In the mean time, I'll ask directly the question which motivated it:
Latin Square from submatrix
Original Question
I want, for instance, ...
4
votes
1
answer
127
views
Defnining a function with a parameter which is not a slot but a constant [closed]
One convenient way to define a function is
f[S,x_]:= 3
f[G,x_]:= 7
where the first parameter is not a slot but a constant. This way of constructing functions is ...