Changeset 31371 in project


Ignore:
Timestamp:
09/11/14 10:34:09 (5 years ago)
Author:
Ivan Raikov
Message:

ersatz release 1.13

Location:
release/4/ersatz
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/ersatz/tags/1.13/ersatz-lib.scm

    r31202 r31371  
    6666         op-capitalize op-title op-escape-html op-urlize op-striptags
    6767         op-wordcount op-sort op-dictsort
    68          op-list op-sublist
     68         op-list op-sublist op-group-by
    6969         )
    7070
     
    466466    (substring . ,(func-arg3 op-substring))
    467467    (sublist   . ,(func-arg3 op-sublist))
     468
     469    (groupBy   . ,(func-arg2 op-group-by))
    468470   
    469471    ;; built-in tests
  • release/4/ersatz/tags/1.13/ersatz.setup

    r31202 r31371  
    44  (make-pathname #f fn ##sys#load-dynamic-extension))   
    55
    6 (define version 1.12)
     6(define version 1.13)
    77
    88(use make)
  • release/4/ersatz/tags/1.13/runtime.scm

    r31202 r31371  
    10871087
    10881088
     1089(define (op-group-by base lst kwargs)
     1090  (let ((base (unbox-int base))
     1091        (lst  (unbox-list lst)))
     1092    (let recur ((lst lst) (groups '()))
     1093      (if (< (length lst) base)
     1094          (Tlist (reverse (cons (Tlist lst) groups)))
     1095          (recur (drop lst base)
     1096                 (cons (Tlist (take lst base)) groups))
     1097          ))
     1098    ))
     1099
     1100
    10891101(define (op-range start stop kwargs)
    10901102  (let ((start (unbox-int start))
  • release/4/ersatz/tags/1.13/tests/run.scm

    r29123 r31371  
    219219  (test-assert "sublist" (tval-equal? (op-sublist (Tint 1) (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
    220220                                      (Tlist (list (Tint 1) (Tint 2) (Tint 3)))))
     221
     222  (test-assert "groupBy" (tval-equal? (op-group-by (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
     223                                      (Tlist (list (Tlist (list (Tint 0) (Tint 1) (Tint 2))) (Tlist (list (Tint 3)))))))
    221224
    222225  (test-assert "expand and escape"
  • release/4/ersatz/trunk/ersatz-lib.scm

    r31202 r31371  
    6666         op-capitalize op-title op-escape-html op-urlize op-striptags
    6767         op-wordcount op-sort op-dictsort
    68          op-list op-sublist
     68         op-list op-sublist op-group-by
    6969         )
    7070
     
    466466    (substring . ,(func-arg3 op-substring))
    467467    (sublist   . ,(func-arg3 op-sublist))
     468
     469    (groupBy   . ,(func-arg2 op-group-by))
    468470   
    469471    ;; built-in tests
  • release/4/ersatz/trunk/ersatz.setup

    r31202 r31371  
    44  (make-pathname #f fn ##sys#load-dynamic-extension))   
    55
    6 (define version 1.12)
     6(define version 1.13)
    77
    88(use make)
  • release/4/ersatz/trunk/runtime.scm

    r31202 r31371  
    10871087
    10881088
     1089(define (op-group-by base lst kwargs)
     1090  (let ((base (unbox-int base))
     1091        (lst  (unbox-list lst)))
     1092    (let recur ((lst lst) (groups '()))
     1093      (if (< (length lst) base)
     1094          (Tlist (reverse (cons (Tlist lst) groups)))
     1095          (recur (drop lst base)
     1096                 (cons (Tlist (take lst base)) groups))
     1097          ))
     1098    ))
     1099
     1100
    10891101(define (op-range start stop kwargs)
    10901102  (let ((start (unbox-int start))
  • release/4/ersatz/trunk/tests/run.scm

    r29123 r31371  
    219219  (test-assert "sublist" (tval-equal? (op-sublist (Tint 1) (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
    220220                                      (Tlist (list (Tint 1) (Tint 2) (Tint 3)))))
     221
     222  (test-assert "groupBy" (tval-equal? (op-group-by (Tint 3) (Tlist (list (Tint 0) (Tint 1) (Tint 2) (Tint 3))) kwargs)
     223                                      (Tlist (list (Tlist (list (Tint 0) (Tint 1) (Tint 2))) (Tlist (list (Tint 3)))))))
    221224
    222225  (test-assert "expand and escape"
Note: See TracChangeset for help on using the changeset viewer.