Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Amélioration dico + affichage erreur

  • Loading branch information...
commit 4edddf431a6229eac4ee06bcf86b237808295f4c 1 parent bfdf882
@Aluminium95 authored
Showing with 10 additions and 4 deletions.
  1. +9 −3 Data/Scheme/dico.scm
  2. +1 −1  src/calc.c
View
12 Data/Scheme/dico.scm
@@ -25,7 +25,7 @@
((equal? dict '())
'(error "Not Found"))
((equal? key (car (car dict)))
- (car (cdr (car dict))))
+ (cdr (car dict)))
(else
(dict-get (cdr dict) key))))
@@ -34,7 +34,7 @@
; Complexité : O(1)
; !!! -> pas de vérification des doublons
(define (dict-add dict key val)
- (cons (list key val) dict))
+ (cons `(,key . ,val) dict))
; Macro pour la modification directe
(define-macro (dict-add! dico key val)
@@ -67,10 +67,16 @@
((equal? after '())
(dict-add before key val))
((equal? key (car (car after)))
- (append (cons (list key val) before) (cdr after)))
+ (append (cons (cons key val) before) (cdr after)))
(else
(dict-set-acc (cons (car after) before) (cdr after) key val))))
(define-macro (dict-set! dict key val)
`(set! ,dict (dict-set-acc '() ,dict ,key ,val)))
+
+(define (dict-get-keys dict)
+ (map (lambda (x) (car x)) dict))
+
+(define (dict-get-vals dict)
+ (map (lambda (x) (cdr x)) dict))
View
2  src/calc.c
@@ -263,7 +263,7 @@ static SCM
wrapper_handler_proc (gpointer data, SCM key, SCM param)
{
ScmCalc* self = SCM_CALC (data);
- return scm_from_locale_string ("Erreur ... ");
+ return param;
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.