Introducing a web collection of programming idioms in a variety of languages. How useful is that?
Programming Idioms collects useful code snippets for day to day usage at work. The same snippet is presented in more than 20 languages so that you can make useful comparisons when working in multiple languages or want to learn a new one by observing how the constructs are mapped between the languages.
An example will make it more clear. A popular snippet among beginners is for instance "Print Hello 10 times". We find that in C you can do it as following:
#include <stdio.h> for (int i = 0; i < 10; i++) { printf("Hello\n"); }In Perl:
print "Hello\n" x 10;
while in Java as :
import static java.lang.System.out; for (int i = 0; i++ < 10; out.println("Hello"));
For each snippet and for each language representation there are links provided to the official documentation and to Replit code spaces so that you can try them out yourself.
Other idioms presented are :
Create a function
Check if string contains only digits
Launch 1000 parallel tasks and wait for completion
Join a list of strings
Check if string contains a word
Create a 2-dimensional array
Shuffle a list
Iterate over list indexes and values
Create a 2D Point data structure
but there's a total of 300 idioms at the time of writing. The list is constantly expanding and accepts contributions too.
A very hardy feature is that of the Cheatsheet, where you can find all the snippets administered under a language as well as check all the implementations for 2 languages side-by-side as a long one-pager list.
Some would say, "is something like that relevant now in the age of LLMs when can you ask them just about any coding question?"
That's like saying that Wikipedia nowadays has no value. But is it so?
A collection site like this is useful in cases when don't want to wait for the LLM to formulate its answer which could span multiple paragraphs. I need the information asap and as straightforward as possible.
Yet another advantage of a Wikipedia-like site like this over a chatbot is when I don't want to look up something specific but instead want to casually browse the site to discover terms that I was totally unaware of just, or discover terms related to a topic that I'm doing research on. Plus I'm sure that the information presented is factual and not a figment of hallucination.
Robot vacuum cleaners swept the floor at CES 2025 and while this might not seem very exciting, think again. Adding AI to these everyday home helpers has already made them more efficient at what they d [ ... ]
Today we celebrate the birth of Charles Babbage, the man who invented calculating machines that, although they were never realized in his lifetime, are rightly seen as the forerunners of modern progra [ ... ]
A web collection of programming idioms in a variety of languages. How useful is that? Programming Idioms collects useful code snippets for day to day usage at work. The same snippet is presented in more than 20 languages so that you can make useful comparisons when working in multiple languages or want to learn a new one by observing how the constructs are mapped between the languages. An example will make it more clear. A popular snippet among beginners is for instance "Print Hello 10 times". We find that in C you can do it as following: #include <stdio.h>for (int i = 0; i < 10; i++) {printf("Hello\n");} In Perl: print "Hello\n" x 10; while in Java as : import static java.lang.System.out;for (int i = 0; i++ < 10; out.println("Hello")); For each snippet and for each language representation there are links provided to the official documentation and to Replit code spaces so that you can try them out yourself. Other idioms presented are : Create a functionCheck if string contains only digitsLaunch 1000 parallel tasks and wait for completionJoin a list of stringsCheck if string contains a wordCreate a 2-dimensional arrayShuffle a listIterate over list indexes and valuesCreate a 2D Point data structurebut there's a total of 300 idioms at the time of writing. The list is constantly expanding and accepts contributions too. A very hardy feature is that of the Cheatsheet, where you can find all the snippets administered under a language as well as check all the implementations for 2 languages side-by-side as a long one-pager list.
Some would say, "is something like that relevant now in the age of LLMs when can you ask them just about any coding question?" That's like saying that Wikipedia nowadays has no value. But is it so? A collection site like this is useful in cases when don't want to wait for the LLM to formulate its answer which could span multiple paragraphs. I need the information asap and as straightforward as possible. Yet another advantage of a Wikipedia-like site like this over a chatbot is when I don't want to look up something specific but instead want to casually browse the site to discover terms that I was totally unaware of just, or discover terms related to a topic that I'm doing research on. Plus I'm sure that the information presented is factual and not a figment of hallucination.
Robot vacuum cleaners swept the floor at CES 2025 and while this might not seem very exciting, think again. Adding AI to these everyday home helpers has already made them more efficient at what they d [ ... ]
Today we celebrate the birth of Charles Babbage, the man who invented calculating machines that, although they were never realized in his lifetime, are rightly seen as the forerunners of modern progra [ ... ]