[{"content":"Dialectic is an adversarial reasoning application built to improve decision quality on complex questions by forcing two AI agents to debate opposing sides instead of generating a single one-shot answer.\nGitHub: github.com/singhaditya8499/Dialectic\nWhat We Built We built a complete end-to-end debate platform with:\nTwo-agent structured debate loop (for vs against, or A vs B) Provider-agnostic model layer supporting OpenAI, Anthropic, and Ollama Live streamed debate transcript over SSE for real-time UX Evidence-anchored turn schema (facts, figure/date, source, reliability) Structured summary pipeline that preserves major claims and evidence ledger Local debate archive with reload support from the UI Browser-compatible mode for GitHub Pages deployments Product and Technical Design Core architecture src/server.js: HTTP API, SSE stream endpoint, static asset serving, persistence APIs src/debateEngine.js: debate orchestration, turn normalization/validation, summary generation src/providers.js: common completion abstraction across providers public/*: setup form, transcript renderer, summary view, saved debate browser Debate lifecycle User submits question, side models, and round budget. Engine alternates turns between both sides. Each turn is validated for stance, rebuttal quality, novelty, and evidence quality. Streaming events update UI in real time (thinking, turn, summary, complete). Final structured summary and debate artifact can be saved locally. Quality and Alignment Guardrails Dialectic focuses on controlled generation rather than raw free-form output:\nSchema-constrained JSON outputs for machine-checkable turn structure Role conditioning and stance locking to avoid side drift Novelty gating to reduce repetitive arguments and stale citations Evidence requirements to push concrete claims and stronger attribution Early-stop and rewrite-budget controls for robust debate termination These controls created significantly better transcript quality than unconstrained free-form prompting in early iterations.\nWhat We Learned 1) Structured output is non-negotiable for reliability Requiring JSON schemas for turns and summaries made downstream rendering, filtering, and analytics dramatically more stable than parsing plain text.\n2) Multi-agent systems need strong coordination policies Without stance locks, novelty checks, and counter-target requirements, debates quickly collapse into repetitive generic prose. Explicit control policies are essential.\n3) “Evidence-like” output still needs verification strategy Even with evidence slots and reliability fields, model-provided references are not guaranteed truth. We learned to treat this as evidence-structured reasoning, not factual proof.\n4) UX quality depends on streaming feedback SSE-based incremental updates and per-side thinking states make the product feel interactive and understandable, especially for longer debates.\n5) Portability matters early Supporting both server-backed mode and browser-hosted mode (GitHub Pages path) forced cleaner boundaries between orchestration logic and rendering, which improved maintainability.\nEngineering Tradeoffs Chosen: lexical/heuristic novelty checks for speed and simplicity Deferred: retrieval-backed citation verification and judge-model scoring Chosen: local JSON storage for fast iteration Deferred: database-backed multi-user collaboration and auth Outcomes Built a reusable debate engine that supports multiple providers and model combinations. Produced richer, more inspectable outputs than one-model single-response flows. Established a strong foundation for future retrieval-verified, judge-scored debate workflows. ","permalink":"https://singhaditya8499.github.io/projects/dialectic/","summary":"\u003cp\u003eDialectic is an adversarial reasoning application built to improve decision quality on complex questions by forcing two AI agents to debate opposing sides instead of generating a single one-shot answer.\u003c/p\u003e\n\u003cp\u003eGitHub: \u003ca href=\"https://github.com/singhaditya8499/Dialectic\"\u003egithub.com/singhaditya8499/Dialectic\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"what-we-built\"\u003eWhat We Built\u003c/h2\u003e\n\u003cp\u003eWe built a complete end-to-end debate platform with:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eTwo-agent structured debate loop (\u003ccode\u003efor\u003c/code\u003e vs \u003ccode\u003eagainst\u003c/code\u003e, or \u003ccode\u003eA vs B\u003c/code\u003e)\u003c/li\u003e\n\u003cli\u003eProvider-agnostic model layer supporting OpenAI, Anthropic, and Ollama\u003c/li\u003e\n\u003cli\u003eLive streamed debate transcript over SSE for real-time UX\u003c/li\u003e\n\u003cli\u003eEvidence-anchored turn schema (facts, figure/date, source, reliability)\u003c/li\u003e\n\u003cli\u003eStructured summary pipeline that preserves major claims and evidence ledger\u003c/li\u003e\n\u003cli\u003eLocal debate archive with reload support from the UI\u003c/li\u003e\n\u003cli\u003eBrowser-compatible mode for GitHub Pages deployments\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"product-and-technical-design\"\u003eProduct and Technical Design\u003c/h2\u003e\n\u003ch3 id=\"core-architecture\"\u003eCore architecture\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003esrc/server.js\u003c/code\u003e: HTTP API, SSE stream endpoint, static asset serving, persistence APIs\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003esrc/debateEngine.js\u003c/code\u003e: debate orchestration, turn normalization/validation, summary generation\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003esrc/providers.js\u003c/code\u003e: common completion abstraction across providers\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003epublic/*\u003c/code\u003e: setup form, transcript renderer, summary view, saved debate browser\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"debate-lifecycle\"\u003eDebate lifecycle\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eUser submits question, side models, and round budget.\u003c/li\u003e\n\u003cli\u003eEngine alternates turns between both sides.\u003c/li\u003e\n\u003cli\u003eEach turn is validated for stance, rebuttal quality, novelty, and evidence quality.\u003c/li\u003e\n\u003cli\u003eStreaming events update UI in real time (\u003ccode\u003ethinking\u003c/code\u003e, \u003ccode\u003eturn\u003c/code\u003e, \u003ccode\u003esummary\u003c/code\u003e, \u003ccode\u003ecomplete\u003c/code\u003e).\u003c/li\u003e\n\u003cli\u003eFinal structured summary and debate artifact can be saved locally.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"quality-and-alignment-guardrails\"\u003eQuality and Alignment Guardrails\u003c/h2\u003e\n\u003cp\u003eDialectic focuses on controlled generation rather than raw free-form output:\u003c/p\u003e","title":"Dialectic: Two-LLM Debate Studio"},{"content":"This book chapter proposes an AnoGAN-inspired approach tailored for tabular datasets, targeting improved anomaly detection performance beyond common baselines.\nPublication link: Read on Springer\n","permalink":"https://singhaditya8499.github.io/projects/anogan-for-tabular-data/","summary":"\u003cp\u003eThis book chapter proposes an AnoGAN-inspired approach tailored for tabular datasets, targeting improved anomaly detection performance beyond common baselines.\u003c/p\u003e\n\u003cp\u003ePublication link: \u003ca href=\"https://link.springer.com/chapter/10.1007/978-3-031-78561-0_32\"\u003eRead on Springer\u003c/a\u003e\u003c/p\u003e","title":"AnoGAN for Tabular Data: A Novel Approach to Anomaly Detection"},{"content":"This article explores BK Trees and how they enable efficient approximate string matching using edit distance.\nPublication link: Read on Medium\n","permalink":"https://singhaditya8499.github.io/projects/bk-trees-unexplored-data-structure/","summary":"\u003cp\u003eThis article explores BK Trees and how they enable efficient approximate string matching using edit distance.\u003c/p\u003e\n\u003cp\u003ePublication link: \u003ca href=\"https://medium.com/future-vision/bk-trees-unexplored-data-structure-ec234f39052d\"\u003eRead on Medium\u003c/a\u003e\u003c/p\u003e","title":"BK Trees: Unexplored Data Structure"},{"content":"CardWise AI is a personal-finance assistant focused on helping users evaluate credit-card options, align card selection with financial goals, and understand spending behavior through AI-generated summaries.\nFocus Areas Personalized card recommendations based on user goals and constraints. Goal-aware planning support for safer and more structured decision-making. Natural-language insights to explain spending patterns in simple terms. ","permalink":"https://singhaditya8499.github.io/projects/cardwise-ai/","summary":"\u003cp\u003eCardWise AI is a personal-finance assistant focused on helping users evaluate credit-card options, align card selection with financial goals, and understand spending behavior through AI-generated summaries.\u003c/p\u003e\n\u003ch2 id=\"focus-areas\"\u003eFocus Areas\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003ePersonalized card recommendations based on user goals and constraints.\u003c/li\u003e\n\u003cli\u003eGoal-aware planning support for safer and more structured decision-making.\u003c/li\u003e\n\u003cli\u003eNatural-language insights to explain spending patterns in simple terms.\u003c/li\u003e\n\u003c/ul\u003e","title":"CardWise AI"},{"content":"Customer Reise is a support-focused web application built to reconstruct and replay customer journeys from logs so teams can diagnose user-reported issues faster and with more confidence.\nHighlights Aggregates cross-service logs into a coherent user journey timeline. Enables issue replay workflows for support and engineering teams. Improves root-cause analysis speed for production incidents. ","permalink":"https://singhaditya8499.github.io/projects/customer-reise/","summary":"\u003cp\u003eCustomer Reise is a support-focused web application built to reconstruct and replay customer journeys from logs so teams can diagnose user-reported issues faster and with more confidence.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eAggregates cross-service logs into a coherent user journey timeline.\u003c/li\u003e\n\u003cli\u003eEnables issue replay workflows for support and engineering teams.\u003c/li\u003e\n\u003cli\u003eImproves root-cause analysis speed for production incidents.\u003c/li\u003e\n\u003c/ul\u003e","title":"Customer Reise"},{"content":"Overview DocCompass is a local-first document discovery system built to find personal files by meaning, not only by filename. It is designed for natural requests like:\n\u0026ldquo;my marksheets\u0026rdquo; \u0026ldquo;visa related documents\u0026rdquo; \u0026ldquo;intro to psychology notes\u0026rdquo; The project searches local directories, extracts text from multiple file formats, builds a reusable index, creates a structured query plan, and ranks results by relevance with transparent scoring.\nRepository: github.com/singhaditya8499/DocCompass\nProblem Statement Traditional local file search is often fragile because it depends heavily on exact filenames and folder memory. In real usage, users usually remember intent and partial context, not exact paths. DocCompass addresses this by combining:\ncontent extraction across heterogeneous file types semantic query planning with local LLM support weighted ranking tuned for natural document retrieval robust fallback behavior when LLM infrastructure is unavailable Core Capabilities Semantic-style document retrieval from local machine folders. Automatic lazy indexing on first query (no mandatory startup indexing step). Multi-format extraction support: PDF (pypdf, pdftotext, printable fallback) DOCX (XML extraction from word/document.xml) DOC (antiword fallback path) TXT/MD/JSON/YAML/XML and many text/code formats Structured query planning using local Ollama model (qwen3-vl:4b). Fallback local query planning for resilience during model outages/timeouts. Intent-aware ranking (natural_document, code, mixed) with extension-aware filtering. IDF-weighted scoring (rarer terms receive higher impact). Top-k result retrieval with concise output (path | score). Web chat interface and CLI entry points sharing one engine/index. Architecture 1) Search Engine (system_search_agent.py) Main responsibilities:\nroot discovery and recursive file walk extension-aware text extraction index build/update and cache reuse via mtime/size checks Ollama and fallback query planning scoring, ranking, filtering, and formatting Key implementation choices:\nRuntime index file: .system_doc_index.jsonl Logs: agent.log Maximum extracted text cap: MAX_TEXT_CHARS Domain term expansions for targeted intents (e.g., visa/immigration terms) Cooldown after Ollama failures to prevent repeated long blocking calls 2) UI API Server (ui_server.py) Provides a browser-accessible chat layer and endpoints:\nGET /api/status for environment and initialization state POST /api/chat for search requests and formatted responses POST /api/reset for clearing session chat history 3) Web Client (ui.html) A lightweight HTML/CSS/JS chat interface that:\nsends query text and rebuild flags renders ranked results in a human-friendly format enables quick interactive search without command-line usage End-to-End Search Flow User submits a query from CLI or web UI. System verifies whether index is available and fresh. Missing/stale index triggers build or incremental update. Query planner attempts Ollama-based structured planning. If Ollama fails (timeout/network/parse), local planner is used automatically. Candidate documents are filtered through core-term gate rules. Weighted relevance score is computed per candidate. Results are sorted descending by score and returned as top-k list. Ranking and Relevance Design DocCompass uses a transparent weighted formula where:\nCore terms have stronger importance than related terms. Content and path/filename hits are scored separately. IDF weighting emphasizes rarer, more discriminative terms. Document type preferences boost likely natural-document formats. Intent-aware filtering removes noisy file classes for natural_document queries. Scoring characteristics:\nScore is a relative ranking metric within a query. It is not a probability/confidence percentage. Higher score indicates stronger intent-document alignment. Reliability and Safety Considerations Graceful model-failure fallback keeps search functional without Ollama. Runtime logs improve observability for indexing/search issues. Sensitive runtime artifacts are protected in .gitignore: .system_doc_index.jsonl .system_doc_index*.jsonl agent.log *.log Emphasis on local-first architecture reduces external data exposure. Tech Stack Python 3.10+ Ollama (qwen3-vl:4b) for local LLM query planning urllib for model HTTP integration http.server for lightweight API hosting Plain HTML/CSS/JS frontend JSONL for persistent index storage Optional extraction tooling: pypdf pdftotext (Poppler) antiword Why This Project Matters This project demonstrates practical applied IR + LLM systems engineering with clear product value:\nconverts ambiguous natural language intent into actionable local retrieval balances intelligence and reliability through deterministic fallbacks avoids over-complex infrastructure while still supporting semantic behavior keeps developer ergonomics high with both CLI and web UI access Setup and Usage Quick start cd /Users/adityasingh/Documents/Projects/DocumentSearchAgent python3 -m venv venv source venv/bin/activate pip install -r requirements.txt ollama serve ollama pull qwen3-vl:4b python3 ui_server.py Open http://127.0.0.1:8787.\nCLI usage examples python3 system_search_agent.py query \u0026#34;my marksheets\u0026#34; python3 system_search_agent.py query \u0026#34;visa related documents\u0026#34; --top-k 20 python3 system_search_agent.py query \u0026#34;visa related documents\u0026#34; --rebuild python3 system_search_agent.py stats Future Enhancements OCR for scanned-image PDFs. Embedding-based semantic retrieval layer. Hybrid retrieval (keyword + vector + reranking). Smarter domain expansion configuration and per-user tuning. Optional secure local metadata dashboard for search analytics. ","permalink":"https://singhaditya8499.github.io/projects/doccompass/","summary":"\u003ch2 id=\"overview\"\u003eOverview\u003c/h2\u003e\n\u003cp\u003eDocCompass is a local-first document discovery system built to find personal files by meaning, not only by filename. It is designed for natural requests like:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u0026ldquo;my marksheets\u0026rdquo;\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;visa related documents\u0026rdquo;\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;intro to psychology notes\u0026rdquo;\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe project searches local directories, extracts text from multiple file formats, builds a reusable index, creates a structured query plan, and ranks results by relevance with transparent scoring.\u003c/p\u003e\n\u003cp\u003eRepository: \u003ca href=\"https://github.com/singhaditya8499/DocCompass\"\u003egithub.com/singhaditya8499/DocCompass\u003c/a\u003e\u003c/p\u003e\n\u003ch2 id=\"problem-statement\"\u003eProblem Statement\u003c/h2\u003e\n\u003cp\u003eTraditional local file search is often fragile because it depends heavily on exact filenames and folder memory. In real usage, users usually remember intent and partial context, not exact paths. DocCompass addresses this by combining:\u003c/p\u003e","title":"DocCompass: Local-First Document Search Agent"},{"content":"Face Recognition System is a practical computer-vision pipeline that covers full lifecycle stages: data capture, model training, and live identity recognition.\nHighlights Captures and curates face samples for training. Trains a recognition model from collected data. Runs real-time identification on live video streams. ","permalink":"https://singhaditya8499.github.io/projects/face-recognition-system/","summary":"\u003cp\u003eFace Recognition System is a practical computer-vision pipeline that covers full lifecycle stages: data capture, model training, and live identity recognition.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eCaptures and curates face samples for training.\u003c/li\u003e\n\u003cli\u003eTrains a recognition model from collected data.\u003c/li\u003e\n\u003cli\u003eRuns real-time identification on live video streams.\u003c/li\u003e\n\u003c/ul\u003e","title":"Face Recognition System"},{"content":"This conference publication presents a filter-based blockchain architecture intended to improve scalability for domestic IoT environments.\nPublication link: Read on IEEE Xplore\n","permalink":"https://singhaditya8499.github.io/projects/filter-based-scalable-blockchain-for-domestic-iot/","summary":"\u003cp\u003eThis conference publication presents a filter-based blockchain architecture intended to improve scalability for domestic IoT environments.\u003c/p\u003e\n\u003cp\u003ePublication link: \u003ca href=\"https://ieeexplore.ieee.org/abstract/document/9138008/\"\u003eRead on IEEE Xplore\u003c/a\u003e\u003c/p\u003e","title":"Filter Based Scalable Blockchain for Domestic IoT"},{"content":"Graph Plotter is a C++ graphics project focused on rendering mathematical functions at pixel level to build intuition for plotting logic and coordinate transformations.\nHighlights Plots trigonometric and polynomial functions. Handles axis mapping and coordinate conversion. Built with classic graphics.h style rendering primitives. ","permalink":"https://singhaditya8499.github.io/projects/graph-plotter/","summary":"\u003cp\u003eGraph Plotter is a C++ graphics project focused on rendering mathematical functions at pixel level to build intuition for plotting logic and coordinate transformations.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003ePlots trigonometric and polynomial functions.\u003c/li\u003e\n\u003cli\u003eHandles axis mapping and coordinate conversion.\u003c/li\u003e\n\u003cli\u003eBuilt with classic \u003ccode\u003egraphics.h\u003c/code\u003e style rendering primitives.\u003c/li\u003e\n\u003c/ul\u003e","title":"Graph Plotter"},{"content":"Hand Game is a real-time interaction project where hand gestures become game controls through computer-vision based finger and contour detection.\nHighlights Uses webcam input for gesture capture and detection. Converts hand movements into gameplay actions. Demonstrates low-latency vision-to-input integration. ","permalink":"https://singhaditya8499.github.io/projects/hand-game/","summary":"\u003cp\u003eHand Game is a real-time interaction project where hand gestures become game controls through computer-vision based finger and contour detection.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eUses webcam input for gesture capture and detection.\u003c/li\u003e\n\u003cli\u003eConverts hand movements into gameplay actions.\u003c/li\u003e\n\u003cli\u003eDemonstrates low-latency vision-to-input integration.\u003c/li\u003e\n\u003c/ul\u003e","title":"Hand Game"},{"content":"LeetCode Rank Finder is a lightweight automation utility that solves the practical challenge of locating a specific contestant quickly in large contest ranking tables.\nHighlights Fetches and parses contest ranking data. Searches standings by username and returns rank details. Reduces manual effort during contest analysis. ","permalink":"https://singhaditya8499.github.io/projects/leetcode-rank-finder/","summary":"\u003cp\u003eLeetCode Rank Finder is a lightweight automation utility that solves the practical challenge of locating a specific contestant quickly in large contest ranking tables.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eFetches and parses contest ranking data.\u003c/li\u003e\n\u003cli\u003eSearches standings by username and returns rank details.\u003c/li\u003e\n\u003cli\u003eReduces manual effort during contest analysis.\u003c/li\u003e\n\u003c/ul\u003e","title":"LeetCode Rank Finder"},{"content":"Markov Chain Basic is an exploratory NLP project that uses Markov transitions to generate text and study long-run behavior in probabilistic sequence models.\nHighlights Builds transition maps from input corpora. Generates synthetic text using stochastic state transitions. Serves as an intuition-first bridge into probabilistic NLP. ","permalink":"https://singhaditya8499.github.io/projects/markov-chain-basic/","summary":"\u003cp\u003eMarkov Chain Basic is an exploratory NLP project that uses Markov transitions to generate text and study long-run behavior in probabilistic sequence models.\u003c/p\u003e\n\u003ch2 id=\"highlights\"\u003eHighlights\u003c/h2\u003e\n\u003cul\u003e\n\u003cli\u003eBuilds transition maps from input corpora.\u003c/li\u003e\n\u003cli\u003eGenerates synthetic text using stochastic state transitions.\u003c/li\u003e\n\u003cli\u003eServes as an intuition-first bridge into probabilistic NLP.\u003c/li\u003e\n\u003c/ul\u003e","title":"Markov Chain Basic"},{"content":"This publication explains Markov chains with an intuition-first approach and practical examples for state-transition thinking.\nPublication link: Read on Medium\n","permalink":"https://singhaditya8499.github.io/projects/markov-chains-a-simple-powerful-tool/","summary":"\u003cp\u003eThis publication explains Markov chains with an intuition-first approach and practical examples for state-transition thinking.\u003c/p\u003e\n\u003cp\u003ePublication link: \u003ca href=\"https://medium.com/future-vision/markov-chains-a-simple-powerful-tool-11e5b733045d\"\u003eRead on Medium\u003c/a\u003e\u003c/p\u003e","title":"Markov Chains: A Simple Powerful Tool"},{"content":"This paper applies game-theoretic modeling to basketball shot-distribution strategy and examines team-level performance optimization.\nPublication link: Read on arXiv\n","permalink":"https://singhaditya8499.github.io/projects/optimizing-performance-in-basketball/","summary":"\u003cp\u003eThis paper applies game-theoretic modeling to basketball shot-distribution strategy and examines team-level performance optimization.\u003c/p\u003e\n\u003cp\u003ePublication link: \u003ca href=\"https://arxiv.org/pdf/2310.00136\"\u003eRead on arXiv\u003c/a\u003e\u003c/p\u003e","title":"Optimizing Performance in Basketball: A Game-Theoretic Approach to Shot Percentage Distribution in a Team"},{"content":"This post explores architecture decisions for replacing spreadsheet-heavy pricing workflows with an AI-assisted system, including approval loops, safety constraints, and observability.\n","permalink":"https://singhaditya8499.github.io/posts/designing-ai-assisted-pricing-systems/","summary":"\u003cp\u003eThis post explores architecture decisions for replacing spreadsheet-heavy pricing workflows with an AI-assisted system, including approval loops, safety constraints, and observability.\u003c/p\u003e","title":"Designing AI-Assisted Pricing Systems at Scale"},{"content":"A practical guide to diagnosing bottlenecks, selecting reliable SLO-aligned optimizations, and tracking long-term improvements across APIs and CI pipelines.\n","permalink":"https://singhaditya8499.github.io/posts/latency-p99-performance-engineering/","summary":"\u003cp\u003eA practical guide to diagnosing bottlenecks, selecting reliable SLO-aligned optimizations, and tracking long-term improvements across APIs and CI pipelines.\u003c/p\u003e","title":"Latency, p99 Build Time, and Practical Performance Engineering"},{"content":" Reduced price-setting cycle time from around 2 days to around 2 hours. Delivered 30% lower API latency and 40% faster p99 builds. Shipped granular pricing differentiation driving around 10% customer savings. ","permalink":"https://singhaditya8499.github.io/journal/amazon-sde2-impact/","summary":"\u003cul\u003e\n\u003cli\u003eReduced price-setting cycle time from around 2 days to around 2 hours.\u003c/li\u003e\n\u003cli\u003eDelivered 30% lower API latency and 40% faster p99 builds.\u003c/li\u003e\n\u003cli\u003eShipped granular pricing differentiation driving around 10% customer savings.\u003c/li\u003e\n\u003c/ul\u003e","title":"Amazon - Software Development Engineer II"},{"content":"Implementation journal covering rollout milestones, failures, and performance iterations.\n","permalink":"https://singhaditya8499.github.io/journal/building-ai-pricing-automation/","summary":"\u003cp\u003eImplementation journal covering rollout milestones, failures, and performance iterations.\u003c/p\u003e","title":"Building AI Pricing Automation in Production"},{"content":"This post outlines prompt and retrieval strategies, evaluation loops, and safety checks that improved enterprise chatbot answer quality from baseline to production-ready levels.\n","permalink":"https://singhaditya8499.github.io/posts/improving-llm-alignment/","summary":"\u003cp\u003eThis post outlines prompt and retrieval strategies, evaluation loops, and safety checks that improved enterprise chatbot answer quality from baseline to production-ready levels.\u003c/p\u003e","title":"Improving LLM Alignment in Conversational Analytics"},{"content":"An accessibility-focused ML prototype that translates blink patterns into actionable commands, designed to support learning interaction for users with physical limitations.\nRepository/demo assets can be embedded here as the project evolves.\n","permalink":"https://singhaditya8499.github.io/projects/blinkbridge/","summary":"\u003cp\u003eAn accessibility-focused ML prototype that translates blink patterns into actionable commands, designed to support learning interaction for users with physical limitations.\u003c/p\u003e\n\u003cp\u003eRepository/demo assets can be embedded here as the project evolves.\u003c/p\u003e","title":"BlinkBridge"},{"content":"A mental wellness web app mapping anxiety indicators from HAM-A scoring to personalized music recommendations using emotion-aware metadata and fast feedback loops.\nRepository/demo assets can be embedded here as the project evolves.\n","permalink":"https://singhaditya8499.github.io/projects/moodtunes/","summary":"\u003cp\u003eA mental wellness web app mapping anxiety indicators from HAM-A scoring to personalized music recommendations using emotion-aware metadata and fast feedback loops.\u003c/p\u003e\n\u003cp\u003eRepository/demo assets can be embedded here as the project evolves.\u003c/p\u003e","title":"MoodTunes"},{"content":"An AI-driven recommendation prototype combining LlamaIndex pipelines, multi-model analysis, and sentiment extraction from financial news streams.\nRepository/demo assets can be embedded here as the project evolves.\n","permalink":"https://singhaditya8499.github.io/projects/gpt-stock-recommender/","summary":"\u003cp\u003eAn AI-driven recommendation prototype combining LlamaIndex pipelines, multi-model analysis, and sentiment extraction from financial news streams.\u003c/p\u003e\n\u003cp\u003eRepository/demo assets can be embedded here as the project evolves.\u003c/p\u003e","title":"GPT Stock Recommender"},{"content":"New Beginnings It would have been great if there was a way using which we can actually tell how a person thinks. I am not talking about \u0026ldquo;what a person thinks\u0026rdquo; but \u0026ldquo;how a person thinks\u0026rdquo;. If this was possible I will try the method on myself. I will probably write a blog about how I think some time later. This blog is totally dedicated new beginnings.\nI recently won 300 rs gift card after winning a competetion in Amazon (dont judge). I had the oppurtunity of using that so I used it to buy a book, \u0026ldquo;Approaching (almost) any ML problem\u0026rdquo;. Now I haven\u0026rsquo;t read that book yet but it got me thinking that how much I have changed. Aditya from 2 years back would have spend the amount on some absurd gadget. I have started spending money on things which will be useful to me or which can add value to my life in the long run. I am very proud of this change.\nI have started reading books, and with dedication. I dont like fictional books. Currently I am reading, \u0026ldquo;Emotional Intelligence by Daniel Goleman\u0026rdquo;, about how the human brain evolved and why sometimes emotions takeover logical reasoning. This is again one of the steps which I have taken to improve myself as a person. If you are into psychology be it any kind then we can definitely talk for minutes (dont have that much depth to talk for hours, but I am trying).\nRecently I installed an app to improve my productivity by tracking items. We as humans unknowingly spend too much time on things which dont add any value to our life. If at the end of the day you can see the difference between the task completed and not completed, it will have a huge impact on your behavior the very next day.\nNow if you have read my earlier blogs, this blog might appear to be an outlier. You are right, but moving forward I will be writing more about my life, events, my understanding of the world and every other thing. When I am old, all this will be a great source of entertainment for me. Sorry for adrupt ending.\n","permalink":"https://singhaditya8499.github.io/posts/new-beginning/","summary":"\u003ch1 id=\"new-beginnings\"\u003eNew Beginnings\u003c/h1\u003e\n\u003cp\u003eIt would have been great if there was a way using which we can actually tell how a person thinks. I am not talking about \u0026ldquo;what a person thinks\u0026rdquo; but \u0026ldquo;how a person thinks\u0026rdquo;. If this was possible I will try the method on myself. I will probably write a blog about how I think some time later. This blog is totally dedicated new beginnings.\u003c/p\u003e\n\u003cp\u003eI recently won 300 rs gift card after winning a competetion in Amazon (dont judge). I had the oppurtunity of using that so I used it to buy a book, \u0026ldquo;Approaching (almost) any ML problem\u0026rdquo;. Now I haven\u0026rsquo;t read that book yet but it got me thinking that how much I have changed. Aditya from 2 years back would have spend the amount on some absurd gadget. I have started spending money on things which will be useful to me or which can add value to my life in the long run. I am very proud of this change.\u003c/p\u003e","title":"New beginning"},{"content":"Differences, Clinical psychology and Happiness The main questions are:\nHow we are different from other people? Why we are different from other people? The main difference in 2 persons are:\nPersonality To measure the personality we use reliability and validity.\nHarrower-Erickson Multiple Choice Rorschach Test is a test which was used earlier to test personality, although there is no way to test its validity.\nInkblot test: Harrower-Erickson Multiple Choice Rorschach Test\nThe big five personality factors:\nNeurotocism - Stability (N) Extrovert - Introvert (E) Openness to experience - Non openness (O) Agreeableness - Antagonism (A) Conscientiousness - Undirectedness (C) This is the Big five test (OCEAN) and it is stable and there is a way to validate it.\nBig Five Personality Test\nIntelligence People have different opinion about what intelligence means. Charles Spearmen defined intelligence as two factors, i.e. general intelligence (g, accounts for similarity) and specific ability (s, accounts for differences).\nBehavioural genetics We are different because of these regions:\nGenes and environment Nature vs Nurture The findings of behavioural genetics:\nHigh heritability in all cases when talking about psychology The flynn effect: We use same scale to test IQs for people of different generations. If we dont use the same scale, then we can see that the average IQ is rising rapidly in the last 70-100 years. Rest of the variance in a group comes from non shared environment. Parenting Shared environment does\u0026rsquo;nt matter. Parents dont matter in IQ, they just impact the hereditory part. Their parenting technique does\u0026rsquo;nt matter. Peers matter more than the parents.\nClinical psychology Also known as psychopathology.\nNotions of mental disorders Can be due to demonic obsession Social deviance from a behaviour Schizophrenia About 1% of world populations suffers from this. Its not multiple personality disorders. Symptoms:\nHallucinations (auditory callings) Delusions (believing something) Disorganized speech Disorganized behaviour Absence of normal cognition Subtypes of schizophrenia:\nParanoid schizophrenia (delusions of persecution and grandeur) Catatonic (unresponsive to surrounding, parrot like speech, purposeless movement) Disorganized (delusions and hallucination, disorganized speech) Undifferetiated The basic malfunction is unable to sequence your thoughts and corrdinate them. Further problem arises due to loss of contact. Too much dopamine is found in schizophrenic patients. Possible causes early on can be oxygen deprivation while birth, prenatal infections or difficult family circumstances.\nMood disorders Main types are depression and bipolar disorder\nDepression Severed depressed mood that lasts more than two weeks. No resonable cause for this. Women are more affected then men Almost 15% people affected from this. It is heritable. Low level of neropinephrine and serotonin can cause depression. The most serious manifestation of depression is suicide. Suicide is contagious. Bipolar disorder Other less comman depressive disorder is bipolar disorder which occurs in 1% population. It is highly heritable, affects different part of brain then mentioned above. It has interesting association with creativity. Anxiety disorder Vague feeling of fear and apprehension Everyone experiences it. It becomes problem when it is irrational, uncontrollable and disruptive. Generlized anxiety disorder Every 1 in 20 people experience it It has geentic component Headaches, stomach aches, muscle tension, irritability Related to major childhood trauma due to which one can become hyperviigilance. Phobias Intense, irrational fears of objects, things, etc. It may be caused by classical conditioning Preparedness theory: We are psychologically prepared for phobias. We have phobias of things which can harm us due to evolution. Obsessive compulsion disorder Obsession are irrational disturbing thoughts. Compulsions are repetetive actions performed to alleviate obsession. Serotonin is involved in OCD in some way. Disassociative disorder People are unaware of things around them Unable to recall under some circumstances It is disassociative of memory Dissociative amnesia We lose some memory. In some cases, we lose information about ourselves. This can be caused by a trauma. Also known as psychogenic amnesia Disassociative fugue Also known as psychogenic fugue We go out of home, settle somewhere else and completely forget where we lived or about our life. This stage is called fugue state Disassociative identity disorder Originally multiple personality disorder Mostly affects women Can be cause due to abuse as a children Therapy Psychodynamic therapy: focus on underslying causes and not symptoms Multiple sessions per week Freud is assocaited with it Behaviour therapy Skinner is associated it Tratment of phobias Cognitive therapy Talk to therapy and find ways to correct it Cognitive behavioural therapy (CBT) which uses all three. Medication interventions Medicines Use electroconvulsive therapy Transcranial magnetic stimulation Happiness When asked how happy you are (on a scale 1-10), people generally say around 7-8.\nWhen asked the question on sunny/rainy day, people are happier on sunny day.\nHappiness is a goal state animals have evolved to pursue, a signal that needs to be satisfied.\nHappiness does\u0026rsquo;nt change as much as we think Happiness is highly heritable Happiness is influenced by absolute and relative factors. Our judgement about the pleasure and pain of past events are skewed. ","permalink":"https://singhaditya8499.github.io/posts/intro-to-psychology-vii/","summary":"\u003ch1 id=\"differences-clinical-psychology-and-happiness\"\u003eDifferences, Clinical psychology and Happiness\u003c/h1\u003e\n\u003cp\u003eThe main questions are:\u003c/p\u003e\n\u003col\u003e\n\u003cli\u003eHow we are different from other people?\u003c/li\u003e\n\u003cli\u003eWhy we are different from other people?\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003eThe main difference in 2 persons are:\u003c/p\u003e\n\u003ch3 id=\"personality\"\u003ePersonality\u003c/h3\u003e\n\u003cp\u003eTo measure the personality we use reliability and validity.\u003c/p\u003e\n\u003cp\u003eHarrower-Erickson Multiple Choice Rorschach Test is a test which was used earlier to test personality, although there is no way to test its validity.\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://openpsychometrics.org/tests/HEMCR/\"\u003eInkblot test: Harrower-Erickson Multiple Choice Rorschach Test\u003c/a\u003e\u003c/p\u003e","title":"Introduction to Psychology - VII"},{"content":"Emotions and Social Doctorine of Physicalism It states that everything is physical. It is closely related to materialism.\nWhere do complex things come from? Suppose you are walking on a path and your foot gets hurt by a stone, then you might ask the question as to how the stone got there. Then you might get the answer that the stone could have been there since eternity. But suppose you would have found a watch, then the answer would not have been the same as watch is very complex than all other things there. Similarly, we can say the same thing about human organs. This is known as argument from design.\nProblem of creationism: It we believe that we were created by some external entity like god or aliens then it leads to following problem: Pushes back the actual question There has been proof of evolution Poor design, some body parts are not correctly designed like blind spot in eyes, etc. Natural Selection: Given by Charles darwin. Evolution was known long before he came but he showed why its there. This is how it happens in brief: Random variation Random variation gives rise to differences in survival and reproduction and gets passed from generation to generation Lastly, the perfect structure is formed The brain is the product of evolution Misconception about evolution and psychology Natural selection should have caused humans and animals to spread their genes. This is a wrong assumption. There is a difference between ultimate causation and proximate causation. Evolution did have caused us to feel hunger, etc which is proximate causation. Everything we do have adaptive significance. Color vision is adaptive change Love of TV, chocolates, etc is accident Pleasure we get from music or art or humour is still in research as to find why we like it Life is possible without emotions This is completely wrong. Emotions are fundamental to humans Facial expressions We are more prone to smile when we are happy and we want other people to know it. Smiles are social symbol. There are different types of smile Happiness smile (Duchenne smile, more to do with eyes) Greeting smile (kind of fake, more to do below the nose) Coy smile (awkward, nervous) Babies have the tendency to find the difference between the types of smile Couples who have more Duchenne smile are happier Fear Its a social emotion. People have fear of snakes, heights, less space,etc. But we never meet someone who is afraid of cars or electric shop. It is found that children are afraid of spiders and snakes from a very young age. The classical conditioning cant explain it, but the main reason is evolution. Emotions are very hard to fake. Study of fear can explain how evolution have affected our emotions. Kinship and Attachment Every animal want to have children. It is loosely related to survival of the fittest which means that animals are always in a tussle to survive either by intelligence or power. Then how do the kindness exist in our personality? There is no use of kindness in the cruel world. We have evolved to be nice to our kin. We are most attached to our children as they are the closest who are related to us and vie versa. The psychology of attachement poses two questions: How parent react to children? Adults are innately attracted to babies. We like the features of a babies face.\nHow children reacts to parent? Children are attracted to anyone who takes care of them. Conditiong and rewarding can be one of the reason (Cupboard theory by Skinner) or Innate attachemnt theory by Bowlby. Children search for a sense of security more than any other things which is explained by this video.\nWe are nice to non kin as well. How did this kindness came into us?\nReciprocal altruism: We are more likely to help someone who help us\nSometimes we make decisions which appears to be irrational on surface but are actually rational. For eg: The ultimatum game\nSocial Social priming We are influenced by factors outside of our control\nSelf Spotlight effect - We tend to think everyone notices us Lakewobegon effect - Suppose in a class, students are asked individually as to how attentive they are. Most of them will say a value above 50 (on a scale of 0-100). Everyone thinks they are above average. Self serving bias: We tend to attribute positive things to ourselves rather than negative things. We think positive result are our own doing but negative result is due to external factors. Cognitive dissonance theory: When we experience internal inconsistency, we feel unpleasant. We want to get rid of that feeling. We avoid incosistent information. Humans generally want what they think to be true. Most people who go for second opinion try to get a feedback of their liking. Insufficient justification effect: If we dont have enough justification for a doing, we might change our opinion about it. Attribution theory Why a behaviour occurs? We intuitivly thinks of others action as part of their personality We have the tendency to see actors as the character they play Liking Why do we like other people? Apart from noral traits like honesty, kindness, etc there are some psychological factors as well. Familiarity is important. More we see something, more we like it. People who live close or daily see each other, develop a sense of familiarity and then liking. This is known as Mere-exposure effect. Similarity also attracts. Attractive people tends to be smarter, wiser, moral, get more marks Mathew effect: Rich gets rich and poor gets poor. Attractive people gets everything else as well. First impressions are very very important. First impressions are formed very quickly called thin slices. What effects do our perception of other people have on other people? This also plays a significant role. Self fulfilling prophecies: When our belief and expectations create a reality or influence our or others behaviour. Also known as pygmalion effect. ","permalink":"https://singhaditya8499.github.io/posts/intro-to-psychology-vi/","summary":"\u003ch1 id=\"emotions-and-social\"\u003eEmotions and Social\u003c/h1\u003e\n\u003ch3 id=\"doctorine-of-physicalism\"\u003eDoctorine of Physicalism\u003c/h3\u003e\n\u003cp\u003eIt states that everything is physical. It is closely related to materialism.\u003c/p\u003e\n\u003ch3 id=\"where-do-complex-things-come-from\"\u003eWhere do complex things come from?\u003c/h3\u003e\n\u003cp\u003eSuppose you are walking on a path and your foot gets hurt by a stone, then you might ask the question as to how the stone got there. Then you might get the answer that the stone could have been there since eternity. But suppose you would have found a watch, then the answer would not have been the same as watch is very complex than all other things there. Similarly, we can say the same thing about human organs. This is known as \u003cstrong\u003eargument from design.\u003c/strong\u003e\u003c/p\u003e","title":"Introduction to Psychology - VI"},{"content":"Perception, Attention and Memory Perception Our brain percieves things very fast, lot faster then a computer. It all begins with eye, but even then there are too many question. It is believed that brain understands things by these three ways:\nPerception of brightness Our brain automatically brightens an object in light and darken an object in light. This can create an illusion in some cases.\nAdelson\u0026rsquo;s Same Color Illusion - BrainHQ from Posit Science\nPerception of depth Brain is capable of understanding depth. If we see a small object growing in size, we automatically realise that it is moving towards us.\nShepard\u0026rsquo;s Rotated Tables\nPerception of objects Our brain is very good in recognising patterns. By recognising these patterns we are able to differetiate different objects which are visible.\nAttention Our brain is capable of paying attention to which it feels neccessary or oblidged to do.\nStroop effect In psychology, the Stroop effect is the delay in reaction time between congruent and incongruent stimuli. The effect has been used to create a psychological test that is widely used in clinical practice and investigation.\nThis video tells that we are not very attentive in our day to day life.\nMemory Memory is complicated. The memory can use below mentioned terms:\nExplicit memory: It includes known facts like capital of country, date of birth, etc. Implicit memory: We dont remember it consciously like driving, breathing, etc. Semantic: It can be again like capital of country or we can say known facts. Episodic: We remember certain episodes of our life like our happiest moment, etc. Encoding: Information stored in head Storage: Space where we store the information Retrieval: The process of extracting memory out of storage. Recall: We remember certain things which are triggered due to some sensory actions. Recognition: Like we instantly know the name of the person, etc. Memory storage Sensory memory: These are the memory which are there due to some sensory triggers. Like we might not be paying attention but if someone asks were we listening, we actually go back to our auditory memory and try retrieving the information. Short term memory: This is a memory which holds information for a very short duration. The golden number given to store information is 7 +/- 2 chunks (basic unit of storing information). We need to rehearse continuously to refresh and keep the memory. Long term memory: This is which is encoded in our brain. It stays for a long period of time but it also needs to get refreshed. How to get things to long term memory? Depth of processing sends information to Long term memory: If we have deeper analysis of knowledge then it is more likely to be stored in long term memory Mnemonics: Make connections among chunks Understanding: If we have the right context of our memory, we are more likely to hold it for long duration Remembering How to get information out of memory?\nRetrieval cues: We can have some story associated with the memory. We can use that story to extract the information Compatibility principle: We remeber information when we try to recover information in the same context we stored them. Searching strategy: We remember things if we change our search starategy like trying recovering from different angles. Failures of memory Why do we forget? Because memory are physical things so they fade overtime Because of interference: New information kind of overwrites Change of retrieval cues Forgetting due to brain damage (amnesia) Retrograde amnesia: loss of memory prior to stroke or accident Anterograde amnesia: lose the capacity to form the memory False memories Why are memories are sometimes distorted?\nExpectations: When we increase the expectations Leading questions: Questions can sometime fill in the story so to make the questions correct. Hypnosis: We try creating a strory Repressed memory: Memories which are repressed can be turned into false story Flashbulb memory: Memories associated to some disaster can be manipulated by the brain ","permalink":"https://singhaditya8499.github.io/posts/intro-to-psychology-v/","summary":"\u003ch1 id=\"perception-attention-and-memory\"\u003ePerception, Attention and Memory\u003c/h1\u003e\n\u003ch1 id=\"perception\"\u003ePerception\u003c/h1\u003e\n\u003cp\u003eOur brain percieves things very fast, lot faster then a computer. It all begins with eye, but even then there are too many question. It is believed that brain understands things by these three ways:\u003c/p\u003e\n\u003ch3 id=\"perception-of-brightness\"\u003ePerception of brightness\u003c/h3\u003e\n\u003cp\u003eOur brain automatically brightens an object in light and darken an object in light. This can create an illusion in some cases.\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://www.brainhq.com/brain-resources/brain-teasers/adelsons-same-color-illusion/\"\u003eAdelson\u0026rsquo;s Same Color Illusion - BrainHQ from Posit Science\u003c/a\u003e\u003c/p\u003e","title":"Introduction to Psychology - V"},{"content":"Development Big questions about development Do we start as moral or immoral? Whats the relation between child and adult? How are they related in terms of continuity? How much knowledge are we born with? There are two group of thoughts around this: Empiricism: They believe that we are born empty and we learn along the way Nativism: We are born with existing structure in brain Constructivism: It is a hybrid of above two Jean Piaget is known as the father of developmental psychology. His research field was genetic epistemelogy. He gave the theory of cognitive development.\nPiaget\u0026rsquo;s theory of cognitive development Children\u0026rsquo;s are active thinkers and they constantly try to have a more advanced understanding of the world. This understanding is known as schemas.\nSchemas: These are the framework to form an understanding. There are two ways of achieving this:\nAssimilation: Absorb knowledge Accomodation: Make space for new knowledge in already existing knowledge database. Piaget proposed that children have a totally different view of the world. The development occurs as a series of stages differing in how the world looks.\nPiaget\u0026rsquo;s developmental stage theory 1. Sensorimotor This is the first stage of a child\u0026rsquo;s life and it happens from 0-2 years of age. The child have full sensory access but cant perceive it. He/She can see see and manipulate things without reasoning, just like a driverless car. One major thing which is absent here is the concept of object permanence. At all other stages, if an object is removed from our sight, we know that it still exists. But this is not the case with a child. They think that object is gone. Thats the reason why children from the age of 0-2 get so surprised on seeing peek-a-boo. 2. Preoperational This stage exists from age 2 to 7. Here the child have symbolic thoughts and they have some sort of perception of their thoughts. Even now they cant have higher order thoughts, maybe thats why they remain happy. During this phase the child is ego centric, means they cant understand that a different person can have a different view then theirs. They also lack the concept of conservation, means size matters more to them then numbers. If you give two glasses of milk with equal volume one larger in size and one smaller, they would say that smaller one has less milk. 3. Concrete operational This stage exists from age 7 to 12. Here the child have more logical thoughts, they become less ego centric. Although they are still not capable to reason abstractly or hypothetically. Ask someone from this age group about the meaning of true happiness? 4. Formal operational This is the final stage and then the child becomes an adult. Child develops the power of abstract and scientific reasoning here. Limitations of Piaget\u0026rsquo;s theory He never provided a theory how the children go from one stage to other. His methods are not very efficient. He generally interviewed them and we cant take their answers to be 100% accurate. He may be factually wrong. Some of the research show that even babies are quite smart then we think of. How do we study babies? There are several ways in which researchers study babies.\nThe first way is using machines and scans. We scan the brain of the baby while he/she is performing some activity. We then try to deduce the logic from the brain mapping available with us. Babies are born with innate talent of sucking. We can devise an experiment to judge what baby likes or dislikes by their speed, etc while sucking. Babies are also born with the talent of looking at more intersting thing. We can use this to design experiment to understand what a baby mind knows. There was an interesting experiment to see if babies are born with morality. It was found that around 70% of babies chose good over bad when given a choice, which might suggest that babies do have morality inbuilt. In another experiment, babies were tested whether they have the elementary sense of numbers, it was found that babies do have some sense of numbers inbuilt in them. Children dont have the sense that different people can have different thoughts. They dont develop that understanding till the age of 4-4.5 years. There is another experiment conducted on children known as Sally and Anne experiment.\nLanguage Language is action. Langauge is a tool which differentiate humans to other animals.\nCharles Darwin: Men have the instictive tendency to speak, no other animal have this capacity.\nEvery human society have language Creolisation: involves people who are in slave trade. Even if people are from different society, they develop a pidgin language (common communication system) Language is used to convey creativity There are around 10^130 grammatical correct sentences. It might happen that if you use a sentecne, nobody has ever said it ever before. Characterisation of language 1. Phonology There are around 44 different sounds in english language, although there are only 26 letters. To learn a new language we need to understand the phonies of the language. It is quite astonishing that a listener\u0026rsquo;s mind is able to tell where a word in a sentence ends. Our mind automatically do it for us. Our brain is wired so to segment the words of the speech hence extracting a meaning out of it. If we hear any new language, our brain can even process where a word ends.\n2. Morphology This deals with words. The smallest meaningful unit of language is known as morpheme like -ing, come,-ed, etc. An average english speaker knows about 80000 morphemes.\n3. Syntax rules of language,\nLanguage acquisition Noam Chomsky says that development of language should not be seen as development of language but growth. Some researchers believe that the language is important for abstract thoughts, which seems to be not true based on some recent experiments. The language acquition happens in babies in following steps:\nBorn-4 months Babies start to understand the melody of language. They become sensitive to phonemes. It is found that babies are sensitive to phonemes of many languages. 4-7 months Babies starts to babble. By birth deaf babbles with the help of the movement of their hands. 7-12 month Babies speak their first words. At this stage they also become sensitive to words. They start responding to them. 12-18 months Babies can produce sentences upto 2 words. They start learning morphemes like is,a,the,etc. It is seen that young age is best for learning new language. Even if an adult person spends considerable amount of time learning a second language, he/she might not be able to get fluent.\n","permalink":"https://singhaditya8499.github.io/posts/intro-to-psychology-iiii/","summary":"\u003ch1 id=\"development\"\u003eDevelopment\u003c/h1\u003e\n\u003ch2 id=\"big-questions-about-development\"\u003eBig questions about development\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eDo we start as moral or immoral?\u003c/li\u003e\n\u003cli\u003eWhats the relation between child and adult? How are they related in terms of continuity?\u003c/li\u003e\n\u003cli\u003eHow much knowledge are we born with?\n\u003col\u003e\n\u003cli\u003eThere are two group of thoughts around this:\n\u003col\u003e\n\u003cli\u003eEmpiricism: They believe that we are born empty and we learn along the way\u003c/li\u003e\n\u003cli\u003eNativism: We are born with existing structure in brain\u003c/li\u003e\n\u003cli\u003eConstructivism: It is a hybrid of above two\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp\u003e\u003cimg alt=\"https://www.verywellmind.com/thmb/3MOTmZ9a2vAozymXfe4pluo8_-c=/500x350/filters:no_upscale():max_bytes(150000):strip_icc()/child-development-theories-2795068-01-de70d302f2f94e60b00e57c59bd5984f.png\" loading=\"lazy\" src=\"https://www.verywellmind.com/thmb/3MOTmZ9a2vAozymXfe4pluo8_-c=/500x350/filters:no_upscale():max_bytes(150000):strip_icc()/child-development-theories-2795068-01-de70d302f2f94e60b00e57c59bd5984f.png\"\u003e\u003c/p\u003e","title":"Introduction to Psychology - IV"},{"content":"Skinner theory Why do have unconscious part? Deception: Animals have been at the forefront when it comes to decieving other living beings. When in danger, chimpanzee hairs stands so that it can look bigger. Same happens in humans as well, we try to decieve others into beliveing that we are tougher, smarter, etc. We have developed a lie detection mechanism as well to counter the decieving part. We are better liar if we believe that the lie is true. The best lie is the lie which we tell to ourselves. The sinister or bad decision is better when taken with the help of unconscious part. Skinner theory Skinner worked on behaviourism. Although behaviourism was already there but he bought it to the masses. Some of the key points of behaviourism are:\nWhatever we are is because of our experience. Anti mentalism: Claims about desires, unconscious is unscientific as they cant be touched or seen. Behaviorist believes there are no difference between what I can do and what other person can do. 3 key principles of Behaviourism Habitualism: Decline in the tendency to act on a stimuli due to repeated exposure to it Classical conditioning: Learning of an association between one stimulus and another stimulus. There are many key concepts here like generalisation, spontaneous reaction, etc. One of the key experiment conducted here was The little albert experiment Operant conditioning: Learning the relationship by what you do and how successful or unsuccessful it is. This conditioning is totally voluntary. A conditioning improves if rewarded or weakens if not. Controversy and criticism of Behaviourism We know that humans have innate knowledge and innate desires There is debate over how much do we know when we are born? Reward is not neccessay to accelerate a behaviour. Garcia effect: aversion to taste or smell gets associated with negative behaviour. Not all phobias are developed due to classical conditioning, some are innante in humans. The fear of snakes is common to both humans and chimpanzees. ","permalink":"https://singhaditya8499.github.io/posts/introduction-to-psychology-iii/","summary":"\u003ch1 id=\"skinner-theory\"\u003eSkinner theory\u003c/h1\u003e\n\u003ch2 id=\"why-do-have-unconscious-part\"\u003eWhy do have unconscious part?\u003c/h2\u003e\n\u003col\u003e\n\u003cli\u003eDeception: Animals have been at the forefront when it comes to decieving other living beings. When in danger, chimpanzee hairs stands so that it can look bigger. Same happens in humans as well, we try to decieve others into beliveing that we are tougher, smarter, etc.\u003c/li\u003e\n\u003cli\u003eWe have developed a lie detection mechanism as well to counter the decieving part. We are better liar if we believe that the lie is true. The best lie is the lie which we tell to ourselves.\u003c/li\u003e\n\u003cli\u003eThe sinister or bad decision is better when taken with the help of unconscious part.\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch2 id=\"skinner-theory-1\"\u003eSkinner theory\u003c/h2\u003e\n\u003cp\u003eSkinner worked on behaviourism. Although behaviourism was already there but he bought it to the masses. Some of the key points of behaviourism are:\u003c/p\u003e","title":"Introduction to Psychology - III"},{"content":"Freud theory There are theories which are specific to some domains of psychology, but theories of Freud and Skinner spans accross many different domains of psychology. Freud theory has a very big scope.\nFreud is consisdered to be a very hyper personality. He was a cocaine addict. He gave lot of theories, some of which are not rationale.\nOne of his theory is Penis envy which seems false but also true. Its so vague that you can\u0026rsquo;t prove it false and also cant prove it to be true. If we dont dive into these irrational theories and focus on other interesting rational theories he proposed then he was quite an extraordinary personality.\nExistence of unconscious Freud said that there is conscious and then there is unconsicous.\nHe rejected the claim that you know what you are doing all the time.\nWhatever we are doing is the product of conflict between three different entities which are present in our brain.\nThese three entities are:\nId - It is present by birth. It is the animal part which want to eat, sleep, drink, etc. It is stupid. It only wants pleasure and it want it right now. Ego - We dont get what we want. This system ensures how to satisy the desires or how to suppress them. Origin or ego means there is a consciousness devloping. Superego - This entity tells us when something is wrong. It is also stupid but in a good way. There is constant struggle which happens between id and superego. Some of the struggles spills out and appears in dreams, mood, behaviour or in some cases clinical symptoms.\nThere are times when the desires of Id comes out of us unconsciously. Our body takes several steps to stop this from happening and this is called defence mechanism. Few of them are:\nSublimation: We can have high energy which can be related to any emotion. We use it to push ourselves in some other domain. Displacement: We can have some shameful thoughts so we express it somewhere else. Projection: I can have some impulses which I am not proud of, I can project it on someone else. Rationalisation: When we do something bad, we try to justify it by giving logical arguements which may not be correct. Regression: Returning to earlier stage of development Dream: Dream had a manifest content as well as latent content. Dreams are basically a way to fulfill desires. Dreams have symbolism.\nFreud theory of child development Freud believed there are five stages of child development. If there is a lack of development at a certain stage then we will be stuck there. Five stages are:\nOral stage: Oral trainings begins. Person who chews a lot, smokes, constantly keeps their mouth busy is due to lack of oral training. Anal stage: Potty training. Ability to let go of the things. People who hold onto things, etc lack this training. Phallic stage: Boys are more attached to their mother and girls to their father. Latency stage: Child interacts with same sex partners because of the conclusion he/she drew out from the phallic stage. This is a long period. Genital stage: We are attracted to opposite sex now. Criticism of Freud theory Theory is so vague that it cant be proved wrong neither can it be proved right. Unconscious examples in life Understanding of language Many likes and dislikes ","permalink":"https://singhaditya8499.github.io/posts/introduction-to-psychology-ii/","summary":"\u003ch1 id=\"freud-theory\"\u003eFreud theory\u003c/h1\u003e\n\u003cp\u003e\u003cimg alt=\"https://www.sigmundfreud.net/images/sigmund-freud-photo.jpg\" loading=\"lazy\" src=\"https://www.sigmundfreud.net/images/sigmund-freud-photo.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eThere are theories which are specific to some domains of psychology, but theories of Freud and Skinner spans accross many different domains of psychology. Freud theory has a very big scope.\u003c/p\u003e\n\u003cp\u003eFreud is consisdered to be a very hyper personality. He was a cocaine addict. He gave lot of theories, some of which are not rationale.\u003c/p\u003e\n\u003cp\u003eOne of his theory is Penis envy which seems false but also true. Its so vague that you can\u0026rsquo;t prove it false and also cant prove it to be true. If we dont dive into these irrational theories and focus on other interesting rational theories he proposed then he was quite an extraordinary personality.\u003c/p\u003e","title":"Introduction to Psychology - II"},{"content":"Introduction to psychology Below material was captured as notes, while I was studying Introduction to psychology out of curiosity, a course made available by Yale.\nBrain Astonishing hypothesis It was given by Francis Crick, who was one of the discoverer of molecular structure of DNA. He said that\na person\u0026rsquo;s mental activities are entirely due to the behaviour of nerve cells, glial cells, and the atoms, ions, and molecules that make them up and influence them.\nThis puts a question in front of us, do we really have control on ourselves or are we just a physical machine who is controlled by some undiscovered power?\nDualism Descartes said humans are not machine and they have control over themselves, their actions and emotions unlike animal. Humans are a part of dualism which consist of a material body and an immaterial mind. He gave two arguments why we are not machine and a part of dualism:\nHumans can choose what to say, how to react, etc to different situations and questions. The soul is entirely distinct from the body. (He considered brain to be immaterial part of our existence) But he failed to explain, how humans learn to talk? What makes someone attractive? How is soul connected with material body.\nNeurons The basic unit of brain is a neuron, basic building block. It is made up of three main parts:\nDendrites: Neurons get signals from other neuron here. It decides whether to fire a neuron or not. It depends on some threshold value. Axon: Firing from dendrites happen here. It can be in feet. Axon terminals: It helps connecting with other neurons. There are three types of neurons:\nSensory neurons (helps in vision, hearing, etc) Motor neurons (helps picking hand up, walking, etc) Inter neurons (helps in thinking, connect sensation and action, etc) Neurons are like gun, they fire or they fail to fire (failing to fire can cause some neurological probelm). But then how do we measure the intensity of some external change? It is decided by the number of neurons firing and frequency of firing.\nThere is a very small gap between axon and dendrite of next neuron called synapse. A chemical is released between them called neurotransmitter. Humans can change the amount of neurotransmitter in couple of ways to get different results:\nAntagonist: External chemical which blocks motor neurons. Alcohol also inhibits the inhibitory neurons which are predominantly present in PFC which generally tells us what not to do like not killing anyone, keeping pants on, etc. Agonist: Chemicals which increase the amount of neurotransmitter (hightened sensation, etc). Parts of brain Although it seems we require brain for everything, there are few things which doesn\u0026rsquo;t require any brain.\nNew born sucking Withdrawal from pain Vomiting The main parts of brain are:\nMedulla: It is used for heart rate, respiration, etc. Cerebellum: Body balance and muscular coordination, etc. Hypothalamus: Feeding hunger, thirst, etc. Cortex: Outer layer covering brain about 2 ft. in area. Cortex contains frontal lobe, temporal lobe, etc. The two hemisphere of the brain are connected by corpus callosum. Our brain contains topographical arrangement similar to our body. If two body parts are near, their corresponding brain part would also be very close to each other.\nApraxia: Brain cant provide the correct set of movement to different body part like waving, walking, etc.\nAgnosia: When brain loses the ability to recognize faces, objects, places, etc.\nAphasia: Ability to not understand and produce language.\nIf we map every body part by the part of the brain it acquires, we get a sensory homunculus mode, which is weird to look at but tells a lot about human brain.\n","permalink":"https://singhaditya8499.github.io/posts/introduction-to-psychology/","summary":"\u003ch1 id=\"introduction-to-psychology\"\u003eIntroduction to psychology\u003c/h1\u003e\n\u003cblockquote\u003e\n\u003cp\u003eBelow material was captured as notes, while I was studying Introduction to psychology out of curiosity, a course made available by Yale.\u003c/p\u003e\u003c/blockquote\u003e\n\u003ch2 id=\"brain\"\u003eBrain\u003c/h2\u003e\n\u003ch3 id=\"astonishing-hypothesis\"\u003eAstonishing hypothesis\u003c/h3\u003e\n\u003cp\u003eIt was given by Francis Crick, who was one of the discoverer of molecular structure of DNA. He said that\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003ea person\u0026rsquo;s mental activities are entirely due to the behaviour of nerve cells, glial cells, and the atoms, ions, and molecules that make them up and influence them.\u003c/p\u003e","title":"Introduction to psychology"},{"content":"Kotlin Kotlin is a statically typed programming language Officially supported language by Google for android Core features of Kotlin: Concise: Reduces the amount of boilerplate code Safe: Avoid NullPointerException Interoperable: Use existing libraries of Java, Android, etc Tool friendly: Use any existing IDE Hello world! fun main() { println(\u0026#34;Hello world!\u0026#34;) } Variables ... val a = \u0026#34;Hello\u0026#34; //type inference val a: Double = 23.44 ... val vs var val is value and var is variable val is nothing but a final value(like Java) which can not be reassigned. var can be reassigned. Can not change the type of a var. It is bounded by its defined type. We can use lateinit to initialise var later. ... lateinit var a: String; ... a = \u0026#34;Aditya\u0026#34; ... We can not set a null value to a var. We need to use ? operator. This is due to strong null safety check which comes attached with Kotlin. ... var a: String? = null; ... To get a NPE for a var in Kotlin, we need to use !! operator. It makes sure that we receive NPE if it occurs. ... var a: String? = null ... val size: Int = a?.length!! //throws NPE We have and elvis operator in Kotlin which is similar to conditional operator. (?:) ... var a: String? = null ... val size: Int = a?.length ?: 0 //returns 0 if a.length is null If we need to concatenate a string to another, there is a smart way to do it in kotlin ... var a: String = \u0026#34;Aditya\u0026#34; println(a + \u0026#34;Singh\u0026#34;) //prints Aditya Singh println(\u0026#34;$a Singh\u0026#34;) //prints Aditya Singh ... Arrays We can define array in following ways: val a = arrayOf(1,2,3,4,\u0026#34;Aditya\u0026#34;) /* arrayOf() uses vararg underneath which tells that we can have n arguements inside a function. */ val a = arrayOf\u0026lt;Int\u0026gt;(1,2,3,4) /* This will bind our array with Int type. We cant add any other variable of any other type inside it. */ val num = Array(5, {i -\u0026gt; i*1}) //0 1 2 3 4 /* Using Array constructor */ println(a[3]) println(a.get(3)) Collections By default in kotlin list is immutable ... val myList = listOf\u0026lt;String\u0026gt;(\u0026#34;Hello\u0026#34;,\u0026#34;World\u0026#34;,\u0026#34;Aditya\u0026#34;) ... myList.add(\u0026#34;India\u0026#34;) //cant do that as there is no function add() If we want to add items we need to explicitly define it as mutable. We can use arrayListOf() also in place of mutableListOf(). ... val myList = mutableListOf\u0026lt;String\u0026gt;(\u0026#34;Hello\u0026#34;,\u0026#34;World\u0026#34;) ... myList.add(\u0026#34;Aditya\u0026#34;) Maps are immutable. ... val myMap = mapOf\u0026lt;Int,String\u0026gt;(1 to \u0026#34;Aditya\u0026#34;, 2 to \u0026#34;Singh\u0026#34;) ... println(myMap[1]) //this will print \u0026#34;Aditya\u0026#34; val myMap = mapOf(1 to \u0026#34;Aditya\u0026#34;, \u0026#34;surname\u0026#34; to \u0026#34;Singh\u0026#34;) //to use different keys If we want mutable map, we use hash map. ... val myMap = hashMapOf(1 to \u0026#34;Aditya\u0026#34;, \u0026#34;surname\u0026#34; to \u0026#34;Singh\u0026#34;) ... myMap.set(\u0026#34;country\u0026#34;, \u0026#34;India\u0026#34;) //add a new key value pair myMap[\u0026#34;country\u0026#34;] = \u0026#34;India\u0026#34; //we can do something like this as well Loops Foreach loops works with list, array, map. It iterates over the entire set of items and give the output. val myList = listOf\u0026lt;String\u0026gt;(\u0026#34;Hello\u0026#34;,\u0026#34;World\u0026#34;,\u0026#34;Aditya\u0026#34;) myList.forEach(it -\u0026gt; println(it)) //prints all items for loop for (name in listOfNames) { println(name) //print every item in list } for ( x in 0..10) { println(x) //prints all value from 0 to 10 inclusive } for ( x in 0 until 10) { println(x) //prints all value from 0 to 10, excludes 10 } for ( x in 0 until 10 step 3) { println(x) //prints 0 3 6 9 } for ( x in 10 downTo 0 step 3) { println(x) //prints 10 7 4 1 } Keywords in is check inclusiveness When It is similar to switch statement of C++. We dont iterate over all the condition like we do in if-else. ... var a:String = \u0026#34;Aditya\u0026#34; when(a) { \u0026#34;Aditya\u0026#34; -\u0026gt; { println(\u0026#34;Aditya\u0026#34;) //will print this } \u0026#34;Singh\u0026#34; -\u0026gt; { println(\u0026#34;Singh\u0026#34;) } else { println(\u0026#34;Other\u0026#34;) } } ... When can return a value as well. Functions The structure of functions is very similar to C++ or Java. fun functionName(variable: Int): String { return \u0026#34;$variable was passed\u0026#34; } Types of arguements:\nPositional arguments: Arguments are passed in the order they are declared in the function definitions Default arguments: There can be default values defined as an argument. We can choose not to pass it as a parameter. Function will pick up the default value. Named arguments: These are special in kotlin. We can send parameter in any order, just specifying the name ... callFun(name=\u0026#34;Aditya\u0026#34;, age=22, company=\u0026#34;Amazon\u0026#34;) fun callFun(name: String, age: Int, company: String) { //do something } If we are not sure of number of argument to pass, we can use vararg.\n... callFunction(1,2,3,4) fun callFunction(vararg number: Int) { println(number.size) for(num in number) { prinln(num) } } ... Class Similar to classes in C++ class User { var name: String = \u0026#34;Aditya\u0026#34; var age: Int = 22 fun getAge(): Int { return age } fun assignValue(name:String, age: Int) { this.name = name this.age = age } } this keyword is used to access members of current class. It points to the current class present in scope. Constructor are used to initialise the members of a class. There are 2 types of constructors: Primary constructor (We can have only one primary constructor in a class) Secondary constructor (We can have multiple secondary constructor in a class class User(var name: String, var age: Int) { var name: String var age: Int fun getAge(): Int { return age } fun assignValue(name:String, age: Int) { this.name = name this.age = age } } ... val user = User(\u0026#34;Aditya\u0026#34;, 22) We can use init block as well as a constructor class User(name: String, age: Int) { var name: String var age: Int init { name = name age = age } fun getAge(): Int { return age } fun assignValue(name:String, age: Int) { this.name = name this.age = age } } There can be multiple secondary constructor. class User(name: String, age: Int) { var name: String var age: Int constructor(name: String) { this.name = name age = 22 } constructor(name: String, age: Int) { this.name = name this.age = age } } Kotlin Java interoperability Kotlin is compiled as Java when present in backend java project. We can see the equivalent java code by following procedure: We need to check the kotlin bytecode i.e. the code which machine understands We can decompile the bytecode, which reverse engineers it java (source does\u0026rsquo;nt matter) No need to add getter and setter in kotlin, it automatically does that for us. ","permalink":"https://singhaditya8499.github.io/posts/introduction-to-kotlin/","summary":"\u003ch1 id=\"kotlin\"\u003eKotlin\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003eKotlin is a statically typed programming language\u003c/li\u003e\n\u003cli\u003eOfficially supported language by Google for android\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"core-features-of-kotlin\"\u003eCore features of Kotlin:\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003e\u003cstrong\u003eConcise\u003c/strong\u003e: Reduces the amount of boilerplate code\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eSafe:\u003c/strong\u003e Avoid NullPointerException\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eInteroperable\u003c/strong\u003e: Use existing libraries of Java, Android, etc\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eTool friendly\u003c/strong\u003e: Use any existing IDE\u003c/li\u003e\n\u003c/ol\u003e\n\u003ch3 id=\"hello-world\"\u003eHello world!\u003c/h3\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efun\u003c/span\u003e \u003cspan class=\"nf\"\u003emain\u003c/span\u003e\u003cspan class=\"p\"\u003e()\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e    \u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Hello world!\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"variables\"\u003eVariables\u003c/h3\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Hello\u0026#34;\u003c/span\u003e \u003cspan class=\"c1\"\u003e//type inference\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eDouble\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"m\"\u003e23.44\u003c/span\u003e \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"val-vs-var\"\u003eval vs var\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eval is value and var is variable\u003c/li\u003e\n\u003cli\u003eval is nothing but a final value(like Java) which can not be reassigned.\u003c/li\u003e\n\u003cli\u003evar can be reassigned.\u003c/li\u003e\n\u003cli\u003eCan not change the type of a var. It is bounded by its defined type.\u003c/li\u003e\n\u003cli\u003eWe can use lateinit to initialise var later.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003elateinit\u003c/span\u003e \u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003ea\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eWe can not set a null value to a var. We need to use ? operator. This is due to strong null safety check which comes attached with Kotlin.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e?\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"k\"\u003enull\u003c/span\u003e\u003cspan class=\"p\"\u003e;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eTo get a NPE for a var in Kotlin, we need to use !! operator. It makes sure that we receive NPE if it occurs.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e?\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"k\"\u003enull\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003esize\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eInt\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003ea\u003c/span\u003e\u003cspan class=\"o\"\u003e?.\u003c/span\u003e\u003cspan class=\"n\"\u003elength\u003c/span\u003e\u003cspan class=\"o\"\u003e!!\u003c/span\u003e  \u003cspan class=\"c1\"\u003e//throws NPE\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eWe have and elvis operator in Kotlin which is similar to conditional operator. (?:)\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e?\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"k\"\u003enull\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003esize\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eInt\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003ea\u003c/span\u003e\u003cspan class=\"o\"\u003e?.\u003c/span\u003e\u003cspan class=\"n\"\u003elength\u003c/span\u003e \u003cspan class=\"o\"\u003e?:\u003c/span\u003e \u003cspan class=\"m\"\u003e0\u003c/span\u003e   \u003cspan class=\"c1\"\u003e//returns 0 if a.length is null\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eIf we need to concatenate a string to another, there is a smart way to do it in kotlin\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ea\u003c/span\u003e \u003cspan class=\"p\"\u003e+\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e    \u003cspan class=\"c1\"\u003e//prints Aditya Singh\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;\u003c/span\u003e\u003cspan class=\"si\"\u003e$a\u003c/span\u003e\u003cspan class=\"s2\"\u003e Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e     \u003cspan class=\"c1\"\u003e//prints Aditya Singh\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"arrays\"\u003eArrays\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eWe can define array in following ways:\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003earrayOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e4\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e   \n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003earrayOf() uses vararg underneath which tells that we can have n arguements \n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003einside a function.\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003earrayOf\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"n\"\u003eInt\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026gt;(\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e2\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"m\"\u003e4\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003eThis will bind our array with Int type. We cant add any other variable of any\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003eother type inside it.\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003enum\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003eArray\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"m\"\u003e5\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\u003cspan class=\"n\"\u003ei\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"n\"\u003ei\u003c/span\u003e\u003cspan class=\"p\"\u003e*\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e})\u003c/span\u003e    \u003cspan class=\"c1\"\u003e//0 1 2 3 4\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"cm\"\u003e/*\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003eUsing Array constructor\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"cm\"\u003e*/\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e])\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"k\"\u003eget\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"collections\"\u003eCollections\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eBy default in kotlin list is immutable\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyList\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003elistOf\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026gt;(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Hello\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;World\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003emyList\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eadd\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;India\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e    \u003cspan class=\"c1\"\u003e//cant do that as there is no function add()\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eIf we want to add items we need to explicitly define it as mutable. We can use arrayListOf() also in place of mutableListOf().\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyList\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003emutableListOf\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026gt;(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Hello\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;World\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003emyList\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eadd\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eMaps are immutable.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyMap\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003emapOf\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"n\"\u003eInt\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026gt;(\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"m\"\u003e2\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003emyMap\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e\u003cspan class=\"p\"\u003e])\u003c/span\u003e    \u003cspan class=\"c1\"\u003e//this will print \u0026#34;Aditya\u0026#34;\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyMap\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003emapOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;surname\u0026#34;\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e   \u003cspan class=\"c1\"\u003e//to use different keys\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eIf we want mutable map, we use hash map.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyMap\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003ehashMapOf\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"m\"\u003e1\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;surname\u0026#34;\u003c/span\u003e \u003cspan class=\"n\"\u003eto\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003emyMap\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"k\"\u003eset\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;country\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;India\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e     \u003cspan class=\"c1\"\u003e//add a new key value pair\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"n\"\u003emyMap\u003c/span\u003e\u003cspan class=\"p\"\u003e[\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;country\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e]\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;India\u0026#34;\u003c/span\u003e        \u003cspan class=\"c1\"\u003e//we can do something like this as well\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"loops\"\u003eLoops\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eForeach\u003c/strong\u003e loops works with list, array, map. It iterates over the entire set of items and give the output.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003eval\u003c/span\u003e \u003cspan class=\"py\"\u003emyList\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"n\"\u003elistOf\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026lt;\u003c/span\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e\u003cspan class=\"p\"\u003e\u0026gt;(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Hello\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;World\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e,\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"n\"\u003emyList\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"n\"\u003eforEach\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"k\"\u003eit\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"k\"\u003eit\u003c/span\u003e\u003cspan class=\"p\"\u003e))\u003c/span\u003e   \u003cspan class=\"c1\"\u003e//prints all items\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003efor loop\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efor\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ename\u003c/span\u003e \u003cspan class=\"k\"\u003ein\u003c/span\u003e \u003cspan class=\"n\"\u003elistOfNames\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ename\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e           \u003cspan class=\"c1\"\u003e//print every item in list\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efor\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"n\"\u003ex\u003c/span\u003e \u003cspan class=\"k\"\u003ein\u003c/span\u003e \u003cspan class=\"m\"\u003e0.\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\u003cspan class=\"m\"\u003e10\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ex\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e       \u003cspan class=\"c1\"\u003e//prints all value from 0 to 10 inclusive\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efor\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"n\"\u003ex\u003c/span\u003e \u003cspan class=\"k\"\u003ein\u003c/span\u003e \u003cspan class=\"m\"\u003e0\u003c/span\u003e \u003cspan class=\"n\"\u003euntil\u003c/span\u003e \u003cspan class=\"m\"\u003e10\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ex\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e       \u003cspan class=\"c1\"\u003e//prints all value from 0 to 10, excludes 10\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efor\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"n\"\u003ex\u003c/span\u003e \u003cspan class=\"k\"\u003ein\u003c/span\u003e \u003cspan class=\"m\"\u003e0\u003c/span\u003e \u003cspan class=\"n\"\u003euntil\u003c/span\u003e \u003cspan class=\"m\"\u003e10\u003c/span\u003e \u003cspan class=\"n\"\u003estep\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ex\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e       \u003cspan class=\"c1\"\u003e//prints 0 3 6 9\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efor\u003c/span\u003e \u003cspan class=\"p\"\u003e(\u003c/span\u003e \u003cspan class=\"n\"\u003ex\u003c/span\u003e \u003cspan class=\"k\"\u003ein\u003c/span\u003e \u003cspan class=\"m\"\u003e10\u003c/span\u003e \u003cspan class=\"n\"\u003edownTo\u003c/span\u003e \u003cspan class=\"m\"\u003e0\u003c/span\u003e \u003cspan class=\"n\"\u003estep\u003c/span\u003e \u003cspan class=\"m\"\u003e3\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ex\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e       \u003cspan class=\"c1\"\u003e//prints 10 7 4 1\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch3 id=\"keywords\"\u003eKeywords\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003ein\u003c/code\u003e is check inclusiveness\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"when\"\u003eWhen\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eIt is similar to switch statement of C++. We dont iterate over all the condition like we do in if-else.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003evar\u003c/span\u003e \u003cspan class=\"py\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e\u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"p\"\u003e=\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003ewhen\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003ea\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Aditya\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e     \u003cspan class=\"c1\"\u003e//will print this\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"c1\"\u003e\u003c/span\u003e\t\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e \u003cspan class=\"o\"\u003e-\u0026gt;\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Singh\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"k\"\u003eelse\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\t\u003cspan class=\"n\"\u003eprintln\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"s2\"\u003e\u0026#34;Other\u0026#34;\u003c/span\u003e\u003cspan class=\"p\"\u003e)\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"o\"\u003e..\u003c/span\u003e\u003cspan class=\"p\"\u003e.\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003eWhen can return a value as well.\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch3 id=\"functions\"\u003eFunctions\u003c/h3\u003e\n\u003cul\u003e\n\u003cli\u003eThe structure of functions is very similar to C++ or Java.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-kotlin\" data-lang=\"kotlin\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"k\"\u003efun\u003c/span\u003e \u003cspan class=\"nf\"\u003efunctionName\u003c/span\u003e\u003cspan class=\"p\"\u003e(\u003c/span\u003e\u003cspan class=\"n\"\u003evariable\u003c/span\u003e\u003cspan class=\"p\"\u003e:\u003c/span\u003e \u003cspan class=\"n\"\u003eInt\u003c/span\u003e\u003cspan class=\"p\"\u003e):\u003c/span\u003e \u003cspan class=\"n\"\u003eString\u003c/span\u003e \u003cspan class=\"p\"\u003e{\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\t\u003cspan class=\"k\"\u003ereturn\u003c/span\u003e \u003cspan class=\"s2\"\u003e\u0026#34;\u003c/span\u003e\u003cspan class=\"si\"\u003e$variable\u003c/span\u003e\u003cspan class=\"s2\"\u003e was passed\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"p\"\u003e}\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eTypes of arguements:\u003c/p\u003e","title":"Introduction to Kotlin"},{"content":"The most basic in human psychology is \u0026ldquo;Why do we talk?\u0026rdquo;.\nI have always been a shy kid in front of people I don\u0026rsquo;t know. I have seen my friends talking for hours with their friends, some with their girlfriends. Then I joined Amazon, still struggling to have an informal talk. To undestand why this is happing to me I started looking around and came across this wonderful theory of Transactional analysis by Eric Berne.\nBasics of Transactional Analysis Every person have 3 states in him/her, what we call as ego states. These 3 ego states are Parent, Adult and Child.\nParent: Our parents have different reactions to situation. This ego states comprises of all those situation and how our parents reacted to it. Adult: This is considered to be the most stable state. We look at a situation and response accordingly. Child: This ego state comprises of all occurences how our parents taught us or how we responded to those situation when we were very young. Eric said that every conversation is a transaction. Suppose I am talking to my friend Vivek. I say \u0026ldquo;Hi\u0026rdquo; which let us assume have a value of X. Now since I have given him some sort of value X, I assume that he would also give me something equivalent to it. Now Vivek can say \u0026ldquo;Hi\u0026rdquo; back, he can give emotional support in case I am sad or he can choose to ignore. If Vivek chooses to ignore, I will have an emotion anger or sadness based on what ego state I was when I did that transaction and what situation matches that scenario in that particular ego state.\nConflict arises when there is cross transaction. Suppose 2 people, lets call them A and B are talking. A is the boss of B. B had underperformed in previous quarter. A says to B that you should focus on your skills to excel in future. A had said this from parent ego state to the child ego state of B. In this scenario if B replies from adult(most stable and logical state) or child state, there would be no conflict. He can reply as \u0026ldquo;Yes you are right, I will try to focus more on my skills\u0026rdquo;. But if B replies from parent ego state then there would be a conflict which can result in anger in person A. We should always try to be in adult ego state to avoid conflict which is very very difficult.\nDifferent types of conversation According to Eric there are 6 different ways in which people spend their time in conversation. These are:\nWithdrawl Ritual Pastime Activities Games Intimacy You can google to know more about them. Here we will talk about Games only because these are the most imteresting ones.\nGames We will be only talking about conversation of two people. In these types of converstaion one person have a hidden psychological agenda which he may or may not know about. Every games have these 3 neccessary requirements:\nCon: He/She is the one with the hidden psychological agenda. Agenda can be a anything i.e. emotional imbalance, feeling of superiority, etc. Gimmick: The insecurity of the other person which the con uses to complete his/her agenda. Payoff: This is what the con wins, in some cases both the parties win something from the game. Lets take a look at one of the games Why don't you?...Yes but..\nWhy don\u0026rsquo;t you?.. - Yes but.. Suppose two people are discussiong about a programming problem. Person A asks B that he is not able to solve a problem. This is how the conversation goes:\nA: I am not able to solve this problem. B: Why dont you ask Amit? He has solved this before. A: Yes but it appears he is too busy. B: Ok, why don\u0026rsquo;t you try solution X? A: Yes but, I dont have the permission. B: You can try performing Y A: Yes but I dont think it would work. This would go on and on till B dont have any solution. A here is the con, the gimmick was the inability of B to say that A should try first before giving absurd reasons to not doing it. The payoff is that A believes that the problem is not solvable or he wanted to see B\u0026rsquo;s inability to solve an issue. Again this might not be a known agenda of A.\nThere are many other social games which Eric proposed. There are games we play in our day to day life and are not able to see them. I have seen people play many other transactional games as well, will not disclose them here beacuse even I want to have a larger chunk of the transaction we might have in the future.\n","permalink":"https://singhaditya8499.github.io/posts/transactional-analysis/","summary":"\u003cp\u003eThe most basic in human psychology is \u0026ldquo;Why do we talk?\u0026rdquo;.\u003c/p\u003e\n\u003cp\u003eI have always been a shy kid in front of people I don\u0026rsquo;t know. I have seen my friends talking for hours with their friends, some with their girlfriends. Then I joined Amazon, still struggling to have an informal talk. To undestand why this is happing to me I started looking around and came across this wonderful theory of Transactional analysis by Eric Berne.\u003c/p\u003e","title":"Transactional Analysis - Short introduction"},{"content":"Is there a scale or value which dictates that its time to give up!\nI saw this tag of FFT while solving a problem. FFT is fast fourier transform, which helps to multiply polynomial in O(nlogn) time complexity (one of its use case). I read about it in detail and then picked up another problem to implement FFT which would give confidence to solve these kind of problem in future. Its been 2 days and I am still not able to solve the problem. I realised maybe its time to give up on this problem and look for its solution, but on the other hand it feels that I am very close to solving it. I am not able to decide whether to give up or keep pushing myself. Is there an algorithm to know or a parameter to judge, so that we know that its time to give up!\nWe experience situation which isn\u0026rsquo;t working for us and we wonder if I should persevere a little longer, afterall we always hear people saying \u0026ldquo;Never give up!\u0026rdquo;. Staying too long with something not showing desired result can take away other aspects of your life. Even Isaac Newton wasted several years of his life chasing the secret code hidden in Bible to convert lead to gold. If he had known the algorithm or a parameter to know when is the time to give up, he could have made several other discoveries.\nI understand numbers and figures better than anything. I researched about finding a quantitative value to determine the near accurate time for giving up, but every search query somehow finally take me to n signs its time to give up on your crush results. I am not able to find anything concrete which can distinguish the line between giving up and staying put.\nIts pretty funny that I am not able to end this post. Afterall, it\u0026rsquo;s not neccessary to complete every post, every story or solve every problem. I will define the perfect ending/solution. Till then I am not giving up! Happy FFT.\n","permalink":"https://singhaditya8499.github.io/posts/when-to-give-up/","summary":"\u003cp\u003eIs there a scale or value which dictates that its time to give up!\u003c/p\u003e\n\u003cp\u003eI saw this tag of FFT while solving a problem. FFT is fast fourier transform, which helps to multiply polynomial in\nO(nlogn) time complexity (one of its use case). I read about it in detail and then picked up another problem to implement FFT which would give confidence to solve these kind of problem in future. Its been 2 days and I am still not able to solve the problem. I realised maybe its time to give up on this problem and look for its solution, but on the other hand it feels that I am very close to solving it. I am not able to decide whether to give up or keep pushing myself. Is there an algorithm to know or a parameter to judge, so that we know that its time to give up!\u003c/p\u003e","title":"When to give up?"},{"content":"I am a software engineer focused on building practical AI-powered products and distributed systems that can scale in real production environments. Over the last 4+ years, I have worked across pricing automation, conversational systems, and backend performance, with an emphasis on fast execution, reliable architectures, and measurable customer impact.\nLife Journey Life Journey 2025 - Present\nSeattle chapter Building at AWS, learning deeply about AI systems and distributed architecture.\n2022 - 2024\nGraduate school + industry transition Completed M.S. in Computer Science at George Washington University while growing into senior engineering ownership.\n2020 - 2022\nFoundation years at Amazon Started professional software engineering journey and developed strong production engineering fundamentals.\nPre-2020\nEarly builder years Competitive programming, hackathons, and research-oriented learning shaped my problem-solving style.\n","permalink":"https://singhaditya8499.github.io/about/","summary":"\u003cp\u003eI am a software engineer focused on building practical AI-powered products and distributed systems that can scale in real production environments. Over the last 4+ years, I have worked across pricing automation, conversational systems, and backend performance, with an emphasis on fast execution, reliable architectures, and measurable customer impact.\u003c/p\u003e\n\u003ch2 id=\"life-journey\"\u003eLife Journey\u003c/h2\u003e\n\u003cdetails class=\"timeline-collapse\" open\u003e\n  \u003csummary\u003eLife Journey\u003c/summary\u003e\n  \u003cdiv class=\"timeline\"\u003e\n    \u003cdiv class=\"timeline-item\"\u003e\n      \u003cp class=\"timeline-date\"\u003e2025 - Present\u003c/p\u003e\n      \u003ch4\u003eSeattle chapter\u003c/h4\u003e\n      \u003cp\u003eBuilding at AWS, learning deeply about AI systems and distributed architecture.\u003c/p\u003e\n    \u003c/div\u003e\n    \u003cdiv class=\"timeline-item\"\u003e\n      \u003cp class=\"timeline-date\"\u003e2022 - 2024\u003c/p\u003e","title":"About"},{"content":"Open to software engineering opportunities and technical collaborations.\nLocation: Bellevue, WA Email: singh.aditya8499@gmail.com Phone: +1 (571) 547-7518 GitHub: github.com/singhaditya8499 LinkedIn: linkedin.com/in/singhaditya8499 ","permalink":"https://singhaditya8499.github.io/contact/","summary":"\u003cp\u003eOpen to software engineering opportunities and technical collaborations.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eLocation: Bellevue, WA\u003c/li\u003e\n\u003cli\u003eEmail: \u003ca href=\"mailto:singh.aditya8499@gmail.com\"\u003esingh.aditya8499@gmail.com\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003ePhone: \u003ca href=\"tel:+15715477518\"\u003e+1 (571) 547-7518\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eGitHub: \u003ca href=\"https://github.com/singhaditya8499\"\u003egithub.com/singhaditya8499\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eLinkedIn: \u003ca href=\"https://www.linkedin.com/in/singhaditya8499/\"\u003elinkedin.com/in/singhaditya8499\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e","title":"Contact"},{"content":"Work Experience Amazon Web Services Role: Software Development Engineer II\nTeam: AWS Connect\nDuration: Dec 2025 - Present\nLocation: Seattle, WA\nWork Summary: I work on the Authentication and Authorization team for Amazon Connect, a cloud-based contact center platform that generates revenue through usage-based services such as voice, chat, and AI-powered customer support. My work focuses on designing secure access boundaries for different user types—agents, customers, admins, supervisors, and AI agents—while implementing advanced security mechanisms and modern cryptographic methods to keep the platform safe and reliable. Amazon Role: Software Development Engineer II\nTeam: Global Logistics Pricing Tech\nDuration: Jan 2025 - Dec 2025\nLocation: Bellevue, WA\nWork Summary: Built scalable AI-driven pricing systems for global logistics, collaborating with science and analytics teams to deliver intelligent transportation pricing. Developed an AI-assisted price-setting platform that reduced pricing turnaround from 5 days to 2 hours and introduced program-level differentiation reducing shipment costs by $600 per order. Improved reliability and efficiency through resilient validation layers, automated DLQ recovery, and infrastructure optimizations achieving 80% lower latency and 30% faster builds. Led large-scale pricing pipeline migrations for regional resilience and explored dynamic bidding models to monetize unused container capacity.\nEAB Role: Software Engineer\nTeam: Data \u0026 Platform Engineering\nDuration: Jul 2024 - Jan 2025\nLocation: Washington, DC\nWork Summary: Built scalable LLM-powered systems including a token usage tracking platform for tenant-level analytics and cost optimization, and an asynchronous AWS Lambda-based QA pipeline to handle large data workloads. Improved chatbot reliability and accuracy (50% → 80%) through prompt engineering, automated feedback loops, robust error handling, and optimized SQL query generation. Strengthened system quality and performance by integrating SONAR checks in CI/CD and designing efficient database schemas for conversational AI workflows.\nASANTe Role: Lead Software Engineer\nDuration: Jun 2023 - Jun 2024\nLocation: Boulder, CO\nWork Summary: Developing a decentralized private blockchain network to enable secure exchange of social currency between participants.\nAmazon Role: Software Development Engineer\nTeam: Global Logistics Account Receivables\nDuration: Jul 2020 - Jul 2022\nLocation: Hyderabad, India\nWork Summary: Developed cross-border logistics solutions including Amazon Small Parcel Air Express for global B2B shipments to Amazon Fulfillment Centers supporting fast Prime deliveries. Also contributed to Amazon Z-Parcel, a B2C cross-border shipping service that is faster and 21% cheaper than competitors, focusing on invoicing, shipment management, and tracking systems.\nT-Systems Role: Software Development Engineer Intern\nDuration: May 2019 - August 2019\nLocation: Gurgaon, India\nWork Summary: Built an internal support tool that reconstructs user journeys by analyzing application and system logs, enabling operators to diagnose issues faster and significantly reduce customer query resolution time.\nErcess Live Role: Software Development Engineer Intern\nDuration: October 2018 - December 2018\nLocation: Noida, India\nWork Summary: Developed automated web scraping pipelines using Python and Selenium to collect event data from multiple websites, handling edge cases and periodically storing the processed data in a database to support the core events platform.\nSuccessive Digital Role: Software Development Engineer Intern\nDuration: May 2017 - August 2017\nLocation: Noida, India\nWork Summary: Built a smart attendance system using real-time face recognition with Python and OpenCV, addressing common issues in traditional attendance systems. Integrated SendGrid to automate reporting and notifications.\nTop Skills Distributed Systems\nSystem Design\nAWS\nGo\nJava\nPython\nLLM Applications\nRAG\nLangChain\nMachine Learning\nComputer Vision\nSpring Boot\nElasticsearch\nAPI Design\nCI/CD\n","permalink":"https://singhaditya8499.github.io/work/","summary":"\u003ch2 id=\"work-experience\"\u003eWork Experience\u003c/h2\u003e\n\u003cdiv class=\"work-cards\"\u003e\n  \u003cdiv class=\"work-card\"\u003e\n    \u003cdiv class=\"work-card-head\"\u003e\n      \u003cimg src=\"../images/logos/aws.svg\" alt=\"Amazon Web Services logo\" class=\"work-logo\" /\u003e\n      \u003ch4\u003eAmazon Web Services\u003c/h4\u003e\n    \u003c/div\u003e\n    \u003cp\u003e\u003cstrong\u003eRole:\u003c/strong\u003e Software Development Engineer II\u003c/p\u003e\n    \u003cp\u003e\u003cstrong\u003eTeam:\u003c/strong\u003e AWS Connect\u003c/p\u003e\n    \u003cp\u003e\u003cstrong\u003eDuration:\u003c/strong\u003e Dec 2025 - Present\u003c/p\u003e\n    \u003cp\u003e\u003cstrong\u003eLocation:\u003c/strong\u003e Seattle, WA\u003c/p\u003e\n    \u003cp\u003e\u003cstrong\u003eWork Summary:\u003c/strong\u003e I work on the Authentication and Authorization team for Amazon Connect, a cloud-based contact center platform that generates revenue through usage-based services such as voice, chat, and AI-powered customer support. My work focuses on designing secure access boundaries for different user types—agents, customers, admins, supervisors, and AI agents—while implementing advanced security mechanisms and modern cryptographic methods to keep the platform safe and reliable. \u003c/p\u003e","title":"Work"}]