Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 26956

Questions about applying functions or operators to expressions, especially constructs that take advantage of Map (/@) functionality.

2 votes

Referring to arguments in nested functions

The Map statement can be rewritten as such: Map[ Function[{elementOfFirstList}, Select[secondList, Function[{elementOfSecondList}, StringMatchQ[myFunction[elementOfSecondList], elementOfFirstList …
LLlAMnYP's user avatar
  • 11.5k
5 votes

Indexed Map Thread

At face value there is this solution: IndexedMapThread[list1_,list2_] := MapThread[(#1*#3+#2*#4 &),{list1,list2,Range@Length@list1,Range@Length@list2}] IndexedMapThread[{a, b, c}, {d, e, f}] (* …
LLlAMnYP's user avatar
  • 11.5k
5 votes

How to Map a subset of list elements to a function?

It's strange, that ListCorrelate has not been mentioned, according to the documentation, it has been around unchanged since v.4.0. It allows a one liner: ListCorrelate[{1, 1}, Range@9, {1, -1}, {}, T …
LLlAMnYP's user avatar
  • 11.5k
9 votes
Accepted

how to concatenate a list of a list of strings

Here's an approach for any two multi-dimensional lists of strings which have arbitrary, but matching structures: stringJoin[x__String] := StringJoin[x] SetAttributes[stringJoin, Listable] stringJoin[ …
LLlAMnYP's user avatar
  • 11.5k
10 votes
1 answer
146 views

MapAt with Replace(All) causing kernel crash

Bug introduced in 10.1 and fixed in 10.2 I wanted to roll a function that works like /. but only acts on the very first match it encounters. ReplaceAtFirst = Function[{expr, rule}, MapAt[Repla …
LLlAMnYP's user avatar
  • 11.5k
4 votes
Accepted

MapAt with Replace(All) causing kernel crash

Bug introduced in 10.1 and fixed in 10.2 From the comments of @Szabolcs and @SquareOne: Works under OS X in 10.0 and 10.2, but not in 10.1. From my observations: Works under Win7x64 in 8.0 and 10. …
LLlAMnYP's user avatar
  • 11.5k