Welcome to the CHICKEN Scheme pasting service

goofy bindings system added by hopfrog on Sat May 5 21:09:49 2012

	(define :defer   1)
	(define :press   2)
	(define :release 3)

	(define key-bindings (make-hash-table))

	(define (key-lookup key)
	  (hash-table-ref key-map key))

	(define-syntax bind
	  (syntax-rules ()
	    ((_ type key action)
	     (let ((command 
		    (cond
		     [(= type :press)   
		      (lambda (x) 
			(if (= x :press) 
			  (lambda () action)))]
		     [(= type :release)
		      (lambda (x) 
			(if (= x :release) 
			  (lambda () action)))]
		     [(= type :defer)  
		      (lambda (x) 
			(lambda () (eval (append (quote action) (list (= x :press))))))]))
		   (input-value (key-lookup key)))
	       (hash-table-set! key-bindings input-value command)))))
	
	(define (bind-invoke event key)
	  (let ((action-holder (hash-table-ref/default key-bindings key (lambda (x) #f))))
	    (let ((action (action-holder event)))
		(when (procedure? action)
		  (action)))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which procedure can be used to check whether its argument is a string?
Visually impaired? Let me spell it for you (wav file) download WAV