Skip to content

Commit 2822471

Browse files
authored
Merge pull request #148 from jdbillings/add-version-info-to-arguments-example
arguments.md: to_number() bin+hex examples works starting from version 2.5
2 parents 5d8cd29 + 156dabd commit 2822471

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pages/docs/arguments.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,27 @@ llo
7878
ld!
7979
```
8080

81-
Functor **to_number(*string*)** transforms a string representing a number to its associated number, it also recognises hex and binary numbers with a prefix.
81+
Functor **to_number(*string*)** transforms a string representing a number to its associated number.
8282
```prolog
8383
.decl tonumber(n:number)
8484
.output tonumber
8585
tonumber(n) :- n=to_number("123").
8686
tonumber(n) :- n=to_number("1534").
87-
tonumber(n) :- n=to_number("0xff").
88-
tonumber(n) :- n=to_number("0b111").
8987
```
9088
The output would be:
9189
```
9290
123
9391
1534
92+
```
93+
In souffle `>=2.5`, functor **to_number(*string*)** also recognises hex and binary strings with a prefix.
94+
```prolog
95+
.decl tonumber(n:number)
96+
.output tonumber
97+
tonumber(n) :- n=to_number("0xff").
98+
tonumber(n) :- n=to_number("0b111").
99+
```
100+
The output would be:
101+
```
94102
255
95103
7
96104
```

0 commit comments

Comments
 (0)