Changeset 39737 in project


Ignore:
Timestamp:
03/18/21 16:17:06 (5 weeks ago)
Author:
Kon Lovett
Message:

has srfi-1 dep, fix seq-utils sort (was side-effecting arg)

Location:
release/5/micro-stats/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • release/5/micro-stats/trunk/micro-stats.egg

    r39369 r39737  
    1 ((synopsis "easily create micro-stats")
    2  (version "0.0.2")
     1((synopsis "Easily create micro-stats")
     2 (version "0.0.3")
    33 (author "David Krentzlin")
    4  (maintainer "[[kon lovett]]")
     4 (maintainer "Kon Lovett")
    55 (category math)
    66 (license "GPLv3")
    7  (dependencies sequences)
     7 (dependencies srfi-1 sequences)
    88 (test-dependencies test)
    99 (components
  • release/5/micro-stats/trunk/micro-stats.scm

    r39355 r39737  
    2222  (chicken flonum)
    2323  (chicken foreign)
    24   (only (srfi 1) first append! list-copy)
     24  (only (srfi 1) first list-copy)
    2525  (prefix sequences seq:)
    2626  (prefix seq-utils seq*:))
  • release/5/micro-stats/trunk/seq-utils.scm

    r39355 r39737  
    1515  (chicken base)
    1616  (chicken type)
     17  (only (srfi 1) list-copy)
    1718  (prefix (chicken sort) chicken:)
    1819  (prefix sequences seq:))
     
    5758
    5859(define (sort seq less?)
    59   (seq:coerce seq (chicken:sort! (seq->list seq) less?)) )
     60  (define (*seq->list x) (if (list? x) (list-copy x) (seq:coerce *empty-list* x)))
     61  (seq:coerce seq (chicken:sort! (*seq->list seq) less?)) )
    6062
    6163;;
  • release/5/micro-stats/trunk/tests/micro-stats-test.scm

    r39353 r39737  
    2222  (test "Performs Sort!" R1 (sort! V1 <))
    2323  (test-assert "And Source is Sorted" (sorted? V1 <))
     24)
     25
     26;sort was side-effecting a list arg
     27(test-group "sort bug"
     28  (define R1L '(1 2 3 4 5 6 7 8 9))
     29  (define V1L '(5 3 4 2 1 9 7 8 6))
     30  (test "Performs Sort" R1L (sort V1L <))
     31  (test-assert "And Source is Unsorted" (not (sorted? V1L <)))
     32  (test "Performs Sort!" R1L (sort! V1L <))
     33  (test-assert "And Source is Sorted" (sorted? V1L <))
    2434)
    2535
Note: See TracChangeset for help on using the changeset viewer.