Message Boards Message Boards

0
|
4625 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to Thread a list and a (supposed to be ceiclic) list of different lengt

Posted 9 years ago

Hello,

im trying to Thread a function over a list and a socond shorter list wich should be considered being ceiclic. How do you approach that in Mathematica without programming the loop expicitly? I want the solutions to be Mathematica-Style because that is my whole point of applying Mathematica to the Project Euler problems.

cipher = Import[
   "C:\\daten\\OpenCourseWare\\Computer Science\\Programming \
Languages\\Mathematica\\Project Euler\\p059_cipher.txt"];

cipher = ToExpression@StringSplit[cipher, ","];


key = {11, 22, 33};
Thread[BitXor[cipher, key]]
POSTED BY: Erik Itter
2 Replies
Posted 9 years ago

Thanks, that works.

POSTED BY: Erik Itter

Try using something like:

list = {4, 5, 6}
PadRight[list, 10, list]

where 10 is the length that you like...

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract