List Car Finder

Returns the first item of a separator-delimited list, equivalent to the Lisp car function. Errors clearly on an empty list, since car has no defined result for one. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

Lisp's car and cdr functions, for "first item" and "everything but the first item," are over 60 years old but the operations themselves are timeless list-processing building blocks.

This tool gives you car in a plain-text, separator-aware form: paste a list, get back just its first item.

What Is List Car Finder?

A single-purpose extractor that returns only the first item of a separator-delimited list.

Named after the Lisp car function, which historically stood for "Contents of the Address part of Register" on the IBM 704, the machine the first Lisp implementation ran on.

How List Car Finder Works

The input is split into items using the resolved separator (newline, comma, or a custom delimiter), and the first entry in that array is returned as-is.

If the input is empty (or only whitespace), the tool returns a clear error instead of an ambiguous empty string, since car has no defined result for an empty list.

When To Use List Car Finder

Use it whenever you only need the first entry of a pasted list, the top of a ranking, the first line of a log, or the first item in a CSV column.

It's also handy for quickly checking what the first item of a list is after some other transformation, without scanning the whole output.

Often used alongside List Cdr Finder, Sublist Extractor and List Slicer.

Features

Advantages

  • Extremely simple, single-purpose output with no ambiguity about what you'll get back.
  • Errors explicitly on an empty list rather than silently returning an empty string.
  • Works with any configured separator, not just newline-delimited lists.

Limitations

  • Only ever returns one item; use Sublist Extractor if you need the first N items instead of just the first one.
  • Does not trim whitespace from the returned item, so leading/trailing spaces in your source list carry through.

Examples

First item of a newline list

Input

apple
banana
cherry

Output

apple

The first line is returned; the rest of the list is ignored.

First item of a comma list

Input

10, 20, 30

Output

10

Splitting on comma gives ["10", " 20", " 30"]; the first element, "10", is returned.

Best Practices & Notes

Best Practices

  • Pair with List Cdr Finder if you need both the first item and the remainder of the list separately.
  • Double-check your separator setting first, an incorrect separator changes what counts as the "first" item.

Developer Notes

Implemented as items[0] after splitting via the shared splitListItems() helper; no trimming or normalization is applied, so the raw first token is returned exactly as split.

List Car Finder Use Cases

  • Grabbing the top-ranked entry from a leaderboard or sorted list
  • Pulling the first log line or first CSV row for a quick check
  • Teaching or demonstrating Lisp's classic car/cdr list decomposition

Common Mistakes

  • Running this on an empty input and expecting an empty string back instead of an error.
  • Forgetting that a comma separator doesn't trim spaces, so "10, 20" gives "10" but " 20" would keep its leading space if it were first.
  • Confusing car (first item) with cdr (everything but the first item).

Tips

  • Use List Cdr Finder right after this one if you need to process the rest of the list separately.
  • If you actually need the first several items, use Sublist Extractor instead.

References

Frequently Asked Questions