The difference is whether you are evaluating an expression, versus
putting it inside a function to be evaluated when the function is called.

(require racket/gui)

; Call message-box, get an immediate effect ...
(message-box "What do you think?" "hi, would you like a tomato" #f 
'(yes-no))
; The result ('yes or 'no) is printed in the repl/Interactions.

; Create a function/procedure, that takes no arguments, and its body calls 
message-box ...
(lambda () (message-box "Greeting" "hi, would you like a tomatillo" #f 
'(yes-no)))
; That which prints as #<procedure> since it's a function, and we didn't 
call it.

; To call a function we put parentheses around it ...
((lambda () (message-box "Greeting" "hi, would you like a pomodoro" #f 
'(yes-no)))
 )
; That evaluated the body.

; Name a function ...
(define greeter (lambda () (message-box "Greeting" "hi, would you like a 
green tomato" #f '(yes-no))))
; That didn't call it, and neither do ...
greeter
greeter
; Those just mention the function, which prints as #<procedure>.
; Call it to evaluate the body ..
(greeter)

By the way, your examples that don't wait 30 minutes actually do,
and if you wait 30 minutes they will try to call the callback, which
is not a function but the 'ok result from the message-box.

Try setting the timer to something shorter, and then wait after
you click the immediate message box, then when the timer
goes off there will be an error something like ...
application: not a procedure;
 expected a procedure that can be applied to arguments
  given: 'ok
  arguments...: [none]

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/884d5359-b94f-49ec-b9d5-699dfd844c6c%40googlegroups.com.

Reply via email to