remq(3scm)
π remq, remv, remove, remp β the "get that out of my list" girlies π
okay bestie, so this is a 3scm manpage from the Scheme Programmer's Manual, and it's literally all about four little procedures that ghost elements out of your list π«Ά
πΈ LIBRARY πΈ
(import (rnrs)) ;R6RS
(import (rnrs lists)) ;R6RS
like, pick your import, both are giving R6RS π
β¨ SYNOPSIS β¨
(remq obj list)
(remv obj list)
(remove obj list)
(remp proc list)
four icons, one job π
π¦ DESCRIPTION π¦
okay so here's the vibe: each of these procedures returns a list of the elements of list that do not satisfy a given condition. it's giving "blocked, deleted, unfollowed" β¨
remp applies proc to each element of list and returns a list of the elements of list for which proc returned #f. the other procedures return a list of the elements that are not obj.
comparison tea β:
remquseseq?(3scm)to compare obj with the elements of listremvuseseqv?(3scm)removeusesequal?(3scm)
the elements of the result list are in the same order as they appear in the input list β no chaotic reshuffling, we're not animals π If multiple returns occur, the return values returned by earlier returns are not mutated.
Proc should accept one argument and return a single value. Proc should not mutate list. Proc is always called in the same dynamic environment as this procedure itself. no cap, that matters π
π IMPLEMENTATION NOTES π
the implementation must check the restrictions on proc to the extent performed by applying it as described above. An implementation may check whether proc is an appropriate argument before applying it. so like, it's allowed to vibe-check your proc early π
β RETURN VALUES β
these procedures return a single value; a list. that's it, that's the whole reveal π¦
π₯ EXAMPLES π₯
(remp even? '(3 1 4 1 5 9 2 6 5))
=> (3 1 1 5 9 5)
bye bye evens π
(remove 1 '(3 1 4 1 5 9 2 6 5))
=> (3 4 5 9 2 6 5)
(remv 1 '(3 1 4 1 5 9 2 6 5))
=> (3 4 5 9 2 6 5)
(remq 'foo '(bar foo baz))
=> (bar baz)
that last one just ate and left no crumbs π
π COMPATIBILITY π
these procedures are unique to R6RS. like, exclusive. iykyk π
π ERRORS π
these procedures can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed or an argument was outside its domain. so like, if you fumble the args, it WILL tell you π«Ά
π SEE ALSO π
filter(3scm) β the main character this whole page is quietly competing with ngl
π STANDARDS π
R6RS. periodt.
π§ HISTORY π§
these procedures first appeared in R6RS. they've been iconic since day one β¨
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.
and yeah, this whole glow-up is from the Scheme Programmer's Manual, dated 2022-05-07 β remq(3scm) forever, bestie ππ
bye love u, go remove some elements π¦β¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2022 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms