From 76eb79c269dde7cc5c0660803bdd37ae3fdd8cb0 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Fri, 27 Jul 2012 20:33:43 +0200 Subject: [PATCH] New procedure-header procedure. --- src/utils.scm | 13 +++++++++++-- src/views.scm | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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) -- 2.39.5