This works:
List(3, 1, 2).sorted apply 1
res1: Int = 2
And this works:
var x = List(3, 1, 2).sorted
x: List[Int] = List(1, 2, 3)
x(1)
res2: Int = 2
but this doesn't:
List(3, 1, 2).sorted (1)
error: type mismatch;
found : Int(1)
required: Ordering[?]
List(3, 1, 2).sorted (1)
^
And even parentheses don't clue the parser in to what I want:
(List(3, 1, 2).sorted)(1)
error: type mismatch;
found : Int(1)
required: Ordering[?]
(List(3, 1, 2).sorted)(1)
It seems like a natural expression. What am I doing wrong?
Description. LESS maps JavaScript code with manipulation of values and uses predefined functions to manipulate HTML elements aspects in the style sheet. It provides several functions to manipulate colors such as round function, floor function, ceil function, percentage function etc.
Defining a variable: Variables in Less are represented with an at (@) sign. We can assign a value using a colon (:).
To return a value from a function, you must include a return statement, followed by the value to be returned, before the function's end statement. If you do not include a return statement or if you do not specify a value after the keyword return, the value returned by the function is unpredictable.
Mixins are a group of CSS properties that allow you to use properties of one class for another class and includes class name as its properties. In LESS, you can declare a mixin in the same way as CSS style using class or id selector. It can store multiple values and can be reused in the code whenever necessary.
This works:
(Listed(3, 1, 2).sorted _)(1)
,
but I'm not sure whether it is much more convenient to use than:
Listed(3, 1, 2).sorted apply 1
.
I'd go for the latter anyways.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With