Commit Graph
1826 Commits
Author SHA1 Message Date
José Valim ad2cc865f4 Fix boundary in Enum.take/2, closes #3042 2015-02-01 09:16:53 -02:00
José Valim 81c1be315a Merge pull request #3026 from whatyouhide/dict-get-and-update
Dict.get_and_update/3 and Keyword.get_and_update/3
2015-01-29 11:00:45 +01:00
José Valim d15d65ca06 Avoid export vars in destructure 2015-01-28 21:43:16 +01:00
Andrea Leopardi b4654b7846 Add Keyword.get_and_update/3
I added the `get_and_update/3` function to the `Keyword` module. I also added
tests for this function, docs (with doctests) and specs.
2015-01-27 23:11:37 +01:00
Andrea Leopardi 45d81bdc4c Add Dict.get_and_update/3
I added the `Dict.get_and_update/3` function to the `Dict` behaviour (with a
default implementation like most of the functions in the `Dict` module); this
feature was discussed in #2973.

I also added test for the new function, docs with doctests and specs.
2015-01-27 23:11:09 +01:00
José Valim 3d98684f12 Improve error message with invalid structures in maps
Closes #2958
2015-01-27 17:43:22 +01:00
José Valim e62bc9e215 Do not choke when Exception.message/1 does not return a string 2015-01-26 19:17:31 +01:00
José Valim 011d0fda4f Explicitly pass allowed attributes to __info__ 2015-01-26 19:17:31 +01:00
José Valim 8475ab813b Merge pull request #2801 from fishcakez/app_env
Move application state out of application env
Conflicts:
	lib/elixir/lib/uri.ex
	lib/iex/lib/iex/server.ex
