Questions tagged [language-comparisons]

Questions comparing two or more programming or markup languages against each other.

Usage guidance

Questions and answers on Stackoverflow are generally intended to discuss specific features with one or more repeatable and unambiguous solutions.

Consequently, the language-comparisons tag is intended to cover cases where:

  • two or more languages implement the same or substantially similar functionality
  • the functionality comparison is capable of unambiguous identification and resolution
  • such resolution does not require extended discussion or rely solely on subjective personal opinions or personal preference
124 questions
10
votes
6 answers

How would you write this Clojure snippet in Ruby and/or Haskell?

I was working on a Rails template and was trying to write a bit of code that allows me to populate a table or multiple columns of ul tags "top-to-bottom" and "left-to-right" across however many columns I specify. I'm just getting the hang of Ruby so…
dnolen
  • 18,496
  • 4
  • 62
  • 71
10
votes
6 answers

What do I learn to "enlighten myself with the ways" of functional programming?

I've been coding for a few years now, nothing too complicated. C++ is what I know best. I recently stumbled into Paul Graham's site, coding horror, and now here. What do I learn to "enlighten myself with the ways" of functional programming? Haskell,…
Karthick
  • 4,456
  • 7
  • 28
  • 34
10
votes
1 answer

PHP equivalent to python's triple-quotes - How to print bulk / lots of HTML within PHP without escaping

Possible Duplicate: php string escaping like python’s “”“ ”“”? The triple-quotes in python escapes all quotes and newlines contained within. For example, """ this is all just one string. I can even tell you "I like pi". Notice that the single…
Alex Spencer
  • 834
  • 2
  • 12
  • 23
10
votes
4 answers

Equivalent of .NET's WebClient and HttpWebRequest in Java?

.NET has the HttpWebRequest and WebClient classes for simulating a browser's requests. I'd google it, but I'm not sure what keyword to use. I want to write code that does does HTTP GETs and POSTs, along with cookies, in an applet or local .jar and…
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
9
votes
7 answers

Does Java have a default copy constructor (like in C++)?

Does Java has a default copy constructor as C++? If it has one - does it remain usable if I declare another constructor (not a copy constructor) explicitly?
8
votes
3 answers

Verbally format a number in Python

How do pythonistas print a number as words, like the equivalent of the Common Lisp code: [3]> (format t "~r" 1e25) nine septillion, nine hundred and ninety-nine sextillion, nine hundred and ninety-nine quintillion, seven hundred and seventy-eight…
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290
8
votes
3 answers

Ruby string interpolation equivalent to python's .format()

In python I can do _str = "My name is {}" ... _str = _str.format("Name") In ruby when I try _str = "My name is #{name}" The interpreter complains that the variable name is undefined, so it's expecting _str = "My name is #{name}" => {name =:…
Sam Hammamy
  • 10,819
  • 10
  • 56
  • 94
7
votes
2 answers

Why is this Haskell code so slow?

I'm kind of new to Haskell and tried making a scrabble solver. It takes in the letters you currently have, finds all permutations of them and filters out those that are dictionary words. The code's pretty simple: import Data.List main = do …
nilcit
  • 483
  • 1
  • 5
  • 12
7
votes
2 answers

What is the equivalent of SQL's IN keyword in R?

In SQL, you can easily avoid multiple OR conditions if you're looking for many values of a particular variable (column) by using IN. For example : SELECT * FROM colors WHERE color in ('Red', 'Blue', 'Green') How would I do that in R? I am currently…
user3422637
  • 3,967
  • 17
  • 49
  • 72
7
votes
6 answers

ASP.NET - C# vs VB.NET - Indirect differences and things you might not initially consider

I'm not interested in starting another "who has the bigger member" VB vs C# debate (https://stackoverflow.com/questions/158229/what-are-the-pros-of-vb-net seems to cover that already) though I am interested in indirect differences which may…
nathanchere
  • 8,008
  • 15
  • 65
  • 86
7
votes
5 answers

How does Smalltalk (Pharo for example) compare to Python?

I've seen some comparisons between Smalltalk and Ruby on the one hand and Ruby and Python on the other, but not between Python and Smalltalk. I'd especially like to know what the fundamental differences in Implementation, Syntax, Extensiabillity and…
6
votes
3 answers

What are the differences of Array and Hash in PHP?

What are the differences of an Array and a Hash PHP? An array: array(1,2,3...) A hash: array(key1=value1, key2=value2, ...) are they different or the same? ※ For example, will the function arguments allows array be effective for the hash?…
freddiefujiwara
  • 57,041
  • 28
  • 76
  • 106
6
votes
8 answers

Why doesn't Java have a way of specifying unescaped String literals?

In C#, if you want a String to be taken literally, i.e. ignore escape characters, you can use: string myString = @"sadasd/asdaljsdl"; However there is no equivalent in Java. Is there any reason Java has not included something similar? Edit: After…
shsteimer
  • 28,436
  • 30
  • 79
  • 95
6
votes
1 answer

What is Python's *Args and **kwargs equivalent in PHP?

Lord Google isn't giving me anything besides something about declaring optional variables with a value so they can be passed into the code without giving you an error. Is there even an equivalent of *Args or **kwargs in PHP? Cheers
6
votes
3 answers

Is there .Net TypeConverter equivalent in Java

In .NET when I had a "value" that could exist as multiple types I could easily use a TypeConverter for switching between those types (currency types, xml data vs object representation, ect). In Java, I am not sure what the preferred way to handle…
insipid
  • 3,238
  • 3
  • 26
  • 38
1 2 3
8 9