Input Box
// Primitives from Chapter 1 "Toys" // - `car`: First element of a list // - `cdr`: Rest of a list // - `cons`: Constructs a list // - `isNull`: Checks for empty list // - `isEq`: Compares two values (must be atoms, not lists) // - `isAtom`: Checks if not a list (must be a number or a string or a boolean) function example_rember(a, lat) { return isNull(lat) ? null : isEq(a, car(lat)) ? cdr(lat) : cons(car(lat), example_rember(a, cdr(lat))); } var s = str2sx("(how are you doing so far?)"); sx2str(example_rember("are", s));
Output Box
It comes out here.