2015-01-24 14:07:46 +01:00
José Valim 442dfd5ac6 Don't ignore escape characters in regex 2015-01-22 11:45:56 +01:00
José Valim 7e645cea3f Do not repeat the module name 2015-01-15 15:19:20 +01:00
José Valim 9ffafb7e25 Merge pull request #2762 from fishcakez/undef_errors
Improve UndefinedFunctionError
2015-01-15 15:15:50 +01:00
José Valim 503d406d17 Merge pull request #3003 from xavier/invert-order-of-non-matching-token-messages
Invert the order of non matching token messages (closes #2993)
2015-01-10 14:26:22 +01:00
Xavier Defrang 4b4ef723ff Invert the order of non matching token messages (closes #2993) 2015-01-10 09:40:44 +01:00
Aleksei Magusev c6157e5b5e Improve error message when using attributes inside match in module 2015-01-09 22:12:02 +01:00
José Valim 3c13eecc05 Ensure ExUnit survives inspect and exception message failures 2015-01-07 09:49:15 +01:00
José Valim 7229c198e4 Remove broken and unfixable delegate_locals_to implementation 2015-01-06 23:34:08 +01:00
José Valim bf51b915fa Merge pull request #2988 from alehander42/add-column-info-to-tokenizer
Add column info in tokenizer, #2987
2015-01-06 16:11:57 +01:00
Alexander Ivanov fa5921fa33 Fix column counting in elixir_interpolation.erl 2015-01-06 16:57:00 +02:00
Alexander Ivanov 83e992ee8f Count \\ as just one character in column info in tokenizer 2015-01-06 14:49:23 +02:00
José Valim 9707097885 Support safe: boolean option in inspect 2015-01-06 11:07:03 +01:00
Alexander Ivanov 1a456768d5 Change location info format in tokenizer
Start column counting in tokenizer from 1, store location info in a tuple `{Line, BeginColumn, EndColumn}` instead of a list
2015-01-05 13:35:23 +02:00
Alexander Ivanov d7e00557d0 Add column info in tokenizer, #2987
Add column info for each token in elixir_tokenizer.
Change the format of location info from `Line` to `[Line, BeginColumn,
EndColumn]`. Pass the current column after the current line in
`elixir_tokenizer:tokenize`. Reflect the change in related modules.
2015-01-05 03:34:53 +02:00
José Valim 3cc1c1533d Keep original stacktrace on inspect errors 2015-01-03 20:26:32 +01:00
jw2013 f2e6b393d7 Integer.parse/2 shouldn't parse when base is not an integer 2014-12-29 00:47:47 -05:00
Alexander Ivanov 07770043ea Implement Integer.parse/2 2014-12-27 21:44:53 +02:00
José Valim 2c5f40ffa9 Do more strict matching on URI scheme 2014-12-26 23:17:30 +01:00
Dima Aleksandrov 6f9c88ed2d this resolves #2952 compile error 2014-12-13 23:08:03 +01:00
Aleksei Magusev faebcc5038 Improve test coverage for Enum.reverse_slice/3 2014-12-11 23:40:52 +01:00
Aleksei Magusev c4f460142d Use actual range in the EnumTest.Range 2014-12-11 23:35:58 +01:00
Aleksei Magusev 0f9e5c674d Remove test duplication 2014-12-11 23:30:37 +01:00
Andrea Leopardi 39cc55ff3b Add Enum.unzip/1
Added the `Enum.unzip/1` function like described in #2935.
2014-12-11 12:15:00 +01:00
Eugeniy Meshcheryakov 19357b1ae7 Remove empty/1 callback from Collectable implementations
The Collectable protocol does not contain this callback
anymore.
2014-12-08 22:52:57 +01:00
Kabie d9b7d90450 Add \g{N} for &Regex.replace/4 2014-12-08 22:05:04 +08:00
Kabie 91353a16bd Fix incorrect boundary condition 2014-12-08 21:56:51 +08:00
jw2013 f5e500e076 Enum.sample/1 should raise if the list is empty 2014-12-08 01:09:33 -08:00
jw2013 5b415ae20b Add test cases for non-space delimiters 2014-12-06 12:21:55 -08:00
jw2013 2b1d0e9580 add more test cases for in word symbols 2014-12-06 07:51:07 -08:00
jw2013 496d2e2255 fix corner case for end detection 2014-12-06 07:46:52 -08:00
jw2013 4bf3c40839 Fix IO.ANSI.Docs for multiple stars/underscores/backticks 2014-12-06 05:33:33 -08:00
jw2013 b2dacae377 Fix broken IO.ANSI.Docs parser 2014-12-06 04:55:29 -08:00
José Valim 917fb6e7b7 Merge pull request #2921 from lstor/integer-undigits
Add implementation of Integer.undigits
2014-12-05 21:48:58 +01:00
Lars Storjord ac1c92892a Add Integer.undigits/2 2014-12-05 20:52:24 +01:00
José Valim 4c16e4e82b Merge pull request #2885 from jw2013/list
Introduce Enum.reverse_slice/3
2014-12-05 19:56:13 +01:00
jw2013 58d907539c introduce Enum.reverse/3 2014-12-05 09:32:48 -08:00
José Valim 2da5c0142d Merge pull request #2910 from mroth/integerdigits
Introduce an efficient implementation for Integer.digits/1
2014-12-03 09:17:24 +01:00
José Valim d0cb2eb062 Merge pull request #2913 from jbcrail/fix-misspellings
Fix misspellings in docs, comments, and strings.
2014-12-03 09:08:48 +01:00
Joseph Crail 6fab0747de Fix misspellings in docs, comments, and strings. 2014-12-02 17:38:10 -05:00
Matthew Rothenberg 78707de3f8 Introduce an implementation of Integer.digits/1
Introduces an efficient (purely mathematical) implementation of
Integer.digits/1.

Most developers tend to implement the digits of an integer by converting
to a string representation, splitting the string, and then converting
each char back into an integer.  E.g. with code such as the following:

```elixir
def digits(n) when is_integer(n) and n>0 do
    n
    |> Integer.to_string
    |> String.graphemes
    |> Enum.map(&String.to_integer/1)
end
```
Which results in a lot of inefficient type conversion and memory
allocation.

This implementation is purely mathematical.  In informal benchmarks on
my workstation, it performs at 0.9 μs/op versus 4.8 μs/op in the naïve
implementation above.
2014-12-02 17:37:11 -05:00
José Valim e411c599f6 Merge pull request #2584 from herenowcoder/enum-sample
Enum.sample using reservoir sampling
2014-12-02 23:26:11 +01:00