added progn form
This commit is contained in:
parent
8278430882
commit
44beab651c
3 changed files with 21 additions and 2 deletions
|
|
@ -22,6 +22,17 @@ import (
|
|||
"gitlab.com/whom/shs/log"
|
||||
)
|
||||
|
||||
/* eval N forms. return the last one
|
||||
*/
|
||||
func shs_progn(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
|
||||
var res *ast.Token
|
||||
for iter := in; iter != nil; iter = iter.Next {
|
||||
res = iter.Eval(ft, vt, false)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
/* return one evaluated form or another based on the boolean statement
|
||||
*/
|
||||
func shs_if(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,13 @@ func GenFuncTable() ast.FuncTable {
|
|||
Args: -1,
|
||||
},
|
||||
|
||||
"progn": &ast.Function{
|
||||
Function: shs_progn,
|
||||
Name: "shs_progn",
|
||||
TimesCalled: 0,
|
||||
Args: -1,
|
||||
},
|
||||
|
||||
"eval": &ast.Function{
|
||||
Function: eval,
|
||||
Name: "eval",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue