Changeset 40374 in project


Ignore:
Timestamp:
08/22/21 05:29:08 (5 weeks ago)
Author:
Kon Lovett
Message:

start+end for vector-iota! (example argument checking), new test runner

Location:
release/5/srfi-27/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/5/srfi-27/trunk/srfi-27.egg

    r40040 r40374  
    22
    33((synopsis "Sources of Random Bits")
    4  (version "4.1.5")
     4 (version "4.1.6")
    55 (category data)
    66 (author "Sebastian Egner, for CHICKEN by Kon Lovett and [[Sergey Goldgaber]]")
  • release/5/srfi-27/trunk/srfi.27.vector.scm

    r39647 r40374  
    4545;;;
    4646
    47 #;
     47#; ;incomplete
    4848(define:-type (vector-iota (n fixnum)) -> (vector-of fixnum)
    4949  (import (only vector-lib vector-unfold))
    5050  (vector-unfold values n) )
    5151
    52 (: vector-iota! (vector fixnum -> void))
     52(: vector-iota! (vector fixnum #!optional fixnum -> void))
    5353;
    54 (define (vector-iota! vec n)
    55   (do ((i 0 (fx+ i 1)))
    56       ((fx= i n) vec)
    57     (vector-set! vec i i) ) )
     54(define (vector-iota! vec n #!optional (m #f))
     55  #;(unless (vector? vec) (error 'vector-iota! "not a vector" vec))
     56  (let ((start (if (not m) 0 n)) (end (if (not m) (vector-length vec) m)))
     57    #;(unless (<= start end) (error 'vector-iota! "limits swapped" start end))
     58    (do ((i start (fx+ i 1)))
     59        ((fx= i end) vec)
     60      (vector-set! vec i i) ) ) )
    5861
    5962;;;
     
    6972    (vector-iota! vec n)
    7073    (do ((k n (fx- k 1)))
    71         ((fx= k 1) vec )
     74        ((fx= k 1) vec)
    7275      ;random-swap
    7376      (let* (
  • release/5/srfi-27/trunk/tests/run.scm

    r39817 r40374  
    77    make-pathname pathname-file pathname-replace-directory pathname-strip-extension)
    88  (only (chicken process) system)
    9   (only (chicken process-context) command-line-arguments)
     9  (only (chicken process-context) command-line-arguments get-environment-variable)
    1010  (only (chicken format) format)
    1111  (only (chicken file) file-exists? find-files)
     
    1313
    1414;; Globals
     15
     16(define *csi* (or (get-environment-variable "CHICKEN_CSI") "csi"))
     17(define *csc* (or (get-environment-variable "CHICKEN_CSC") "csc"))
    1518
    1619(define *csc-init-options* '(
     
    7982
    8083(define (run-test-evaluated source)
    81   (format #t "*** csi ~A ***~%" (pathname-file source))
    82   (system-must (string-append "csi -s " source)) )
     84  (format #t "*** ~A ~A ***~%" *csi* (pathname-file source))
     85  (system-must (string-append *csi* " -s " source)) )
    8386
    8487(define (run-test-compiled source csc-options)
    8588  (let ((optstr (apply string-append (intersperse csc-options " "))))
    86     (format #t "*** csc ~A ~A ***~%" (pathname-file source) optstr)
     89    (format #t "*** ~A ~A ~A ***~%" *csc* (pathname-file source) optstr)
    8790    ;csc output is in current directory
    88     (system-must (string-append "csc" " " optstr " " source)) )
     91    (system-must (string-append *csc* " " optstr " " source)) )
    8992  (system-must (pathname-replace-directory (pathname-strip-extension source) *test-directory*)) )
    9093
Note: See TracChangeset for help on using the changeset viewer.