Skip to content

Commit

Permalink
merge with devel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Apr 15, 2019
2 parents 40c49f7 + 92d047b commit 2be4561
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 74 deletions.
40 changes: 21 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.1
### Bug fixes
* fix `if` it should not return false if false value is undefined

## 0.9.0
### Breaking
* `for-each` and `map` works as in Scheme spec (use multiple arguments and don't use index)
Expand All @@ -9,7 +13,7 @@
* add `undefined` to default Environment so you can use it in Lips code
* add function `nop`
* tokenizer with meta data now include newlines and comments (nothing is removed)
### Bugs
### Bug fixes
* fix offset in tokenizer
* fix assign variables from variables (e.g. function or variable aliases)
* fix return value of Math operation that should return float [#1](https://github.com/jcubic/lips/issues/1)
Expand All @@ -23,33 +27,33 @@
* don't evaluate next expressions in `and` and `or` macros

## 0.8.1
### Bugfix
### Bug fixes
* use exception.code for code that triggered exception

## 0.8.0
### Features
* new nth and reverse functions
* new type checking functions null? regex? pair? string? number? symbol? array? object? boolean?
* add lips source code that throwed exception in JavaScript error message
### Bugfix
### Bug fixes
* fix lambda with rest parameter
### Breaking
* `if` now check if argument is boolean

## 0.7.1
### Bugfix
### Bug fixes
* fix curry function

## 0.7.0
### Features
* `(let iter` macro that's transformation of `(let* ((iter (lambda () ...`
* expandable `(let iter` and `(define (foo)` by macroexpand
### Bugfix
### Bug fixes
* fix macroexpand evaluation of code
* use nil in cons when cdr is empty list

## 0.6.1
### Bugfix
### Bug fixes
* fix reduce infinite loop
* fix invoking lambdas in dynamic scope
* fix print of Array with multi line strings and BigInts
Expand All @@ -60,7 +64,7 @@
* rename set to set!, set-cdr to set-cdr! and set-car to set-car!
* rename defmacro to define-macro like in scheme
* change order of arguments in env.inherit
## Features
### Features
* add bit operation functions
* add float, round and ceil functions
* add env variable to lips namespace which is alias to global_environment
Expand All @@ -70,7 +74,7 @@
* allow to set value using set! and dot expression that is used to get the value
* better invalid mime on script tag detection
* use ES6 symbols as names for lips symbols in gensym function
### Bugs
### Bug fixes
* show error when invoking trampoline in dynamic scope
* fix eq? and >= functions
* fix set! (change existing reference or create new if not existing in scope chain)
Expand All @@ -90,20 +94,20 @@
* fix access variables that have value of undefined

## 0.5.4
### Bugs
### Bug fixes
* use src file for node and dist build file for unpkg

## 0.5.3
### Bugs
### Bug fixes
* fix version number in exported field

## 0.5.2
### Bugs
### Bug fixes
* use dist/lips.min.js as main for unpkg
* npm housekeeping

## 0.5.1
### Bugs
### Bug fixes
* fix lambda with symbol as parameters
* fix for TCO factorial using Y combinator & trampoline

Expand All @@ -116,13 +120,13 @@
* optional dynamic scope
* add `not`, `abs`, `sqrt` and `**` functions
* wrap numbers in LNumber that use BigInt or bn.js if possible
### Bugs
### Bug fixes
* fix lambda with no parameters
* fix define with Promise like `(define x (let ...`
* fix - with single argument

## 0.4.1-2
### Bugs
### Bug fixes
* fix for Node

## 0.4.0
Expand All @@ -133,8 +137,7 @@
* add string functions: join, split, replace, match, search
* new second parameter to `tokenize` that make it return array of extra objects `{token, col, line, offset}`
* Pair.flatten and lips function flatten

### Bugs
### Bug fixes
* fix (reduce + list)
* fix handling of empty list
* make let* handle promises
Expand All @@ -144,7 +147,7 @@
## 0.3.0
### Features
* exec api method
### Bugfixes
### Bug fixes
* fix processing of multiple backquote and unquote

## 0.2.1/0.2.2
Expand All @@ -159,8 +162,7 @@
* better string function
* Pair methods for working with ALists + Pair::reduce
* throw exception on car/cdr with non list

### Bugs
### Bug fixes
* fix parsing empty strings
* fix various errors catch by lint
* fix parsing ALists with list as keys and values
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## LIPS is Pretty Simple

[![npm](https://img.shields.io/badge/npm-0.9.0-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=master&4912f43f5a0a8836940ba8e35fe069c538cae4b4)](https://travis-ci.org/jcubic/jquery.terminal)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=master&4605127ab4ae61bb9393947f167c7edb)](https://coveralls.io/github/jcubic/lips?branch=master)
[![npm](https://img.shields.io/badge/npm-DEV-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
[![travis](https://travis-ci.org/jcubic/jquery.terminal.svg?branch=devel&40c49f76782cb75bb5bc79230bdb951585ecf92a)](https://travis-ci.org/jcubic/jquery.terminal)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&4605127ab4ae61bb9393947f167c7edb)](https://coveralls.io/github/jcubic/lips?branch=devel)


LIPS is very simple Lisp, similar to Scheme written in JavaScript.
Expand Down
44 changes: 16 additions & 28 deletions dist/lips.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**@license
* LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. 0.9.0
* LIPS is Pretty Simple - simple scheme like lisp in JavaScript - v. DEV
*
* Copyright (c) 2018-2019 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* includes unfetch by Jason Miller (@developit) MIT License
*
* build: Sun, 14 Apr 2019 11:34:32 +0000
* build: Mon, 15 Apr 2019 10:19:18 +0000
*/
(function () {
'use strict';
Expand Down Expand Up @@ -2883,29 +2883,17 @@ function _typeof(obj) {
}

if (cond) {
var true_value = evaluate(code.cdr.car, {
return evaluate(code.cdr.car, {
env: env,
dynamic_scope: dynamic_scope,
error: error
});

if (typeof true_value === 'undefined') {
return;
}

return true_value;
} else {
var false_value = evaluate(code.cdr.cdr.car, {
return evaluate(code.cdr.cdr.car, {
env: env,
dynamic_scope: dynamic_scope,
error: error
});

if (typeof false_value === 'undefined') {
return false;
}

return false_value;
}
};

Expand Down Expand Up @@ -3118,7 +3106,7 @@ function _typeof(obj) {
return 'a' + i;
}).join(','); // hack that create function with specific length

var wrapper = new Function("f", "return function(".concat(args, ") {\n window.calls = window.calls || [];\n window.calls.push([...arguments]);\n return f.apply(this, arguments);\n };"));
var wrapper = new Function("f", "return function(".concat(args, ") {\n return f.apply(this, arguments);\n };"));
return wrapper(lambda);
}),
'macroexpand': new Macro('macro-expand', macro_expand()),
Expand Down Expand Up @@ -4680,19 +4668,19 @@ function _typeof(obj) {
var value = macro.invoke(code, eval_args);
value = maybe_promise(value, true);

if (value && value.data) {
return value;
} else if (isPromise(value)) {
return value.then(function (value) {
if (value && value.data) {
return value;
}

function ret(value) {
if (value && value.data || !(value instanceof Pair)) {
return value;
} else {
return evaluate(value, eval_args);
});
}
}

if (isPromise(value)) {
return value.then(ret);
}

return evaluate(value, eval_args);
return ret(value);
} // ----------------------------------------------------------------------


Expand Down Expand Up @@ -4985,7 +4973,7 @@ function _typeof(obj) {
}); // --------------------------------------

return {
version: '0.9.0',
version: 'DEV',
exec: exec,
parse: parse,
tokenize: tokenize,
Expand Down
6 changes: 3 additions & 3 deletions dist/lips.min.js

Large diffs are not rendered by default.

32 changes: 11 additions & 21 deletions src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -1584,25 +1584,17 @@
throw new Error('if: value need to be boolean');
}
if (cond) {
var true_value = evaluate(code.cdr.car, {
return evaluate(code.cdr.car, {
env,
dynamic_scope,
error
});
if (typeof true_value === 'undefined') {
return;
}
return true_value;
} else {
var false_value = evaluate(code.cdr.cdr.car, {
return evaluate(code.cdr.cdr.car, {
env,
dynamic_scope,
error
});
if (typeof false_value === 'undefined') {
return false;
}
return false_value;
}
};
var cond = evaluate(code.car, { env, dynamic_scope, error });
Expand Down Expand Up @@ -1774,8 +1766,6 @@
var args = new Array(length).fill(0).map((_, i) => 'a' + i).join(',');
// hack that create function with specific length
var wrapper = new Function(`f`, `return function(${args}) {
window.calls = window.calls || [];
window.calls.push([...arguments]);
return f.apply(this, arguments);
};`);
return wrapper(lambda);
Expand Down Expand Up @@ -2680,17 +2670,17 @@
}
var value = macro.invoke(code, eval_args);
value = maybe_promise(value, true);
if (value && value.data) {
return value;
} else if (isPromise(value)) {
return value.then((value) => {
if (value && value.data) {
return value;
}
function ret(value) {
if (value && value.data || !(value instanceof Pair)) {
return value;
} else{
return evaluate(value, eval_args);
});
}
}
if (isPromise(value)) {
return value.then(ret);
}
return evaluate(value, eval_args);
return ret(value);
}
// ----------------------------------------------------------------------
function evaluate(code, { env, dynamic_scope, error = () => {} } = {}) {
Expand Down

0 comments on commit 2be4561

Please sign in to comment.