Discussion:
(lambda (x) (list (car x) (length x))) using Cut or Cute?
(too old to reply)
HenHanna
2024-06-09 23:25:24 UTC
Permalink
There's no way to write (lambda (x) (list (car x) (length x)))
using Cut or Cute???
HenHanna
2024-07-11 09:30:37 UTC
Permalink
There's no way to write

  (lambda (x) (list (car x) (length x)))

       using Cut or Cute ???
Kaz Kylheku
2024-07-11 10:13:50 UTC
Permalink
Post by HenHanna
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: @***@mstdn.ca
Loading...