Questions tagged [language-comparisons]

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

Filter by
Sorted by
Tagged with
3 votes
2 answers
91 views

Under any Scheme standard, is (let (x y z) x) valid code?

In both Emacs Lisp and Common Lisp, the following returns nil (let (x y z) x) yet in every Scheme that I've tried, it throws an error. Has the above been acceptable under any Scheme standard?
J. Mini's user avatar
  • 1,982
0 votes
1 answer
2k views

Which Java version is the fastest on and is supported by Android?

I heard that Java is becoming faster on newer versions of Android that it's almost as fast as C++, and the performance depends on the type of code/operations. Is this true? If it is, which Java ...
The Amateur Coder's user avatar
2 votes
1 answer
326 views

VBA With statement equivalent in other languages

In VBA there is a cool feature called a With statement that kind of lets you set the global scope for a block of code. This is useful to change multiple fields of an object and to call methods. Here ...
Efraim Newman's user avatar
11 votes
2 answers
10k views

AWS equivalent to Azure Logic Apps

Is there an AWS equivalent to Azure Logic Apps? Furthermore I would like to know if someone has experiences regarding a migration of Azure Integration Services into AWS and if a comparison between ...
Chris's user avatar
  • 495
1 vote
4 answers
3k views

Which programming languages have the most publicly available libraries?

I had assumed that there would be an easy to find list of programming languages sorted by the number of libraries that they have. I have been able to find no such thing. Is there any way to find or ...
J. Mini's user avatar
  • 1,982
0 votes
0 answers
108 views

Re-writing C++ bit manipulation function in Python

I'm attempting to convert some C++ code that I found online that is used for reordering a bitmap to be used with a specific OLED display for a MIDI controller - Akai Fire. The display uses a strange ...
jbflow's user avatar
  • 608
11 votes
2 answers
1k views

What is the difference between the const qualifier in C and the const qualifier in C++?

I´ve found a comment of user R..: C and C++ are not the same language. In particular, C const has nothing to do with C++ const. I know, that one difference between the const qualifier in C and the ...
RobertS supports Monica Cellio's user avatar
19 votes
5 answers
1k views

Ada subtype equivalent in C++

Does C++ offer something similar to Ada's subtype to narrow a type? E.g.: type Weekday is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); subtype Working_Day is Weekday range ...
sornbro's user avatar
  • 243
2 votes
2 answers
167 views

Porting from Ruby to Python: What to do with 'yield'

I currently try to port a piece of code from Ruby to Python to do a bit algorithm research. I have no experience in Ruby and don't know how to handle the 'yield' keyword. The code is for a Myers diff ...
phibel's user avatar
  • 141
2 votes
3 answers
97 views

Ruby equivalent to Python chain()

What is the Ruby equivalent of the chain iterator in python? data_chained = [] data2 = {} data_chained = chain(data_chained, data2) How can this be done in Ruby?
Ashima Sood's user avatar
0 votes
2 answers
644 views

Equivalent of .presence in Python

So, I've been using Ruby on Rails for some time, and I'm wondering if there is something like .presence in Python/Django. Presence returns the receiver if it is present otherwise returns nil. object....
Anthony's user avatar
  • 960
3 votes
2 answers
720 views

Python equivalent of Ruby's .find

I'm trying to implement the following Ruby method into a Python Method: CF = {:metre=>{:kilometre=>0.001, :metre=>1.0, :centimetre=>100.0}, :litre=>{:litre=>1.0, :millilitre=>...
Baxter's user avatar
  • 142
1 vote
2 answers
570 views

visual studio code - language server extension that written in python

I would like to write a visual studio code extension that parse and analyse large log files. I thought to start with language server extension. I would like the server to be written in python. Below, ...
Yoav's user avatar
  • 11
4 votes
1 answer
394 views

Python-like .format() in php

I have the following array: $matches[0] = "123"; $matches[1] = "987"; $matches[2] = "121"; And the following string: $result = "My phone number is {0} and police ...
rossanmol's user avatar
  • 1,633
5 votes
2 answers
17k views

Equivalent of python's encode('utf8') in golang

