(via [zakharov][1])
Consider the following program:
$ cat > tmp.c << EOF
> struct S {
> int x;
# Copyright (c) 2014 Andrey Vlasovskikh | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
-module(pday). | |
-export([main/1, pday/1, ordinal_to_date/2, date_to_string/1]). | |
ordinal_to_date(Year, N) -> | |
{Month, Day} = submod(N, months(Year)), | |
{Year, Month + 1, Day}. | |
date_to_string({Year, Month, Day}) -> |
// Is it possible to shorten collection->array conversion in Kotlin? | |
fun f(): Array<String> { | |
val xs = setOf("foo", "bar") | |
return xs.toArray(Array(xs.size, { "" })) | |
} |
Given the following buffer in the <Normal mode>: | |
""" | |
123<caret>456 | |
123789 | |
""" | |
When I type: | |
""" | |
cw, abc, <Esc>, hhj, . | |
""" | |
Then the buffer should contain: |
/** | |
* Object algebra approach to the Expression problem in Kotlin. | |
* | |
* See also <http://lambda-the-ultimate.org/node/4572>. | |
*/ | |
// Cannot put this fun inside main() in Kotlin M2 | |
fun exp2plus3<A>(f: IntAlg<A>): A = f.add(f.lit(2), f.lit(3)) | |
fun main(args : Array<String>) { |
f = -> | |
x = 2 | |
x = 1 | |
> console.debug "x = #{ x }" | |
x = 1 | |
> console.debug "f() = #{ f() }" | |
f() = 2 |
I = (x) -> x | |
S = (f) -> (g) -> (x) -> (f x) (g x) | |
K = (x) -> (y) -> x |
#!/usr/bin/env python | |
# Author: Andrey Vlasovskikh | |
# License: MIT | |
import sys | |
import os | |
import subprocess | |
def main(): |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Copyright (c) 2010 Andrey Vlasovskikh | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# "Software"), to deal in the Software without restriction, including | |
# without limitation the rights to use, copy, modify, merge, publish, | |
# distribute, sublicense, and/or sell copies of the Software, and to |