I'm working on some opengl code in clojure and I want to specify a
vertex.  However, instead of passing in the three arguments it wants,
I want to specify a single vector of 3 elements.  How can I do this?

Here's what it would normally look like (gl represents the current
opengl drawing context object):

(.glVertex3f gl 1.0 3.7 0.0)


Here's what I want to write:

(let [ point [1.0 3.7 0.0] ]
  (.glVertex3f gl point))


I've tried playing around with apply.

(apply .glVertex3f gl point)

But it generates an error: no matching method glVertex3f for class
com.sun.opengl.impl.GLImpl.

I'm not sure what this concept is called, but here's some code in
other languages that demonstrates it.

Here's the equivalent concept in Haskell

foo :: (Show a) => a -> a -> IO ()
foo a b = mapM_ print [a, b]

*Main> uncurry foo (1,2)
1
2


Or in Ruby

def foo(a,b)
  puts a
  puts b
end

x = [1,2]

foo *x
1
2


Any ideas?

Thanks,
Hitesh


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to