Deutsch   English   Français   Italiano  
<20240711030229.170@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.scheme,comp.lang.lisp
Subject: Re: (lambda (x) (list (car x) (length x))) using Cut or Cute?
Date: Thu, 11 Jul 2024 10:13:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <20240711030229.170@kylheku.com>
References: <v45dl4$3s5s5$2@dont-email.me> <v6o8nv$2d5j8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Jul 2024 12:13:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1c1b3c01db2e58828e57902abb355a3e";
	logging-data="2539091"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/rX8nYY+jBmG5Ru0O7G+cXURkYwmdfY3Y="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:WtCERu+061tyKygmWWGVS+QpDGU=
Bytes: 1896

On 2024-07-11, HenHanna <HenHanna@devnull.tb> wrote:
>
>   There's no way to write
>
>            (lambda (x) (list (car x) (length x)))
>
>             using Cut or Cute  ???

That's more of a job for a jig called juxt:

This is the TXR Lisp interactive listener of TXR 294.
Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet.
TXR's car insurance now offers cdr coverage for bumper-to-bumper
protection.
1> [juxt car length]
#<intrinsic fun: 0 param + variadic>
2> [*1 '(1 2 3)]
(1 3)
3> [*1 '(1 2 3 4 5 6)]
(1 6)

juxt takes functions as its arguments and returns a function.
When that function is invoked, it passes its argument to each
of the child functions, and returns a list of the values.


-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca