Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help to declare a variable or a function in scheme
#1
Scheme 
I'm trying to set a variable or a function but nothing is working, I always got "Illegal function", or "unbound variable", or whatnot

A screenshot about what I try to do
Having a variable will allow me to only input the variable in the other lines (in red), unless my thinking is wrong (that's also something to take in count).
   

Here is the code, if I understood (while (> i 0) where i is a variable and I try to catch when i is equal to 1
How can I catch that number to change the variable depending that number?

Code:
(while (> i 0)
      (set! image (vector-ref (cadr (gimp-image-list)) (- i 1)))
      (set! newFileName (string-append inDir
              pathchar inFileName
              (substring "0000000" (string-length
              (number->string (+ inFileNumber i))))
              (number->string (+ inFileNumber i)) saveString))

;;;;;;;;;;;;;;;;;  START to set my variable isInteractive ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

     (set! isInteractive (if ((equal? i 1) RUN-INTERACTIVE)
                                 (else (RUN-WITH-LAST-VALS))))

;;;;;;;;;;;;;;;;;;;;;;;;;   END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

      (cond
        ((equal? saveString ".webp")
                            
           (file-webp-save2 isInteractive ;;;; << once set isInteractive should switch to RUN-INTERACTIVE or RUN-WITH-LAST-VALS depending the value of i
                      image
                      (car (gimp-layer-new-from-visible image image "export"))
                      newFileName
                      newFileName
                      1    ; preset 0=default 1=pic 2=photo 3=drawing 4=icon 5=text
                      0    ; Use lossless encoding (0/1)
                      90   ; Quality of the image (0 <= quality <= 100)
                      90   ; alpha-quality  0<>100
                      0    ; Use layers for animation (0/1)
                      0    ; Loop animation infinitely (0/1)
                      0    ; Minimize animation size (0/1)
                      0    ; Maximum distance between key-frames (>=0)
                      0    ; Toggle saving exif data (0/1)
                      0    ; Toggle saving iptc data (0/1) works only if save XMP data is also checked ?
                      0    ; Toggle saving xmp data (0/1)
                      0    ; Toggle saving thumbnail (0/1)
                      0    ; Delay to use when timestamps are not available or forced
                      0    ; Force delay on all frames (0/1)

          ))

I did try with (cond instead of (if I tried also starting with (begin (set! nothing is working, and let's face it, I'm also overwhelmed by the number of parenthesis Huh
Patrice
Reply


Messages In This Thread
I need help to declare a variable or a function in scheme - by PixLab - 12-07-2023, 02:48 AM

Forum Jump: