Forgive me if this has already been asked elsewhere. I have a Scala syntax question involving function-values and implicit parameters.
I'm comfortable using implicits with Scala's currying feature. For instance if I had a sum function and wanted…
My code:
note: the Slider Object is declared but omitted in the snippet below for better readability
"use strict";
/*global arrayContainer, SliderInstance, DomObjects */
arrayContainer = new Slider.constructArray();
SliderInstance =…
Swift seems to be trying to deprecate the notion of a string being composed of an array of atomic characters, which makes sense for many uses, but there's an awful lot of programming that involves picking through datastructures that are ASCII for…
According to this, integer literals without type suffix are always ints. However, both gcc and clang interpret 0xffffffff (or any literal which explicitly sets the sign bit other than using the -) as unsigned. Which is correct? (according to this…
Is there some c++ proposal for Integer literal for fixed width integer types like this?
// i's type is unsigned int
auto i = 10u;
// j's type is uint32_t
auto j = 10u32;
I want to narrow a string to a string literal union. In other words, I want to check if the string is one of the possible values of my literal union, so that this will work (if the operator couldbe existed).
type lit = "A" | "B" | "C";
let uni:…
I'm reading through The Rust Programming Language and have encountered this notation: 0u8.
let some_u8_value = 0u8;
match some_u8_value {
1 => println!("one"),
3 => println!("three"),
5 => println!("five"),
7 => println!("seven"),
…
Can C-Strings or std::strings be created as constexpr or must they be created at run-time?
With gcc 4.9.2 I can do this:
constexpr const char foo[] = "blee";
(Sadly the November 2013 Customer Technology Preview does not allow Visual Studio to…
r'\' in Python does not work as expected. Instead of returning a string with one character (a backslash) in it, it raises a SyntaxError. r"\" does the same.
This is rather cumbersome if you have a list of Windows paths like these:
paths = […
Since everything is an object in python, even literals, we are typically allowed to call methods directly on a literal.
ex:
'hello'.upper()
In theory, it seems like the same thing should be allowed for int literals
ex:
4.bit_length()
However,…
Can someone explain the following behavior? Specifically, why does the function return a different list every time? Why isn't some-list initialized to '(0 0 0) every time the function is called?
(defun foo ()
(let ((some-list '(0 0 0)))
(incf…