Commit Graph
148 Commits
Author SHA1 Message Date
Thorbjørn Lindeijer b409569b6f Added Sequence.list
This helper method turns any sequence into a List.
2015-03-27 22:59:58 +01:00
Bob Nystrom 7d45dda383 String.fromCodePoint(). Fix #219. 2015-03-27 07:43:36 -07:00
Bob Nystrom 373770a8d5 Fields are private, not protected. Fix #237. 2015-03-27 06:46:12 -07:00
Bob Nystrom 0bd19da392 Bind C methods to Wren using foreign declarations. 2015-03-24 07:58:15 -07:00
Bob Nystrom c9226256ff Merge pull request #220 from bjorn/count_predicate
Added Sequence.count(predicate)
2015-03-23 07:35:17 -07:00
Bob Nystrom 1301410142 Merge branch 'num_methods' of git://github.com/bjorn/wren into bjorn-num_methods 2015-03-21 12:54:08 -07:00
Thorbjørn Lindeijer 07951bbeae Added Num.pi and some tests 2015-03-19 21:12:50 +01:00
Thorbjørn Lindeijer 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
Bob Nystrom 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
Bob Nystrom 3383d06ca3 Merge pull request #213 from RickGlimmer/master
Fix unreachable links for IE11 (edge mode)
2015-03-18 07:52:31 -07:00
Thorbjørn Lindeijer 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
Thorbjørn Lindeijer 1099c75c77 Added Num.atan(x)
Maps to the C function atan2.
2015-03-15 16:43:02 +01:00
Thorbjørn Lindeijer 42dd7cdad4 Added more goniometry Num methods
Num.acos
Num.asin
Num.atan
2015-03-15 16:29:56 +01:00
Thorbjørn Lindeijer 09bcf5ad98 Added Num.tan
Strange omission with Num.sin and Num.cos already available.
2015-03-15 16:29:56 +01:00
Thorbjørn Lindeijer fc1dc4c54b Moved List.contains to Sequence.contains, added tests and docs 2015-03-15 15:59:42 +01:00
Bob Nystrom 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
Bob Nystrom 5459993857 Add Class.supertype.
Thanks, Michel!
2015-03-14 09:48:45 -07:00
Bob Nystrom f7849244a8 Tighten up operator table a bit. 2015-03-13 07:56:47 -07:00
Bob Nystrom 860616244e Tweak precedence table styles a bit. 2015-03-13 07:24:45 -07:00
hachibu 337ef467ed Add operator precedence table to documentation 2015-03-09 11:36:15 -04:00
RickGlimmer 958a85fc31 Fix unreachable links for IE11 (edge mode)
This corrects the flow of content. As main did not have a float style it
overlapped the nav tag making the links unreachable in IE11.
2015-03-08 15:59:59 +00:00
Bob Nystrom 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
Bob Nystrom 90aa43450b Merge branch 'master' of git://github.com/bjorn/wren into bjorn-master 2015-03-03 07:23:47 -08:00
Thorbjørn Lindeijer f10e0121b6 Two small doc fixes
* Fixed inconsistency in Lua vs. Wren example
* Fixed broken sentence
2015-03-01 23:14:32 +01:00
Thorbjørn Lindeijer 8f985847d4 Added Sequence.any as complement to Sequence.all 2015-03-01 23:14:32 +01:00
Bob Nystrom ff9091cf63 Tweak static field docs a bit. 2015-03-01 08:39:53 -08:00
hachibu 7bed58ecf3 doc/site/classes.markdown: add static fields example 2015-02-28 11:26:18 -05:00
Bob Nystrom effa69f64e Tweak docs a bit. 2015-02-27 07:37:58 -08:00
Bob Nystrom 7cb5de388d Merge branch 'doc-site-core-num' of git://github.com/hachibu/wren into hachibu-doc-site-core-num 2015-02-27 07:30:58 -08:00
hachibu ac70088e6b doc: add documentation for ceil, floor, .., and ... in num.markdown 2015-02-27 08:49:42 -05:00
Bob Nystrom 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
Bob Nystrom 4b88292ec1 Merge branch 'num-from-string' of git://github.com/gsmaverick/wren into gsmaverick-num-from-string 2015-02-25 06:53:12 -08:00
Bob Nystrom 516808f6d2 Fix typo in docs. 2015-02-25 06:49:42 -08:00
Gavin Schulz 03a5b96040 Add a fromString static method on Num that converts strings to numbers. 2015-02-22 20:06:17 -08:00
Bob Nystrom a9d9362e29 Fix some typos in fn docs. 2015-02-22 12:34:32 -08:00
Bob Nystrom bd97c244a5 Document removeAt() return value. Fix #176. 2015-02-22 10:26:31 -08:00
Bob Nystrom 037a2bdb66 Massive Makefile clean up!
- "make all" builds all combinations of configurations
- Binaries are built to "bin"
- (For convenience, the release interpreter also goes in the top level dir)
- Libraries are built to "lib"

This will also make it easier to support building and testing other
configurations like Nan tagging versus union, computed goto, etc.
2015-02-22 10:19:23 -08:00
Bob Nystrom 44c547176b Fix quotes in module docs. 2015-02-20 06:54:03 -08:00
Bob Nystrom a4fa3027c0 Fix cyclic import docs. 2015-02-19 06:38:13 -08:00
Bob Nystrom ca14dffab4 First pass at docs for modules. 2015-02-18 07:55:09 -08:00
Bob Nystrom a9bd864c6b More docs for maps. 2015-01-25 21:39:22 -08:00
Bob Nystrom 4579171afa Add remove() to Map. 2015-01-25 17:42:36 -08:00
Bob Nystrom 0e6a90443e Add containsKey() to Map, and validate key types. 2015-01-25 12:39:19 -08:00
Bob Nystrom 3061bdde7f Start documenting maps and work on some other docs a bit. 2015-01-25 11:08:13 -08:00
Bob Nystrom 438e7bae3f Merge branch 'list-join' of git://github.com/gsmaverick/wren into gsmaverick-list-join 2015-01-24 14:39:45 -08:00
Gavin Schulz 4977083904 Abstract List's toString method to a more general join method on Sequence. 2015-01-24 14:01:16 -08:00
Bob Nystrom efd161cea2 Add "arity" getter to Fn. 2015-01-23 20:33:05 -08:00
Bob Nystrom c3a858a2c7 Update doc on VS project. 2015-01-23 10:41:11 -08:00
Bob Nystrom eb424f5c1a Make strings iterable over their code points.
I'm not sure why, but this also regresses perf:

binary_trees - wren            ..........  3290  0.30s   96.68% relative to baseline
delta_blue - wren              ..........  7948  0.13s   99.06% relative to baseline
fib - wren                     ..........  3165  0.32s   95.90% relative to baseline
for - wren                     ..........  8242  0.12s   96.00% relative to baseline
method_call - wren             ..........  5417  0.18s   78.74% relative to baseline

Need to investigate.
2015-01-22 20:58:22 -08:00
Bob Nystrom a5b00cebe7 Clarify how string subscripting handles UTF-8. 2015-01-22 16:38:03 -08:00