基本的なデータ構造と構文
リスト、ベクター、マップ、セットなど、Clojureの基本的なデータ構造と基本構文を学びます。
「基本的なデータ構造と構文」はCoddyKit上の無料Clojure Functional Programming & JVM Backend Developmentレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはClojure Functional Programming & JVM Backend Development学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Clojure Functional Programming & JVM Backend Developmentコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Clojure's Building Blocks
Now the core: Clojure's fundamental data structures and the simple syntax that makes it so expressive.
S-Expressions: The Core Syntax
Clojure is built from S-expressions: parenthesized lists where the first element is a function and the rest are its arguments. Everything is an expression.
Basic Literals: Numbers & Strings
The basic literals are numbers, double-quoted strings, and the booleans true/false — each evaluates to itself.
(ns coddykit.core
(:gen-class))
(defn -main
"Basic literals in action."
[& args]
(println 123)
(println "Hello, CoddyKit!")
(println true))Lists: Ordered & Flexible
A list in parentheses is treated as a function call by default. To make it data, quote it with an apostrophe like '(1 2 3).
Vectors: Indexed & Efficient
Vectors use square brackets and are zero-indexed. Prefer them over lists when you want fast positional access.
(ns coddykit.core
(:gen-class))
(defn -main
"Lists and Vectors demo."
[& args]
(let [my-list '(apple banana cherry)
my-vec [10 20 30]]
(println "First list item:" (first my-list))
(println "Second vector item:" (nth my-vec 1))))Maps: Key-Value Pairs
Maps store key-value pairs in curly braces, usually with keyword keys like :name — perfect for structured data.
Sets: Unique & Unordered
A set in #{} holds unique, unordered items and silently drops duplicates. Ideal for fast membership checks.
Keywords: Self-Evaluating Identifiers
Keywords start with a colon, like :email. They are self-evaluating constants, used everywhere as efficient map keys.
(ns coddykit.core
(:gen-class))
(defn -main
"Maps, Sets, and Keywords demo."
[& args]
(let [person {:name "Alice" :age 30 :city "London"}
skills #{"Clojure" "Java" "SQL"}]
(println "Person's name:" (:name person))
(println "Has Clojure skill?" (contains? skills "Clojure"))))Symbols: Referring to Things
A symbol is a name that refers to a variable or function. Clojure resolves it on evaluation; quote it ('sym) to treat it as data.
Quick Check: Clojure Structures
Which of the following Clojure data structures is best suited for storing a collection of unique items where order doesn't matter?
Recap: Core Data & Syntax
Recap: S-expressions drive the syntax, with lists, vectors, maps, sets, keywords, and symbols as your core building blocks.
よくある質問
「基本的なデータ構造と構文」レッスンは無料ですか?
はい。「基本的なデータ構造と構文」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Clojure Functional Programming & JVM Backend Developmentコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Clojure Functional Programming & JVM Backend Developmentコースには全4レッスンが含まれています。
「基本的なデータ構造と構文」で何を学びますか?
リスト、ベクター、マップ、セットなど、Clojureの基本的なデータ構造と基本構文を学びます。 ブラウザで直接実行するハンズオンコードでClojure Functional Programming & JVM Backend Developmentを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Clojure Functional Programming & JVM Backend Developmentを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのClojure Functional Programming & JVM Backend Developmentは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「基本的なデータ構造と構文」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このClojure Functional Programming & JVM Backend Developmentレッスンでコードを書いて実行できますか?
はい。すべてのClojure Functional Programming & JVM Backend Developmentレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ClojureとJVM入門
- 基本的なデータ構造と構文
- REPL駆動開発のワークフロー
- デストラクチャリングとキーワードの操作