07f9d4d2be
Tweak Sequence.all() and Sequence.any().
...
When possible, they return the actual value from the predicate
instead of always just "true" and "false". This matches && and ||
which evaluate to the RHS or LHS when appropriate.
2015-03-28 10:18:45 -07:00
53ee453f0f
Merge pull request #239 from bjorn/sequence_list
...
Added Sequence.list
2015-03-28 09:06:49 -07:00
72c38a59ce
More stuff for working with strings and bytes!
...
- "\x" escape sequence to put byte values in strings: "\x34"
- String.byteAt(index) gets value of byte in string.
- String.bytes returns a raw sequence of bytes for a string.
- String.codePointAt(index) gets the code point at an offset as a raw number.
2015-03-27 20:44:07 -07:00
b409569b6f
Added Sequence.list
...
This helper method turns any sequence into a List.
2015-03-27 22:59:58 +01:00
7d45dda383
String.fromCodePoint(). Fix #219 .
2015-03-27 07:43:36 -07:00
322eea1af5
Generate a runtime error if a foreign method was not found.
2015-03-26 07:17:09 -07:00
d99a82e6d8
Merge branch 'meta-library' of git://github.com/gsmaverick/wren into gsmaverick-meta-library
2015-03-25 19:21:58 -07:00
c9226256ff
Merge pull request #220 from bjorn/count_predicate
...
Added Sequence.count(predicate)
2015-03-23 07:35:17 -07:00
89ebffb582
Rearrange a bit.
2015-03-23 06:48:08 -07:00
a937bd1cf9
Adds a Meta library with an eval function for interpreting code inline.
2015-03-22 14:17:02 -07:00
91c69ccbf0
If module name does not specify a file try to load it as a module package instead.
2015-03-21 16:05:02 -07:00
1301410142
Merge branch 'num_methods' of git://github.com/bjorn/wren into bjorn-num_methods
2015-03-21 12:54:08 -07:00
07951bbeae
Added Num.pi and some tests
2015-03-19 21:12:50 +01:00
94804fe1a0
Added Sequence.count(predicate)
...
Returns the number of elements in the sequence that pass the
`predicate`.
It could also have been implemented as:
count(f) { reduce(0) {|a, b| f.call(b) ? a + 1 : a } }
But I considered the simple version more readable.
Also documented Sequence.count.
2015-03-19 21:10:05 +01:00
a3abf31da0
Merge pull request #222 from bjorn/sequence_contains
...
Moved List.contains to Sequence.contains, added tests and docs
2015-03-18 07:54:55 -07:00
be11d09bd8
Store hash code in strings.
...
Makes string equality and string map keys much faster.
Also did some other general string clean-up.
2015-03-18 07:09:03 -07:00
b80ba29b0e
Merge branch 'master' of https://github.com/munificent/wren
2015-03-17 07:01:09 -07:00
b4fa4acce1
Handle empty string map keys.
2015-03-17 07:00:54 -07:00
d7a91117ac
Reverse the argument order of List.insert
...
The previous order, insert(element, index), was counter-intuitive.
I'm not aware of any list API that uses this order. I've checked:
* Ruby Array.insert(index, obj...)
* JavaScript array.splice(start, deleteCount[, item1[, item2[, ...]]])
* C++ / QList::insert(int i, const T & value)
* C++ / std::vector::insert
* Lua table.insert (list, [pos,] value)
* C# List<T>.Insert(int index, T item)
* Java Interface List<E>.add(int index, E element)
* Python list.insert(i, x)
So it seemed to me more like an oversight in Wren.
2015-03-15 22:51:24 +01:00
fc1dc4c54b
Moved List.contains to Sequence.contains, added tests and docs
2015-03-15 15:59:42 +01:00
64eccdd9be
Reorganize tests and benchmark scripts.
...
Mainly to get rid of one top level directory. But this will
also be useful when there are tests of the embedding API.
2015-03-14 12:45:56 -07:00
5459993857
Add Class.supertype.
...
Thanks, Michel!
2015-03-14 09:48:45 -07:00
69567c5eb5
Control string representation of infinity.
2015-03-13 07:35:10 -07:00
b36b71d3c6
Merge pull request #212 from soveran/io-read-eof
...
Change IO.read to return null on EOF
2015-03-07 13:47:07 -08:00
05ba7d9fbf
Add fiber features needed for to write an external scheduler:
...
- Allow yielding the main fiber. This exits the interpreter. The
host can resume it by calling a method.
- Allow getting a reference to the current fiber.
2015-03-07 12:32:11 -08:00
542a783cb4
Change IO.read to return null on EOF
2015-03-07 09:10:18 +00:00
632a01d584
Merge branch 'num_methods' of git://github.com/MarcoLizza/wren into MarcoLizza-num_methods
2015-03-06 22:43:02 -08:00
d35e3c917c
Add count to Sequence.
2015-03-06 07:01:02 -08:00
d56e2d6398
Removing old tests.
2015-03-05 11:27:56 +01:00
130d0df957
Fixing the test a bit.
2015-03-05 11:24:54 +01:00
fde6f74d15
Adding tests.
2015-03-04 16:12:08 +01:00
90aa43450b
Merge branch 'master' of git://github.com/bjorn/wren into bjorn-master
2015-03-03 07:23:47 -08:00
28005ed47a
Refactor number parsing a bit.
2015-03-03 07:17:56 -08:00
0ec31433c8
Generate an error if a number literal is too large to be represented with the Num class.
2015-03-03 00:07:55 -08:00
8f985847d4
Added Sequence.any as complement to Sequence.all
2015-03-01 23:14:32 +01:00
c27a094882
Reorganize superclass validation a bit.
2015-02-27 08:08:27 -08:00
46713a5bb3
Merge branch 'issue-70' of git://github.com/verpeteren/wren into verpeteren-issue-70
2015-02-27 07:41:25 -08:00
96ceaa528b
Allow empty argument list methods.
...
- Compile them as calls and definitions.
- Use them for call(), clear(), run(), try(), and yield().
- Update the docs.
2015-02-26 23:08:36 -08:00
1aaa8cff52
Use more comprehensive signature strings for methods.
2015-02-26 21:56:15 -08:00
f05d6143f5
Generating a runtime error on subclassing of builtins
...
As discussed in https://github.com/munificent/wren/issues/70 , it is not allowed to subclass built-in types.
2015-02-25 20:13:37 +01:00
6a10d9740c
Merge pull request #187 from MarcoLizza/bitwise_precedence
...
Bitwise precedence
2015-02-25 07:14:31 -08:00
fc2ed6f6e1
Don't allow trailing non-number characters when parsing a string to a number.
2015-02-25 07:07:54 -08:00
cec1f9160a
Moving bitwise precedence-test to the correct folder.
2015-02-25 16:00:53 +01:00
f4a39bc943
Code review changes.
2015-02-25 01:20:53 -08:00
dfa1b51663
Add bitwise operators precedence test.
2015-02-23 17:29:31 +01:00
03a5b96040
Add a fromString static method on Num that converts strings to numbers.
2015-02-22 20:06:17 -08:00
0f9e15833f
Unify argument parsing. Fix #24 .
2015-02-22 10:42:49 -08:00
ae88ee539d
Merge branch 'master' of https://github.com/munificent/wren
2015-02-18 07:55:38 -08:00
b2ca4c0381
Allow zero or multiple imported names.
2015-02-17 07:32:33 -08:00
00cdef303c
Adding new bitwise operands tests.
2015-02-16 11:30:15 +01:00