How can I convert a string in Golang to UTF-8 in the same way as one would use str.encode('utf8') in Python? (I am trying to translate some code from Python to Golang; the str comes from user input, ...
Jim's user avatar
  • 67
6 votes
1 answer
6k views

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

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 *...
HayashiEsme's user avatar
0 votes
1 answer
180 views

Can you achieve 100% code coverage for groovy?

Groovy being strongly typed dynamic language, is it possible to get 100% code coverage for Groovy? If not, can we get as close as possible to Java for code coverage? Are there any better code coverage ...
assignarc's user avatar
20 votes
4 answers
20k views

Does python have an equivalent to Javascript's 'btoa'

I'm trying to find an exact equivalent to javascript's function 'btoa', as I want to encode a password as base64. It appears that there are many options however, as listed here: https://docs.python....
chris's user avatar
  • 1,919
7 votes
2 answers
746 views

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 ...
nilcit's user avatar
  • 483
1 vote
0 answers
72 views

Algebra-and-topology-related type traits, fundamental functions etc. in C++

The C++ standard library has type traits such as is_arithmetic is_integral and is_floating_point, but complex numbers are arithmetic but you can't, say, compare them to each other, no ...
einpoklum's user avatar
  • 121k
0 votes
1 answer
160 views

What's the Ruby equivalent of Perl's s{}{}e?

I'm trying to rewrite a command to replace output files with the same files in a different directory, building up a translation map. In Perl I could do something like this: s{(-o|--out)\s((?:\S+\/)?(\...
android.weasel's user avatar
1 vote
1 answer
2k views

Perl to python shift translation

I am a student learning Python as well as Perl. In our Perl program we used the code my $param = shift; my %local_hash = %$param; when translating Perl to Python what would be the most similar way ...
Robert's user avatar
  • 47
0 votes
1 answer
177 views

Is there any way to access variable like $var (similar to shell scripting) in python?

Hi I'm new to python programming. I want to copy a file from source to destination. I'm using shutil.copy2(src,dst). But in src and dst path , I want to use variable. For example (variable name): ...
deepu's user avatar
  • 147
2 votes
1 answer
58 views

python-like interpolation of string in coffeescript

I have such namespace with errors errorMessages= error404Find: "Hosts not found" error404FindByHost: "Host - #{hostName} - not found" error400: "No host" hostName should be assigned to null ...
Jesus_Maria's user avatar
  • 1,147
8 votes
3 answers
4k views

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 ...
Sam Hammamy's user avatar
  • 10.9k
75 votes
9 answers
55k views

What is the idiomatic way to slice an array relative to both of its ends?

Powershell's array notation has rather bizarre, albeit documented, behavior for slicing the end of arrays. This section from the official documentation sums up the bizarreness rather well: ...
alx9r's user avatar
  • 3,756
0 votes
1 answer
518 views

String formatting in a python dictionary like Ruby

In Ruby, you can do something like: a = 4 b = 5 match = {} match["#{a}-#{b}"] = 0 Then, if i say: match["4-5"] The result is 0. Can I do something similar in a python dictionary? I can't seem to ...
ab15's user avatar
  • 353
7 votes
2 answers
11k views

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', '...
user3422637's user avatar
  • 4,029
2 votes
1 answer
2k views

MySQL equivalent of Python's triple-quoted strings?

Using Python's triple-quoted strings I can define strings containing ', backticks, or " without having to care about it: hello = """ This string is bounded by triple double quotes (3 ...
Franck Dernoncourt's user avatar
5 votes
8 answers
664 views

Python: What is the equivalent of PHP "=="

The question says it. Here's a little explanation. In PHP. "==" works like this 2=="2" (Notice different type) // True While in python: 2=="2" // False 2==2 // True The equivalent for python "=="...
Realdeo's user avatar
  • 449
13 votes
2 answers
3k views

Global scope for user snippet in Atom.io editor

I would like to transform some snippets that I wrote for the Sublime Text 3 editor to the atom.io editor. Since I have a "license" snippet that is valid for any type of file (any file extension) ...
Franco Rondini's user avatar
6 votes
3 answers
3k views

PHP associative array equivilent to Python dict.get()

I've been out of the PHP world for a couple years and I've recently inherited a PHP project. Something that should be fairly easy in PHP is eluding me though. In Python I can do the following: value =...
Uyghur Lives Matter's user avatar
79 votes
4 answers
231k views

What is C# equivalent of <map> in C++? [duplicate]

I have defined a class myComplex. I need to map it to integers. In C++ I would have created a map as map<myComplex,int> first; How to do such thing in C#?
Abhash Kumar Singh's user avatar
9 votes
7 answers
11k views

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

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?
thedarkside ofthemoon's user avatar
26 votes
3 answers
7k views

What's the Ruby equivalent of Python's defaultdict?

In Python, I can make a hash where each element has a default value when it's first referenced (also know as "autovivification"). Here's an example: from collections import defaultdict d = ...
Ollie Glass's user avatar
  • 19.5k
74 votes
3 answers
51k views

Ruby equivalent for Python's "try"?

I'm trying to convert some Python code into Ruby. Is there an equivalent in Ruby to the try statement in Python?
thatonegirlo's user avatar
26 votes
5 answers
18k views

Templating library in node.js similar to Jinja2 in Python?

What would be a node.js templating library that is similar to Jinja2 in Python?
bodacydo's user avatar
  • 76.3k
19 votes
3 answers
3k views

F# equivalent of `is` keyword in C#?

My first F# day. If I have this: let cat = Animal() Now how do I check at later stage if cat is Animal? In C# bool b = cat is Animal; In F#?
nawfal's user avatar
  • 70.7k
13 votes
3 answers
7k views

PHP equivalent of Python's `str.format` method?

Is there an equivalent of Python str.format in PHP? In Python: "my {} {} cat".format("red", "fat") All I see I can do in PHP natively is by naming the entries and using str_replace: str_replace(...
jeromej's user avatar
  • 10.7k
0 votes
5 answers
690 views

Are THEN and END IF the exact equivalent of curly brackets

Does the compiler see the same thing when it sees THEN...END IF(in Vb) and { ... }(in C#) which are what seems to be delimiting If statements. If they are treated the same way, why can I do this in C#...
phadaphunk's user avatar
  • 12.9k
31 votes
5 answers
41k views

Assign console.log value to a variable

How can I assign a JavaScript object to a variable which was printed using console.log? I am in Chrome console. With Ruby I would use test = _ to access the most recent item printed.
Dru's user avatar
  • 9,670
4 votes
3 answers
3k views

c++ wchar array to c#

I have no knowledge of C++ and I have to cenvert some code to C#. I've managed to do some bits but I don't really understand how to convert a few lines so I'm here asking for help. This is the C++ ...
Ser.Flo.OT's user avatar
10 votes
1 answer
11k views

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

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 ...
Alex Spencer's user avatar
2 votes
3 answers
168 views

Can collections be "opened" inside function signature declaration?

Can the following type T be defined formally in Haskell or another functional language? Type T contains functions that, given a collection (i.e., a set) of objects from X, assign a number to each ...
max's user avatar
  • 49.8k
4 votes
4 answers
13k views

Python equivalent of Ruby's expression: "puts x += value"

For curiosity's sake... In Ruby: =>$ irb 1.8.7 :001 > puts x = 2 2 => nil 1.8.7 :002 > puts x += 2 while x < 40 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 It's quite ...
nemesisdesign's user avatar
18 votes
6 answers
2k views

Implementing python slice notation

I'm trying to reimplement python slice notation in another language (php) and looking for a snippet (in any language or pseudocode) that would mimic the python logic. That is, given a list and a ...
georg's user avatar
  • 212k
48 votes
10 answers
33k views

Does Python do variable interpolation similar to "string #{var}" in Ruby? [duplicate]

In Python, it is tedious to write: print "foo is" + bar + '.' Can I do something like this in Python? print "foo is #{bar}."
mko's user avatar
  • 21.5k
27 votes
8 answers
15k views

Jinja-like JS templating language

I really like django/jinja2 templating languages. Their syntax is extremely simple and yet is highly versatile. Is there anything similar to that in both syntax and capability in javascript, or if not ...
miki725's user avatar
  • 27.4k
2 votes
2 answers
5k views

Comparing Lua with Mono [closed]

I wanted to do some research but i could not find any information about this topic. The only information that i found -> http://benchmarksgame.alioth.debian.org/u32/compare.php?lang=csharp&lang2=...
Maik Klein's user avatar
  • 15.7k
0 votes
0 answers
202 views

(objective) C side by side translations / comparison to another language

The language comparison / translation on the Dart language website helped me tremendously in learning javascript even though I did not know either Dart or Javascript much! link, http://synonym....
user401377's user avatar