Skip to content

Assistance fixing my hypotrochoid illustration #4

Closed Answered by ianthehenry
xrd asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! Happy to help.

So there's not actually a reason to make this a macro -- you can pass functions as arguments to other functions and call them just fine. That'll simplify things a bit.

(defn hypotrochoid [f f2 r big-r t d time]
  (+ 
    (* d (f (
      (* t (/ (- big-r r) r)
    ))))
    ( * (- big-r r) (f2 t)))
)

(toodle 
  {:speed 5 :position [50 100]}  
  (set self.position 
    [
      (
      hypotrochoid cos sin 3 5 2.3 2 self.age
    )
    (
      hypotrochoid sin cos 3 5 2.3 2 self.age
    )
  ])
  )

I renamed fn and fn2 to f and f2, because fn is a special-form -- you can create a variable called fn but you won't actually be able to call it -- not sure if that's what led yo…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by xrd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2 on April 12, 2023 00:26.