Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calling all knights of the lambda

  1. Aug 20, 2010 #1
    i'm really going nuts here. I don't know much about lisp. however, I do know a thing or two about C. Knowing a lot about C and trying to learn lisp is like (to me) trying to learn italian when completely wasted out of your mind whilst taking a trip to italy but speaking fluent english anyway. Anyway, I'm attempting to write a couple of elementary linear algebra equations into lisp.

    example 1:

    i have my crossproduct function as:

    (defun crossprod (v1 v2 v3 u1 u2 u3)
    (list
    (- (* v2 u3) (* v3 u2))
    (*-1 (- (*v1 u3) (* v3 u1)))
    (- (*v1 u2) (* v2 u1))))

    and I mean it works fine and i've got no issues with it...if you like it go ahead and use it but there is something that tells me wait. I wanna be able to use VECTORS as lists ie the vector 1,-5,8 or 6,-6,6 but of course in lisp it would be some sort of form like (1 -5 8) or (6 -6 6) and I cant seem to get how to say something like

    (split vector1 vector2)
    where I can use the i j k's of each vector in some other function or whatever. etc.


    anyway, I am more curious about a normalize-ing deal that I can use vector inputs (as lists). at the base of it all how can I smash up lists and use them in sequence so I dont, for instance, have to say: (first vector1) (second vector2) (third vector3) etc....

    I'll admit I could mix and match c and this stuff only because I know loops in C(but I dont mean really I mean conceptually in my noggin, what, you never thought it'd be easy searing for those red mushrooms from mario in grandtheft auto?). I dont know loops about lisp too well. anyone who as any algorithms..let me know. thanks


    -mt
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Calling all knights of the lambda
  1. Call by reference (Replies: 11)

Loading...