Post Reply 
With ZIP()...
05-27-2015, 02:43 PM
Post: #1
With ZIP()...
after reading the zip() help description, given something like:

L1:={1,2}; // (goal: Multiply two lists of unequal size)
L2:={2,4,6,8};

the zip function would return a list:

zip('*',L1,L2,0); --> syntax error (help shows single quotes surrounding function)
zip("*",L1,L2,0); --> Error: Invalid input
zip("L1*L2",L1,L2,0); --> {2,8,"1","L"} what the heck is that?

I was expecting {{2,4,6,8},{4,8,12,16}}, or a single list concatenation of this, or some zero padded similar output.

Conclusion: Help doesn't. Zip didn't.

L1*L2? <--- without external loop?
Find all posts by this user
Quote this message in a reply
05-27-2015, 10:07 PM
Post: #2
RE: With ZIP()...
(05-27-2015 02:43 PM)DrD Wrote:  after reading the zip() help description, given something like:

L1:={1,2}; // (goal: Multiply two lists of unequal size)
L2:={2,4,6,8};

the zip function would return a list:

zip('*',L1,L2,0); --> syntax error (help shows single quotes surrounding function)
zip("*",L1,L2,0); --> Error: Invalid input
zip("L1*L2",L1,L2,0); --> {2,8,"1","L"} what the heck is that?
zip is a CAS command.

zip('*',L1,L2,0) works in CAS mode and returns [2 8 0 0] which is the right result according to the help: [L1(1)*L2(1) L1(2)*L2(2) L1(3)*L2(3) L1(4)*L2(4)] after padding L1 with 0's.

In Home or in a program you should write it: zip("'*',L1,L2,0").

(05-27-2015 02:43 PM)DrD Wrote:  I was expecting {{2,4,6,8},{4,8,12,16}}, or a single list concatenation of this, or some zero padded similar output.
Now, if you want to get as the result {{2,4,6,8},{4,8,12,16}} you should try EXECON("&1*L2",L1), it works both in Home and CAS.
Find all posts by this user
Quote this message in a reply
05-29-2015, 12:01 PM
Post: #3
RE: With ZIP()...
What does it mean the acronym or abbreviation ZIP?
Find all posts by this user
Quote this message in a reply
05-29-2015, 12:39 PM (This post was last modified: 05-29-2015 12:46 PM by DrD.)
Post: #4
RE: With ZIP()...
It's just one of the CAS commands, accessible via the toolbox catalog, and described in HELP, and the user guide. The command lets you zip through two lists (or matrices), returning the function value applied to them.

My 'issue' is that help descriptions for CAS commands tend to work directly in the CAS view, but not in HOME view or HOME programs. Instead, the function arguments must be treated in a special way, (converted to string objects), in order to work outside of CAS. Unless that notion is firmly understood, there is a lot of related frustration. It would be nice to have examples of this extra requirement or at least something that points out that distinction as a general concept.

I've noticed that a lot of discussion in various forums has to do with folks working in the HOME environment, but needing the CAS functions as part of their process.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)