Timeline for How can I partially evaluate a function?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Jan 16, 2017 at 22:31 | history | suggested | kalix | CC BY-SA 3.0 |
I corrected the Updated version of partialEvaluate to work as the OP advertised: there was a comma missing after `totargs` and `args` must not be indexed by i.
|
Jan 16, 2017 at 21:32 | review | Suggested edits | |||
S Jan 16, 2017 at 22:31 | |||||
Jun 16, 2015 at 6:02 | history | edited | march | CC BY-SA 3.0 |
Updated to be more in line with what OP wanted. Included brief explanation of why OP's original code didn't work.
|
Jun 16, 2015 at 5:58 | comment | added | march | @sampson I see. I think I have a version that works for exactly what you want, now. See the edit. | |
Jun 16, 2015 at 5:56 | history | edited | march | CC BY-SA 3.0 |
Updated to be more in line with what OP wanted.
|
Jun 16, 2015 at 5:51 | comment | added | user30193 |
A pedantic difference, but my ugly do loop was to account for a Length[args]=Length[targets] constraint which I didn't mention earlier. Thanks a lot for your help.
|
|
Jun 16, 2015 at 5:47 | comment | added | march | That's essentially what I did, actually, but I'll post anyway, since it's slightly cleaner. | |
Jun 16, 2015 at 5:43 | comment | added | user30193 |
Ah, I forgot to share. I added a simple j=1;Do[If[tmp[[i]]==Slot[i],tmp[[i]]=Slot[j++],{i,Range[totargs]}] fix. before the evaluation step. Share your solution anyway, it's probably more clever!
|
|
Jun 16, 2015 at 5:09 | comment | added | march |
Thank you for the accept! However, are you sure? Is it possible that what you actually want is g[x[1], #1, #2, x[4], #3] & ? Because I imagine you will want to apply this new function to a three-element list, rather than still a five element list. If so, I can update with a new version that returns this alternative version
|
|
Jun 16, 2015 at 4:25 | comment | added | user30193 | This is what I was looking for, thank you! | |
Jun 16, 2015 at 4:25 | vote | accept | CommunityBot | ||
Jun 16, 2015 at 4:11 | history | answered | march | CC BY-SA 3.0 |