split-at method in Clojure splits a sequence into two sequences and returns them. It can be used to split large sequences into smaller sequences. An argument is passed to
split-at, which specifies where the input sequence will be split. A Clojure sequence is a data storage structure that holds a collection of data objects. It can be seen as a logical list. The
seq method is used to build a sequence.
(split-at number seqq)
split-at method accepts two input arguments.
seqq: This represents the sequence that is being split.
number: The index of the sequence at which the split will occur.
The method will return all elements to the left of the element at
number in the first sequence and all elements to the right of the element at
number (including the element at
number) in the second sequence.
Let’s look at an example.
(ns clojure.examples.example (:gen-class)) (defn func  (def seq1 (seq [1 2 8 9 1 0 6 8 2])) (println (split-at 1 seq1))) (func)
split-atmethod to split the sequence
1. We can observe that the first output sequence contains one element, and the second contains the rest.
View all Courses