fix: allow passing builtins to functions.
This commit is contained in:
parent
c9d7f1ee60
commit
4d2d22e486
2 changed files with 4 additions and 0 deletions
|
@ -503,6 +503,9 @@ namespace Jellyfin.Plugin.SmartPlaylist.Lisp {
|
|||
switch (expression) {
|
||||
case Symbol s:
|
||||
if (_environment.Find(s.Name()) is not IEnvironment<string, Expression> env) {
|
||||
if (builtins.ContainsKey(s.Name()) || builtinsLater.ContainsKey(s.Name())) {
|
||||
return s;
|
||||
}
|
||||
throw new ApplicationException($"Could not find '{s.Name()}'");
|
||||
}
|
||||
var r_ = env.Get(s.Name());
|
||||
|
|
|
@ -258,6 +258,7 @@ namespace Tests
|
|||
//Assert.Equal("", e.eval("(rand)").ToString());
|
||||
//Assert.Equal("", e.eval("(shuf (list 0 1 2 3 4 5 6))").ToString());
|
||||
Assert.Equal("(1 2 3 4 5 6 7)", e.eval("(qsort (lambda (a b) (> a b)) '(5 4 7 3 2 6 1))").ToString());
|
||||
Assert.Equal("(1 2 3 4 5 6 7)", e.eval("(qsort > (list 5 4 7 3 2 6 1))").ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue