function-literal Questions
6
Solved
In JavaScript there are both Object literals and function literals.
Object literal:
myObject = {myprop:"myValue"}
Function literal:
myFunction = function() {
alert("hello world");
}
What is...
Dysentery asked 7/9, 2012 at 8:58
16
It seems quite a few mainstream languages support function literals these days. They are also called anonymous functions, but I don't care if they have a name. The important thing is that a functio...
Neckcloth asked 1/10, 2008 at 5:46
2
Solved
I always wondered why sometimes with function literals we can ignore the curly brace even for multiple statements. To illustrate this, the syntax for a multiline function literal is to enclose the ...
Counterforce asked 14/12, 2012 at 3:24
2
Solved
I want to be able to do something on these lines (won't compile):
def logScope(logger:Logger)(operation: (implicit l:Logger) => Unit) {/* code */ operation(logger) /* code */}
def operationOne...
Happiness asked 15/8, 2011 at 18:33
3
Solved
I have a function literal
{case QualifiedType(preds, ty) =>
t.ty = ty ;
Some((emptyEqualityConstraintSet,preds)) }
Which results in an error message
missing parameter type for expanded fun...
Joellyn asked 13/10, 2012 at 1:48
3
Is it possible to call recursively a method from an object literal?
For example:
(function () {
'use strict';
var abc = ['A', 'B', 'C'],
obj = {
f: function () {
if (abc.length) {
abc.shift...
Fachanan asked 25/1, 2012 at 16:51
5
Solved
I'm new to scala and trying to write a function literal that check whether a given integer is odd or not.
my first attempt is:
val isOdd = (x:Int) => (x & 1) == 1
it works great, and, since t...
Moro asked 18/1, 2011 at 14:53
1
Solved
I'll ask this with a Scala example, but it may well be that this affects other languages which allow hybrid imperative and functional styles.
Here's a short example (UPDATED, see below):
def meth...
Nodababus asked 18/10, 2010 at 4:28
1
© 2022 - 2024 — McMap. All rights reserved.