Sha256: 07eeb289c230b50be74c998a985c57a17fd3fae7c6a088bec0d8756305640af2

Contents?: true

Size: 1.24 KB

Versions: 23

Compression:

Stored size: 1.24 KB

Contents

(examples-for include?
  ("nil for nil"
   (include? nil nil)
   nil)

  ("true for nil in list containing nil"
   (include? nil '(1 2 nil 3 4))
   t)

  ("nil for nil in list not containing nil"
   (include? nil '(1 2 3 4 5))
   nil)

  ("true for 42 in list containing 42"
   (include? 42 '(1 2 nil 3 42 4))
   42)

  ("nil for 42 in list not containing 42"
   (include? 42 '(1 2 nil 3 (a b c) 4))
   nil))

(examples-for seen?
  ("returns a function which returns t for every previously-seen argument, nil otherwise"
   (map (seen?) '(a b c d a a e f b b g h c c i j d d k l a b c d))
   (nil nil nil nil t t nil nil t t nil nil t t nil nil t t nil nil t t t t))

  ("each 'seen? is independent"
   (with (s1 (seen?) s2 (seen?) syms '(a b c a d b e c f))
         (list (map s1 syms) (map s2 syms)))
   ((nil nil nil t nil t nil t nil)
    (nil nil nil t nil t nil t nil))))

(examples-for uniqify
  ("returns a list with duplicates removed"
   (uniqify '(a b c d a a e f b b g h c c i j d d k l a b c d))
   (a b c d e f g h i j k l))

  ("removes duplicate dates"
   (let d (date 2004 3 12)
     (joinstr " "
              (uniqify (map λx(+ d x)
                            '(0 2 3 3 4 3 5 0 5) ))))
   "2004-03-12 2004-03-14 2004-03-15 2004-03-16 2004-03-17"))

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
nydp-0.6.0 lib/lisp/tests/include-examples.nydp
nydp-0.5.1 lib/lisp/tests/include-examples.nydp
nydp-0.5.0 lib/lisp/tests/include-examples.nydp
nydp-0.4.6 lib/lisp/tests/include-examples.nydp
nydp-0.4.5 lib/lisp/tests/include-examples.nydp
nydp-0.4.3 lib/lisp/tests/include-examples.nydp
nydp-0.4.2 lib/lisp/tests/include-examples.nydp
nydp-0.4.1 lib/lisp/tests/include-examples.nydp
nydp-0.4.0 lib/lisp/tests/include-examples.nydp
nydp-0.3.0 lib/lisp/tests/include-examples.nydp
nydp-0.2.6 lib/lisp/tests/include-examples.nydp
nydp-0.2.5 lib/lisp/tests/include-examples.nydp
nydp-0.2.3 lib/lisp/tests/include-examples.nydp
nydp-0.2.2 lib/lisp/tests/include-examples.nydp
nydp-0.2.1 lib/lisp/tests/include-examples.nydp
nydp-0.2.0 lib/lisp/tests/include-examples.nydp
nydp-0.1.15 lib/lisp/tests/include-examples.nydp
nydp-0.1.14 lib/lisp/tests/include-examples.nydp
nydp-0.1.13.2 lib/lisp/tests/include-examples.nydp
nydp-0.1.13.1 lib/lisp/tests/include-examples.nydp