Post Reply 
Symbolic reference question
10-03-2020, 02:05 AM
Post: #9
RE: Symbolic reference question
I'd say the best solution would be to use a helper function:

Code:

dupe:= (expr_) -> id({expr_}, {expr_});
{c, {a, b}} := dupe(100.5,102.5);

the 'seq' function can also be used here

Code:

{c, {a, b}} := seq({100.5,102.5}, 2);

if you need a more generalized solution:

Code:

// https://en.wikipedia.org/wiki/Currying
brancher:= (times_) -> ((expr_)->seq({expr_}, times_));
{c, {a, b}} := brancher(2)(100.5,102.5);

// the dupe function can be rewritten as
dupe:= brancher(2);

Having functions be first class is a really powerful feature of CAS, please use it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Symbolic reference question - DrD - 06-08-2020, 09:40 PM
RE: Symbolic reference question - DrD - 06-09-2020, 10:17 AM
RE: Symbolic reference question - DrD - 06-09-2020, 09:32 AM
RE: Symbolic reference question - toshk - 06-09-2020, 01:29 PM
RE: Symbolic reference question - fakuivan - 10-03-2020 02:05 AM



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