I'm learning Racket (but probably answer will be similar in any Scheme and scheme-derived language) and wonder how to filter out false (#f) values from a given list. The best I came up with is:
(filter (lambda (x)
(not (eq? x #false)))
'("a" "b" #f 1 #f "c" 3 #f))
'("a" "b" 1 "c" 3) ;; output
However, I guess there has to be a simpler solution.
values
instead ofidentity
(for example when someone is using#lang racket/base
and doesn't want to(require racket/function)
just to getidentity
). – Hartwig