941 karma · joined February 14, 2009
But the variable substitution schemes you mention are not complex at all. The main rule is beta-reduction, which is really simple: just replace all appearances of the parameter with the value of the argument.
(λ x . (x y) x) m → (m y) m
β > ['10', '10', '10', '10', '10'].map(parseInt)
[ 10, NaN, 2, 3, 4 ]
> ['10', '10', '10', '10', '10'].map(x => parseInt(x))
[ 10, 10, 10, 10, 10 ]In their minds, when things stop being simple, fast trumps correct.
<svg class='svgDiagram center' width="300" height="120" viewBox="-15 0 285 120">
<defs>
<g id="vector">
<line x1="0" y1="0" x2="0" y2="45" style="stroke:#000;stroke-width:2" />
<polygon points="0,50 -5,42 5,42" style="fill:#000;" />
</g>
</defs>
<g transform='translate(100 20) rotate(0)'>
<rect x="0" y="0" width="80" height="80" stroke='black' stroke-width='2' fill="#fff" />
<text x="40" y="40" fill="black" text-anchor="middle" alignment-baseline="middle" font-size='28px'>m</text>
</g>
<use xlink:href="#vector" transform='translate(100 60) rotate(90)' />
<text x="40" y="60" font-size='25px' text-anchor="middle" alignment-baseline="middle">F</text>
<use xlink:href="#vector" transform='translate(180 80) rotate(-90)' />
<text x="240" y="80" font-size='25px' text-anchor="middle" alignment-baseline="middle">F</text>
<use xlink:href="#vector" transform='translate(180 40) rotate(-90)' />
<text x="240" y="40" font-size='25px' text-anchor="middle" alignment-baseline="middle">F</text>
</svg>https://www.cs.ox.ac.uk/people/jeremy.gibbons/publications/a...
type Year = Int
type Month = Int
type Day = Int
-- fields have no names, just types
data Date = Date Year Month Day
-- we bind fields to names only when necessary
next (Date y 12 31) = Date (y + 1) 1 1
next (Date y m d)
| d == daysOf m = Date y (m + 1) 1
| otherwise = Date y m (d + 1)
where daysOf = (!!) [0, 31, 28, 31, 30,
31, 30, 31, 31,
30, 31, 30, 31]
Is something like this what you mean?• qq to start recording a macro in register q,
• w to jump to the second word,
• gUaw to "go uppercase a word",
• j to move to next line (↓ works as well),
• q to stop recording,
• 5@q to apply macro in register q five times.
But in this example I would have probably used ex command:
:%normal wgUaw
(for every line do as if I had typed wgUaw) or visualy selected the second column as a block and just pressed U.I'm genuinely interested in someone showing how to do this kind of trasformation in popular modern editors such as Atom and VSCode. Is there such a flexible way as in the classic editors?
val x = 1
var y = 2
x = 3 // compile error
y = 4 // ok
It makes it easier to read code since you don't have to keep track of changes in your head. X
+----+XX----------+
| XX |
| XX |
| +XXX------+
| | XXXXX
+-------+ XXX
If I try to resize
a rectangle that's
crossed by a free-form
curve, it stops being
a rectangle.
(Now that I think, I could also use this as a feature).I decided arbitrarily to make every post self-contained inside a single HTTP request, and it's nice to see this single decision is already 99% of the job.
enum Tree[T] {
case Branch(t: Tree[T])
case Leaf(t: T)
}
https://github.com/lampepfl/dotty/issues/1970