From 824fcb3531999de59f8539727c79a88af68e4143 Mon Sep 17 00:00:00 2001 From: Magnar Sveen Date: Thu, 15 Aug 2013 19:04:12 +0200 Subject: [PATCH] Release 1.8.0 --- README.md | 42 +++++++++++++++++++++++------------------- dash.el | 2 +- dev/examples.el | 18 +++++++++--------- readme-template.md | 6 +++++- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index fd9ad52..3a10b12 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,6 @@ Or you can just dump `dash.el` in your load path somewhere. ## Functions -* [-first-item](#-first-item-list) `(list)` -* [-last-item](#-last-item-list) `(list)` * [-map](#-map-fn-list) `(fn list)` * [-reduce-from](#-reduce-from-fn-initial-value-list) `(fn initial-value list)` * [-reduce-r-from](#-reduce-r-from-fn-initial-value-list) `(fn initial-value list)` @@ -66,6 +64,8 @@ Or you can just dump `dash.el` in your load path somewhere. * [-zip](#-zip-list1-list2) `(list1 list2)` * [-first](#-first-pred-list) `(pred list)` * [-last](#-last-pred-list) `(pred list)` +* [-first-item](#-first-item-list) `(list)` +* [-last-item](#-last-item-list) `(list)` * [-union](#-union-list-list2) `(list list2)` * [-difference](#-difference-list-list2) `(list list2)` * [-intersection](#-intersection-list-list2) `(list list2)` @@ -113,22 +113,6 @@ which demonstrates the usefulness of both versions. ## Documentation and examples -### -first-item `(list)` - -Returns the first item of `list`, or nil on an empty list. - -```cl -(-first-item '(1 2 3)) ;; => 1 -``` - -### -last-item `(list)` - -Returns the first item of `list`, or nil on an empty list. - -```cl -(-last-item '(1 2 3)) ;; => 3 -``` - ### -map `(fn list)` Returns a new list consisting of the result of applying `fn` to the items in `list`. @@ -711,6 +695,22 @@ Return the last x in `list` where (`pred` x) is non-nil, else nil. (--last (> (length it) 3) '("a" "looong" "word" "and" "short" "one")) ;; => "short" ``` +### -first-item `(list)` + +Returns the first item of `list`, or nil on an empty list. + +```cl +(-first-item '(1 2 3)) ;; => 1 +``` + +### -last-item `(list)` + +Returns the first item of `list`, or nil on an empty list. + +```cl +(-last-item '(1 2 3)) ;; => 3 +``` + ### -union `(list list2)` Return a new list containing the elements of `list1` and elements of `list2` that are not in `list1`. @@ -964,6 +964,10 @@ Change `readme-template.md` or `examples-to-docs.el` instead. ## Changelist +### From 1.7.0 to master + +- Add `-first-item` and `-last-item` (Wilfred Hughes) + ### From 1.6.0 to 1.7.0 - Add `-rotate` (Matus Goljer) @@ -1002,7 +1006,7 @@ Change `readme-template.md` or `examples-to-docs.el` instead. - [tali713](https://github.com/tali713) is the author of `-applify`. - [Víctor M. Valenzuela](https://github.com/vemv) contributed `-repeat`. - [Nic Ferrier](https://github.com/nicferrier) contributed `-cons*`. - - [Wilfred Hughes](https://github.com/Wilfred) contributed `-slice`. + - [Wilfred Hughes](https://github.com/Wilfred) contributed `-slice`, `-first-item` and `-last-item`. - [Emanuel Evans](https://github.com/shosti) contributed `-if-let`, `-when-let` and `-insert-at`. - [Johan Andersson](https://github.com/rejeep) contributed `-sum`, `-product`, `-min`, `-max`, `-min-by` and `-max-by`. diff --git a/dash.el b/dash.el index 0570e7f..bb2a97c 100644 --- a/dash.el +++ b/dash.el @@ -3,7 +3,7 @@ ;; Copyright (C) 2012 Magnar Sveen ;; Author: Magnar Sveen -;; Version: 1.7.0 +;; Version: 1.8.0 ;; Keywords: lists ;; This program is free software; you can redistribute it and/or modify diff --git a/dev/examples.el b/dev/examples.el index 28e50bf..c382921 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -9,14 +9,6 @@ (defun square (num) (* num num)) (defun three-letters () '("A" "B" "C")) -(defexamples -first-item - (-first-item '(1 2 3)) => 1 - (-first-item nil => nil)) - -(defexamples -last-item - (-last-item '(1 2 3)) => 3 - (-last-item nil => nil)) - (defexamples -map (-map (lambda (num) (* num num)) '(1 2 3 4)) => '(1 4 9 16) (-map 'square '(1 2 3 4)) => '(1 4 9 16) @@ -209,7 +201,7 @@ (defexamples -rotate (-rotate 3 '(1 2 3 4 5 6 7)) => '(5 6 7 1 2 3 4) - (-rotate -3 '(1 2 3 4 5 6 7)) => '(4 5 6 7 1 2 3)) + (-rotate -3 '(1 2 3 4 5 6 7)) => '(4 5 6 7 1 2 3)) (defexamples -insert-at (-insert-at 1 'x '(a b c)) => '(a x b c) @@ -293,6 +285,14 @@ (-last 'even? '(1 3 7 5 9)) => nil (--last (> (length it) 3) '("a" "looong" "word" "and" "short" "one")) => "short") +(defexamples -first-item + (-first-item '(1 2 3)) => 1 + (-first-item nil => nil)) + +(defexamples -last-item + (-last-item '(1 2 3)) => 3 + (-last-item nil => nil)) + (defexamples -union (-union '(1 2 3) '(3 4 5)) => '(1 2 3 4 5) (-union '(1 2 3 4) '()) => '(1 2 3 4) diff --git a/readme-template.md b/readme-template.md index 7aa9dc0..7d7624b 100644 --- a/readme-template.md +++ b/readme-template.md @@ -71,6 +71,10 @@ Change `readme-template.md` or `examples-to-docs.el` instead. ## Changelist +### From 1.7.0 to 1.8.0 + +- Add `-first-item` and `-last-item` (Wilfred Hughes) + ### From 1.6.0 to 1.7.0 - Add `-rotate` (Matus Goljer) @@ -109,7 +113,7 @@ Change `readme-template.md` or `examples-to-docs.el` instead. - [tali713](https://github.com/tali713) is the author of `-applify`. - [Víctor M. Valenzuela](https://github.com/vemv) contributed `-repeat`. - [Nic Ferrier](https://github.com/nicferrier) contributed `-cons*`. - - [Wilfred Hughes](https://github.com/Wilfred) contributed `-slice`. + - [Wilfred Hughes](https://github.com/Wilfred) contributed `-slice`, `-first-item` and `-last-item`. - [Emanuel Evans](https://github.com/shosti) contributed `-if-let`, `-when-let` and `-insert-at`. - [Johan Andersson](https://github.com/rejeep) contributed `-sum`, `-product`, `-min`, `-max`, `-min-by` and `-max-by`.