Gabriel Scherer
03839754f4
List.equal, List.compare ( #9668 )
...
`List.equal f foo bar` is nicer than
`List.length foo = List.length bar && List.for_all2 f foo bar`.
Note: with List.compare there is a risk of users having opened the
List module, and then using 'compare' from the stdlib unqualified. For
example:
List.(sort compare foo bar)
Such code will break (type error), and has to be fixed by using
Stdlib.compare. Stdlib is available since OCaml 4.07; people wishing
to support both 4.12 and older releases would have to avoid opening
List, or rebind 'compare' locally.
2020-09-09 20:01:04 +02:00
Gabriel Scherer
ca6f3ee057
List.partition_map : (a -> (b, c) Either.t) -> a list -> b list * c list
2020-09-02 13:59:53 +02:00
Bernhard Schommer
e5ebec7058
Fold map function for List ( #8894 )
...
The fold_map function is quite common combination of fold and map
which allow it to pass an accumulator through map.
2019-11-07 14:12:58 +01:00
zapashcanon
c0e4096eaa
add List.filteri to the stdlib ( #9059 )
2019-10-29 09:45:19 +01:00
Gabriel Scherer
ba90da42ac
List.concat_map : ('a -> 'b list) -> 'a list -> 'b list ( #8760 )
2019-10-01 15:53:14 +01:00
Gabriel Scherer
5c7c619d4d
List.find_map : ('a -> 'b option) -> 'a list -> 'b option ( #8832 )
2019-09-13 17:58:01 +02:00
Guillaume Munch-Maccagnoni
a1c05e3157
List.sort: avoid duplicate work by chop
...
David Allsopp: Remove unrelated reformatting
2019-07-25 22:31:39 +02:00
Thomas Refis
742c65d30b
List.filter_map ( #2185 )
2018-12-12 16:29:50 +01:00
Daniel Bünzli
acb0e91ac6
Stdlib doc: harmonize heading levels again. ( #2142 )
2018-11-08 17:33:55 +01:00
yallop
ee1c2a4d7e
Add paths for built-in types ( #1876 )
...
* Add an Extension_constructor submodule to Obj.
Deprecate top-level functions extension_constructor / extension_name /
extension_id.
* Add 'true' and 'false' to the definition of Bool.t
* Add aliases for the built-in 'list' and 'array' types.
* Add an alias for 'exn' to Printexc.
* Changes entry: built-in type aliases
* Add a Unit module.
* Add paths for built-in exceptions.
2018-11-08 16:08:17 +01:00
David Allsopp
061262ba70
Fix over-long lines with minor re-wordings
2018-06-13 09:37:49 +01:00
Gabriel Scherer
fa884f420b
fix bug in GPR#1697 (List.init) caught after merge
2018-04-05 22:35:48 +02:00
Hugo Heuzard
f787536c1e
Tune List.init threshold
2018-04-05 18:07:47 +01:00
Simon Cruanes
df80f34a92
Stdlib functional iterators ( #1002 )
...
* add `Seq` module, expose iterator conversions in most containers
* small typo
* typo
* change order of arguments for `{Map,Set}.add_seq`
* watch for max string length in `Bytes.of_seq`
* wip: make it build again
* Fix dependency
Sys needs to be linked before Bytes in stdlib.
* Update threads/stdlib.ml
* Update stdlib_no_prefixed/.depend
* fix inconsistencies with label modules
* update testsuite to work with seq
* update change file
* small change in `Hashtbl.to_seq`, capturing only the underlying array
* add some documentation to seq.mli
* revert to good ol' module type names for hashtables
* fix test
* change style of comments in seq.mli
* follow some demands in review of GPR #1002
* some fixes for #1002
* add Seq-related functions to Ephemeron
* add some comments on `Hashtbl.of_seq`
* add more tests for `Hashtbl.{to,of}_seq`
* fix bug in `Ephemeron.to_seq`
* Update Changes
2018-03-16 18:25:10 +01:00
Fabrice Le Fessant
908a381827
Fix bug #7513 ( #1136 )
...
Add tests List.compare_lengths and List.compare_length_with in tests/lib-list
2017-05-10 16:20:34 +02:00
Richard Degenne
c49f12361b
Implemented `List.init`
2017-02-28 14:35:33 +01:00
Alain Frisch
69263a9893
Option-returning variants of stdlib functions ( #885 )
...
Provide an xxx_opt alternative for functions raising Not_found
and many instances of Failure/Invalid_arg.
The only exception is the rarely used Buffer.add_substitute, where
the [Not_found] can really be interpreted as an error condition.
Most new functions are implemented directly (instead of wrapping the
raising version). This is for performance reasons and also to avoid
destroying the stacktrace (if the function is used in an exception
handler). One could instead implement the raising versions on top of
the new functions, but there might be a small penalty.
2016-11-07 16:11:35 +00:00
Fabrice Le Fessant
f872d67d4e
Add functions `List.compare_lengths` and `List.compare_length_with` ( #760 )
2016-09-18 23:14:17 +02:00
Damien Doligez
520fb2df50
Merge tag 4.03.0 into trunk.
2016-04-28 16:13:21 +02:00
Alain Frisch
8557a86477
Also enable more warnings in stdlib/ and fix them.
2016-03-15 22:47:26 +01:00
Damien Doligez
5401ce8473
Update headers for the new license.
...
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Gabriel Scherer
2a153ee5c0
List.cons, finally
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16050 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-26 21:05:28 +00:00
Alain Frisch
edb771d22b
#4986 . Add two common operations: List.sort_uniq (more efficient that sorting then removing duplicates) and Set.of_list (more efficient than folding Set.add over the list).
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13876 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-09 11:01:42 +00:00
Damien Doligez
def31744f9
remove all $Id keywords
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Damien Doligez
3b507dd1aa
renaming of Objective Caml to OCaml and cleanup of copyright headers
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Alain Frisch
a5628ad725
Adding List.iteri/mapi.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@10761 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-11-05 08:10:59 +00:00
Damien Doligez
ed4351139c
PR#4055 List.nth when argument is negative
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7597 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2006-09-11 12:18:00 +00:00
Damien Doligez
0e5ca9dca5
nettoyage
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7164 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2005-10-25 18:34:07 +00:00
Damien Doligez
5a678d29f5
depollution suite (PR#1914 et PR#1956)
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6045 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2004-01-01 16:42:43 +00:00
Xavier Leroy
f009490d09
Utiliser compare x y = 0 au lieu de x = y lorsqu'on compare des cles qui peuvent etre le flottant nan
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5962 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2003-11-21 16:04:26 +00:00
Damien Doligez
bba52e7a9d
changement List.sort; ajout fast_sort et List.merge
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4884 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-06-05 12:12:47 +00:00
Xavier Leroy
7501784c80
MAJ en-tetes pour mentionner la 'special exception' sur la LGPL
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4144 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2001-12-07 13:41:02 +00:00
Damien Doligez
88980b7eef
petite amelioration de List.sort
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3234 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2000-07-10 11:29:04 +00:00
Damien Doligez
560a52cfe7
PR#139
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3206 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2000-06-14 18:21:07 +00:00
Damien Doligez
651700f89d
nouveaux tris
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3087 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2000-04-14 10:05:33 +00:00
Damien Doligez
546137e2b0
bug rev_map2 (PR#32)
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2768 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2000-01-25 13:19:16 +00:00
Xavier Leroy
cc0f32b054
Changement de la licence
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2553 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-11-17 18:59:06 +00:00
Damien Doligez
fe764d8d25
Documentation des fonctions non-tail-rec
...
Ajout de rev_map rev_map2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2409 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-09-19 12:55:01 +00:00
Xavier Leroy
5038f3cdb6
Ajout de Pervasives.ignore. List.remove -> List.remove_ass*
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2304 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-02-24 15:21:50 +00:00
Pierre Weis
c35c5b3efd
Ajout des fonctions find, partition, find_all
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2244 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1999-01-04 10:35:49 +00:00
Pierre Weis
ddc61a1adb
Ajout des fonction remove et removeq, déjà écrite dans le système pour
...
le typage.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2147 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-11-05 08:04:09 +00:00
Xavier Leroy
208be2cae2
Ajout de List.rev_append. Nettoyages
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1932 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1998-04-27 09:55:21 +00:00
Xavier Leroy
55bb148630
Retour au code d'origine pour List.iter. Je veux un seul test par
...
iteration, dammit.
Suppression de dependances spurieuses dans Array et String.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1756 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-11-06 17:28:16 +00:00
Damien Doligez
b8ccccff49
Makefiles: fix disparition de weak.cmo
...
Changement de type des fonctions iter
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1747 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-10-31 12:59:29 +00:00
Xavier Leroy
d096a45961
hashtbl.ml: un parametre inutilise lors du redimensionnement.
...
list.ml: List.length tail-rec.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1427 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-03-21 10:46:38 +00:00
Xavier Leroy
867222bf4f
List.concat comme synonyme de List.flatten
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1303 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-02-25 14:41:37 +00:00
Xavier Leroy
f1491839c2
Erreur dans List.nth
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1273 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-02-16 17:18:54 +00:00
Xavier Leroy
9ab76e8c8f
List.nth fait une erreur si n < 0
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1271 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1997-02-16 13:37:16 +00:00
Xavier Leroy
c81f653d9c
Bug dans exists2.
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@914 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-07-01 12:44:01 +00:00
Xavier Leroy
2301d778e7
Renommage en Objective Caml
...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@782 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1996-04-30 14:53:58 +00:00