Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
loop.c File Reference
#include "consspaceobject.h"
#include "lispops.h"
#include "loop.h"
Include dependency graph for loop.c:

Go to the source code of this file.

Functions

struct cons_pointer lisp_loop (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 Special form, not dissimilar to let.
 

Function Documentation

◆ lisp_loop()

struct cons_pointer lisp_loop ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Special form, not dissimilar to let.

Essentially,

  1. the first arg (args) is an assoc list;
  2. the second arg (body) is an expression.

Each of the vals in the assoc list is evaluated, and bound to its respective key in a new environment. The body is then evaled in that environment. If the result is an object of type LOOP, it should carry a list of values of the same arity as args. Each of the keys in args is then rebound in a new environment to the respective value from the LOOP object, and body is then re-evaled in that environment.

If the result is not a LOOP object, it is simply returned.

Definition at line 45 of file loop.c.

References c_keys().