You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2012-04-17-what-s-new-in-elixir-1.markdown
+8-8
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Last week Elixir has seen a lot of new features, improvements, and bug fixes. In
10
10
11
11
* Access protocol has been added for tuples, lists, strings, and whatnot. It allows us to easily access elements of a collection. We can also use a regex to find the first match in a string or a list. Examples follow:
* The `Orddict` module is no longer with us, it has been renamed to `Keyword`. The new module only allows atoms to be used as keys. A general purpose module for dicts will be added sooner or later.
45
45
@@ -49,7 +49,7 @@ red === 255 #=> true
49
49
50
50
* Support for nested modules has been added.
51
51
52
-
```elixir
52
+
{% highlight elixir %}
53
53
defmodule Father do
54
54
defmodule Child do
55
55
def child_fun(str) do
@@ -61,16 +61,16 @@ defmodule Father do
61
61
end
62
62
end
63
63
Father.Child.child_fun "hello!"
64
-
```
64
+
{% endhighlight %}
65
65
66
66
* The `Regex` module has received new functions, namely, `source` and `opts`. It can also be `inspect`ed now.
67
67
68
-
```elixir
68
+
{% highlight elixir %}
69
69
reg = %r/[a-z]+o[a-z]+/im
70
70
Regex.source reg #=> "[a-z]+o[a-z]+"
71
71
Regex.opts reg #=> "im"
72
72
inspect reg #=> "%r\"[a-z]+o[a-z]+\"im"
73
-
```
73
+
{% endhighlight %}
74
74
75
75
* A new `read_info` function has been added to the [`File` module](https://github.com/elixir-lang/elixir/blob/35b22c598defd8be07d46d2e7e8fc0ddf9ec4e80/lib/file.ex) allowing
Copy file name to clipboardExpand all lines: _posts/2012-04-17-what-s-new-in-elixir-2.markdown
+6-6
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,15 @@ Let's get started with our usual overview. I'm using the latest master (`2851da4
11
11
12
12
* Literal support for hexadecimal, octal and binary numbers has been added.
13
13
14
-
```elixir
14
+
{% highlight elixir %}
15
15
0xFF #=> 255
16
16
0o10 #=> 8
17
17
0b1010 #=> 10
18
-
```
18
+
{% endhighlight %}
19
19
20
20
* New functions in the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex): `sort`, `zip`, `unzip`.
21
21
22
-
```elixir
22
+
{% highlight elixir %}
23
23
# Charlists are sorted in lexicographic order
24
24
List.sort ['10', '2', '4', '1', '21']
25
25
#=> ['1', '10', '2', '21', '4']
@@ -34,11 +34,11 @@ end
34
34
35
35
List.zip [[1, 2], [:a, :b], ["one", "two"]]
36
36
#=> [{1,:a,"one"},{2,:b,"two"}]
37
-
```
37
+
{% endhighlight %}
38
38
39
39
* The [System module](https://github.com/elixir-lang/elixir/blob/master/lib/system.ex) has been merged into master. It provides functions for communicating with OS environment, running external commands, getting the stacktrace, etc.
40
40
41
-
```elixir
41
+
{% highlight elixir %}
42
42
System.pwd
43
43
#=> "/Users/alco/Documents/git/elixir"
44
44
@@ -50,7 +50,7 @@ System.cmd 'date'
50
50
51
51
System.stacktrace
52
52
#=> (usually long output)
53
-
```
53
+
{% endhighlight %}
54
54
55
55
* In other news, we're getting closer to having a dedicated site for documentation, JSON parsing/serialization is currently in the works, and there's also work being done on bringing dicts back into Elixir.
0 commit comments