I was trying to create a function that would display generic stuff plus whatever function I wanted to output for the day, but I think I'm going about it wrong. I created a simplified scenario: Trying to create a function called "todays-event" that... If called without args would: * print: "Sorry! nothing new for today" from inside the 'todays-event' function ; (todays-event)
; hoped for result:
"Sorry! nothing new for today"
If called with args would:* display "Generic introduction to todays: " ....the generic stuff inside the function 'todays-event' * then display the results of the function passed in.... ;(todays-event "song" (sunday-song))
; hoped for result:
Generic introduction to todays: Song
I love this song!
Psuedo Echo: Funky Town
Line 1: Won't you take me to....funky-town...yeah yeah
Line 2: Won't you take me to....funky-town...yeah yeah yeah
Line 3: Won't you take me to....funky-town...yeah yeah
;(todays-event "word" (sunday-word))
; hoped for result:
Generic introduction to todays: Word
LISP
Lots of Infuratingly Strange Parenthesis
;; functions created
(def todays-event ((o type) (o todays-thing))
(if (is type nil)
(pr "Sorry! nothing new for today")
((pr "Generic introduction to todays: ")(pr type)
(list todays-thing))))
(def sunday-song ()
(prbold "I love this song!")
(link "Psuedo Echo: Funky Town" "http://www.youtube.com/watch?v=jIOurOl3Y1A")
(prn "Line 1: Won't you take me to....funky-town...yeah yeah")
(prn "Line 2: Won't you take me to....funky-town...yeah yeah yeah")
(prn "Line 3: Won't you take me to....funky-town...yeah yeah"))
(def sunday-word ()
(prbold "LISP")
(prn "Lots of Infuratingly Strange Parenthesis"))
The idea is that I can create any given function for the day and pass it into an existing framework. The only problem is that (todays-thing) is being evaluated right off the start and not being passed into the
part (list todays-thing)....Any suggestions on how to do this kind of thing ? Thanks.
T. |