Just shipped a 25 category function test suite for Chuks programming language. One file. One golden output. Every way you can write a function in the language, exercised end-to-end. Here's what's covered: → All arrow forms: expression body, block body, zero-param, single-param → Named declarations, anonymous expressions, IIFEs → Default & optional parameters → Function type annotations and arrow type annotations in param/return positions → Higher-order functions: compose, factories, twice → Closures: counter pattern, multi-var capture, mutable shared state via getter/setter pairs → Nested functions: 2-level and 3-level deep → Recursion: fib, sumTo → Generic classes & methods: Box<T>, map<U>, Pair<A,B> → Async functions with await → Class methods: chaining, closures from methods, static → Functions in data structures: arrays and maps of functions → Callbacks: .map(), .filter(), .reduce() using all function styles → Currying: 3-level chain → Void functions, mixed parameter types, functions as arguments This isn't just a test suite, it's a living spec. If you want to understand what Chuks functions look like, this file is the answer. Follow ChuksLang on X for more: https://lnkd.in/egzWUUmR Visit chuks.org to try Chuks #ProgrammingLanguages #Compilers #softwareEngineering #Chukslang #programming
Chuks Programming Language Function Test Suite Released
More Relevant Posts
-
🚀 DSA Day 47 – LeetCode Problem 300: Longest Increasing Subsequence (LIS) Today’s problem was a classic and super important one in Dynamic Programming 📈 🔍 Problem Insight: Given an array of integers, the goal is to find the length of the longest strictly increasing subsequence. 💡 Key Approaches: 1️⃣ Dynamic Programming (O(n²)) For each element, check all previous elements Build a dp[] array where dp[i] stores LIS ending at index i 2️⃣ Optimized Binary Search Approach (O(n log n)) Maintain a temporary list (tails) Use binary search to replace elements and keep the list sorted Length of this list = LIS length ⚡ Why optimization works? We don’t need the actual subsequence — just the length. So we maintain the smallest possible tail for increasing subsequences of each length. 🧠 What I Learned: Difference between brute DP and optimized approach Using binary search in unexpected ways Importance of LIS in many advanced problems 💻 Time Complexity: DP: O(n²) Optimized: O(n log n) 📦 Space Complexity: O(n) Slowly building strong fundamentals 💪 — consistency > intensity! #DSA #LeetCode #DynamicProgramming #BinarySearch #CodingJourney #100DaysOfCode #TechGrowth
To view or add a comment, sign in
-
-
🚨 C# Concept That Often Creates Confusion When learning method overloading, one question often comes up: 👉 If two methods have the same parameters but different return types, is that considered method overloading? Let's look at an example: public int Calculate(int a, int b) { return a + b; } public string Calculate(int a, int b) { return (a + b).ToString(); } At first glance, it may look like method overloading, because the return types are different. However, in C# this is not valid. The compiler will throw a compile-time error because both methods have the same method signature. In C#, method overloading is determined by: ✔ Method name ✔ Number of parameters ✔ Parameter types ✔ Parameter order ⚠️ Return type is NOT considered when determining method overloading. So the compiler treats both methods as the same definition. ✅ Valid example of method overloading public int Calculate(int a, int b) { return a + b; } public int Calculate(int a, int b, int c) { return a + b + c; } Here the parameter list is different, so the methods can coexist. 💡 Key takeaway In C#, two methods cannot be differentiated only by return type. If the method name and parameters are identical, it will result in a compile-time error. #CSharp #DotNet #SoftwareDevelopment #CodingMistakes #ProgrammingTips #CodingLife #LearnToCode #DeveloperCommunity #MethodOverloading #SoftwareEngineering #VisualStudio
To view or add a comment, sign in
-
-
DSA series... 🚀 Chapter 3: "Sliding Window Dynamic" LeetCode #3 (Level: Medium) Longest Substring Without Repeating Characters... 🧐 At first glance, this looks like a string problem … Especially substring problem, without any doubts move to Sliding Window (Dynamic) ... 🔥 Sliding Window (Dynamic) ... ⚡ - Just move your right pointer to expand until you hit your goal, then pull your left pointer to shrink and find the optimal size. Explanation ... ✍️ 1⃣ Get the length and check the edge condition. 2⃣ Use two pointers `left` and `right`. Keep a set/map to track characters existence. 3⃣ Move `right` pointer to add characters on the string when the character is not duplicate one. 4⃣ If duplicate found, move `left pointer` to remove characters until duplicate is gone. 5⃣ Track max length during the process. --- Difference between Sliding Window Fixed vs Dynamic Programming ... 👇 ** On Fixed, we decrement 'left' pointer only once when contition met. Use if statement. ** On Dynamic Programming, we decrement 'left' pointer untill reach the condition fully met on the current window. Use while statement. Note: But sometimes it may be differ... You can see that difference from the previous chapter and the current one ... ❗ --- Easy Trigger to Remember for this pattern usage ... 😎 👉 “Longest substring without repeating characters”, 👉 “At most / no duplicate”. --- Key Insights ... 🎯 - Don’t restart the loop when duplicate appears, - Just shrink the window smartly that saves time (O(n)). Just put on your thoughts or suggestions ... 💬 Stay tuned always ... 😎 #LeetCode #SlidingWindow #DSA #CodingInterview #Java #ProblemSolving #Algorithms #TechLearning #SoftwareEngineering
To view or add a comment, sign in
-
-
I love when a simple function hides something much deeper. 🧩 Look at this: f(n) = n + diff Seems easy, right? But here's the catch — diff isn't fixed. It repeats: 5 → 4 → 3 → 2 → 1 → 0 → 5 → 4 → ... So the real puzzle is: which diff applies to which n? --- Here's what I found when I dug into it: 🔁 One line of code solves everything: diff = [5,4,3,2,1,0][n % 6] 📌 Every 6th number is a FIXED POINT — f(n) = n (the output equals the input) 🔀 Some sequences hide TWO rules taking turns: 2 → 6 → 7 → 21 → 22 → 66 → ? (×3, then +1, then ×3, then +1...) 📈 Some patterns grow in the differences, not the values: 1→2, 2→4, 3→7, 4→11, 5→? (+2, +3, +4, +5... so the answer is 16) --- The moment everything clicked: The % (modulo) operator is the key to unlocking repeating patterns in code. Once you see it, you can't unsee it. --- I've put together the full detailed solutions to all 13 questions in simple, easy-to-read English — attached as a PDF below 👇 If you enjoy this kind of logic puzzle, save this post — and try Q3 in the comments before peeking at the PDF! 😄 #Logic #ProblemSolving #Patterns #Programming #Puzzles #CriticalThinking #Coding #MathIsBeautiful
To view or add a comment, sign in
-
🚀 Day 10 of 100 Days LeetCode Challenge Problem: Find All Possible Stable Binary Arrays II Today’s problem is an extension of Day 9—but with optimized Dynamic Programming ⚡ 💡 Key Insight: Same constraints: Fixed number of 0s and 1s No more than limit consecutive identical elements 👉 Which means: We must carefully control streak length And efficiently count all valid combinations 🔍 Approach (Optimized DP): Use DP + Prefix Sum Optimization State includes: Count of 0s used Count of 1s used Ending with 0 or 1 💡 Optimization: Instead of recalculating ranges repeatedly, use prefix sums This reduces time complexity significantly 👉 Apply modulo (10⁹ + 7) for large answers 🔥 What I Learned Today: Same problem can have multiple levels of optimization Prefix sum is powerful in reducing DP transitions Moving from brute → DP → optimized DP is real growth 📈 📈 Challenge Progress: Day 10/100 ✅ Double digits achieved! LeetCode, Dynamic Programming, Prefix Sum, Optimization, Combinatorics, Binary Arrays, DSA Practice, Coding Challenge, Problem Solving #100DaysOfCode #LeetCode #DSA #CodingChallenge #DynamicProgramming #PrefixSum #Optimization #ProblemSolving #TechJourney #ProgrammerLife #SoftwareDeveloper #CodingLife #LearnToCode #Developers #Consistency #GrowthMindset #InterviewPrep
To view or add a comment, sign in
-
-
The SOLID principles are five essential guidelines most powerful foundations for enhance software design. Let’s break it down 👇 🔹 S — Single Responsibility Principle (SRP) A class should have only one reason to change. Keep your code focused and modular. This principle states that "A class should have only one reason to change" which means every class should have a single responsibility and keep your code focused and modular or single purpose within the software system. 🔹 O — Open/Closed Principle (OCP) This principle states that software entities should be open for extension but closed for modification. which means you should be able to extend behavior without breaking existing code. 🔹 L — Liskov Substitution Principle (LSP) According to this principle, "derived or child classes must be able to replace their base or parent classes". This ensures that any subclass can be used in place of its parent class without 🔹 I — Interface Segregation Principle (ISP) Don’t force a class to implement interfaces it doesn’t use. Keep interfaces small and specific. 🔹 D — Dependency Inversion Principle (DIP) Depend on abstractions, Principle in object-oriented design that states that "High-level modules should not depend on low-level modules. Both should depend on abstractions". means "Big parts of your program should not directly depend on small, detailed parts. This improves flexibility and testability. #SOLIDPrinciples #CleanCode #SoftwareEngineering #Python #Django #BackendDevelopment #CodingBestPractices #SystemDesign #Developers #Programming
To view or add a comment, sign in
-
Today, I tackled a classic dynamic programming problem — Minimum Difficulty of a Job Schedule. This challenge really tested my understanding of: - Breaking problems into subproblems (partitioning jobs across days) - Optimizing brute force recursion using memoization - Thinking carefully about state definition (index, days left) Initially, I made a common mistake by trying to accumulate results greedily instead of exploring all valid partitions. Once I corrected that and properly defined the recurrence: 👉 current_day_max + solve(remaining_jobs, remaining_days) things started to click. Key takeaways include: - Always validate your recurrence before optimizing - DP is all about choosing the right state and transitions - Small indexing mistakes (i+1 vs ind+1) can completely break logic This was a valuable exercise in debugging and refining my dynamic programming approach. #LeetCode #DataStructures #Algorithms #DynamicProgramming #ProblemSolving
To view or add a comment, sign in
-
🚀 Day 560 of #750DaysOfCode 🚀 🔍 LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers Today’s problem was a Hard-level DP challenge that really tested optimization and state management 🧠⚡ 💡 Problem Insight: We are typing a word using two fingers on a grid keyboard, and we need to minimize the total movement distance. 👉 Key twist: Both fingers can start anywhere (no initial cost!) At each step, we choose which finger to move ✨ Approach I Used (3D Dynamic Programming): ✔ State: dp[i][j][k] → Minimum cost after typing i characters Finger 1 at letter j Finger 2 at letter k ✔ Transition: Move Finger 1 → cost = distance(j → current char) Move Finger 2 → cost = distance(k → current char) ✔ Take minimum of both choices at every step 💻 Key Optimization: Represent characters as indices (0–25) Use grid math: row = index / 6 col = index % 6 🧠 Learning: This problem is a classic example of: 👉 State compression + decision making at each step 👉 Choosing the optimal path among multiple moving agents ⚡ Complexity: Time: O(n × 26 × 26) Space: O(n × 26 × 26) 💬 Takeaway: When multiple agents (like fingers, robots, etc.) are involved, think in terms of DP states representing positions of each agent. #LeetCode #DSA #DynamicProgramming #Java #CodingJourney #ProblemSolving #Tech #Developers #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 LeetCode 2840 : Check if Strings Can be Made Equal With Operations II 📈 Difficulty: Medium 👀 At first glance this looks like a swap simulation problem… You are allowed to swap characters at indices i and j as long as j - i is even. Unlimited swaps. Anywhere in the string. So it initially feels like we should be able to rearrange the string almost freely. But if you look closely at the condition, there’s a hidden restriction that completely changes the problem. 🧠 Key Insight If j - i is even, then the two indices must have the same parity. even − even = even odd − odd = even even − odd = odd So the only swaps that are actually possible are: • even index ↔ even index • odd index ↔ odd index A character at an even index can never move to an odd index, and vice versa. This means the string is effectively divided into two independent groups: • Even indices: 0, 2, 4, 6, ... • Odd indices: 1, 3, 5, 7, ... Characters can move freely inside their group, but they can never cross between groups. ⚙️ Generalized Way to Think About It Since swaps inside each group are unrestricted, we can generate any permutation within that group. That means the order inside the group no longer matters. So the transformation is possible if and only if: 1️⃣ Characters at even indices in s1 match characters at even indices in s2 2️⃣ Characters at odd indices in s1 match characters at odd indices in s2 In other words, we just need to compare the frequency of characters within each parity group. ⚡ But There’s an Even Cleaner Trick… Instead of building separate structures for both strings: • increment counts using characters from s1 • decrement counts using characters from s2 If every count returns to zero, the two strings contain the same characters within each parity group. Which means the transformation is always possible. ⏱ Complexity Time: O(n) Space: O(1) (fixed alphabet size) 💡 Takeaway Many problems become easier once you identify the invariants created by the allowed operation. Here the invariant is: Index parity never changes. Recognizing this instantly turns a problem that looks like swap simulation into a simple frequency check. #LeetCode #Algorithms #LearningInPublic #SoftwareEngineering #DSA #Programming #ProblemSolving
To view or add a comment, sign in
-
-
📘 Strengthening my knowledge on the 12 Rules of Interface 1️⃣ Interface is a contract 👉 Defines rules that classes must follow ✔ Used for standardization 2️⃣ Cannot create object of interface 👉 Interfaces are incomplete (no full implementation) ❌ new InterfaceName() not allowed 3️⃣ Methods are public & abstract by default 👉 No need to write public abstract ✔ Compiler adds it automatically 4️⃣ Variables are public, static, final 👉 Constant values only ✔ Must be initialized 5️⃣ No constructor in interface 👉 Because object creation is not possible 6️⃣ A class uses implements keyword class A implements InterfaceName 7️⃣ Class must implement all abstract methods 👉 Otherwise class must be declared abstract 8️⃣ Interface supports multiple inheritance 👉 A class can implement multiple interfaces class A implements I1, I2 9️⃣ Interface can extend another interface interface B extends A 🔟 Interface cannot extend a class 👉 Only interfaces can extend interfaces 1️⃣1️⃣ Default methods (JDK 8) 👉 Method with body inside interface ✔ Supports backward compatibility 1️⃣2️⃣ Static methods (JDK 8) 👉 Access using interface name InterfaceName.method() ❌ Not inherited / overridden 🎯 Shortcut Memory Tip 👉 Interface = Contract + Abstract + Constants + JDK8 features #Java #OOP #Interfaces #Programming #Learning #CodingJourney #Developers #TapAcademy
To view or add a comment, sign in
-
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development