⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 differensort.scm

📁 A method to Sort a list of numbers in Scheme... It also has other operations in Scheme
💻 SCM
字号:
(define ls (list 3 1 2 4 5))

(define (sort lis)
  (let ((i 0) (newls (list)) (j 1) (maxv 0) (templist (list)) (templ ls))
    (let loop ((templ ls))
      (let ((len (- (length templ) 1)))
      (if (= (length templ) 1) (begin 
                                 (set! newls (append newls (list (list-ref templ 0))))
                                 (display newls) 
                                 )
          (begin
                                          
      (if (> j len) (begin
                      (set! newls (append newls (list (list-ref templ maxv))))`
                      (set! maxv 0)
                      (set! j 1)
                      (set! i 0)
                      (set! templ templist)
                      (set! templist (list))
                      (loop templ)
                      )
                      
                       (begin
            (if (> (list-ref templ i) (list-ref templ j))
            (begin
              (set! templist (append templist (list (list-ref templ j))))
              (set! maxv i)
              (set! j (+ j 1))
              (loop templ)
              )
            (begin
              (set! templist (append templist (list (list-ref templ i))))
              (set! maxv j)
              (set! i j)
              (set! j (+ j 1))
              (loop templ))
            )
          )
      )
    )
    
  )
      )
    ))         )
                                 
                                
                                
                                
             

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -