### How can I rewrite the function APPLY without using APPLY?

Posted:

**Fri Oct 24, 2008 10:23 am**So, I have often wondered about this. APPLY is not a special operator, but I cannot seem to figure out how it is written without usage of the APPLY function. If it is not a special operator, doesn't that mean that it should be representable in terms of special operators?

Put another way, how could someone write an APPLY-TO-VECTOR function? This would work something like this:

Would you have to cons up a new list that holds a vectors contents, then use APPLY? Or could you do something that uses the vector directly.

I'll leave it at that, but has anyone else thought about this? Anyone know if/how this can be done?

Zach

Put another way, how could someone write an APPLY-TO-VECTOR function? This would work something like this:

- Code: Select all
`(apply-to-vector #'+ (vector 1 2 3 4))`

==> 10

Would you have to cons up a new list that holds a vectors contents, then use APPLY? Or could you do something that uses the vector directly.

I'll leave it at that, but has anyone else thought about this? Anyone know if/how this can be done?

Zach