Message Boards Message Boards

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

A problem of Nested functions

Posted 6 hours ago

POSTED BY: Martin Xia
2 Replies
Posted 5 hours ago

The pattern vendorModel_Function constrains the definition to require that the first argument has Head Function. You passed in f1, but that doesn't have Head Function. You can either change your definition for f2 or you can pass in an actual Function. So, here's an alternate that I'll call f3:

f3[vendorModel_, models_] := vendorModel /@ models;
f3[f1, {3, 4}]
(* {10, 17} *)

By leaving vendorModel unconstrained, the function is more flexible.

Or, using your original f2, you could do this:

f2[f1[#] &, {3, 4}]
(* {10, 17} *)
POSTED BY: Eric Rimbey

Eric, unbelievable. you solve my problem, i have think about it for 6 hours. the original function is quite complicated and i try hard to identify the issue. it is really happy that you share it , thank you!

POSTED BY: Martin Xia
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