From: Javier Sancho Date: Fri, 27 Jul 2012 18:33:43 +0000 (+0200) Subject: New procedure-header procedure. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=76eb79c269dde7cc5c0660803bdd37ae3fdd8cb0;p=gacela.git New procedure-header procedure. --- diff --git a/src/utils.scm b/src/utils.scm index 17d1bbf..f2b339a 100644 --- a/src/utils.scm +++ b/src/utils.scm @@ -16,11 +16,12 @@ (define-module (gacela utils) - #:export (use-cache-with)) + #:use-module (ice-9 session) + #:export (use-cache-with + procedure-header)) ;;; Cache for procedures - (define (use-cache-with proc) (let ((cache (make-weak-value-hash-table))) (lambda (. param) @@ -31,3 +32,11 @@ (set! res (apply proc param)) (hash-set! cache key res) res)))))) + + +;;; Retrive header definition of a procedure + (define (procedure-header proc) + (let* ((args (procedure-arguments proc)) + (name (procedure-name proc)) + (required (cdar args))) + (cons name required))) diff --git a/src/views.scm b/src/views.scm index 0662577..32a7c3c 100644 --- a/src/views.scm +++ b/src/views.scm @@ -67,12 +67,12 @@ (set! properties (assoc-set! properties (car params) (cadr params))))))))) (define* (show mesh #:optional (view default-view)) - (let ((id (mesh 'get-property 'id))) + (let ((id (mesh 'inner-property 'id))) (if (not (hash-ref view id)) (hash-set! view id mesh)))) (define* (hide mesh #:optional (view default-view)) - (hash-remove! view (mesh 'get-property 'id))) + (hash-remove! view (mesh 'inner-property 'id))) (define* (translate mesh x y #:optional (z 0)) (mesh 'translate x y z)