This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 以下は1から3の文字をただ印字するつまらないプログラムである。 | |
| # 問題なし | |
| # => 1 2 3 | |
| for i in [1..3] | |
| console.log i | |
| # 問題なし | |
| # => 1 2 3 | |
| for i in [1..3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {hogeFunc, fugaFunc} = do => | |
| helperFunc = () -> # なんか | |
| hogeFunc : () -> helperFunc() | |
| fugaFunc : () -> helperFunc(helperFunc()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zero = [] | |
| num = (n) -> | |
| if n is 0 | |
| zero | |
| else | |
| prev = num(n-1) | |
| [prev..., [prev]] | |
| for i in [0..10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| firstThis = (fn) -> (head, args...) -> fn.call(head, head, args...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| about = (fn, argslist) -> fn.apply null, args for args in argslist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function toJSON$(ByVal value) | |
| Select Case TypeName(value) | |
| Case "Dictionary" | |
| toJSON$ = dict2JSON(value) | |
| Case "Collection", "Variant()" | |
| toJSON$ = col2JSON(value) | |
| Case Else | |
| toJSON$ = JSQuote(value) | |
| End Select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class NumberUnderscore { | |
| public static void main(String[] args) { | |
| int a; | |
| a = 222_222; | |
| a = 0b00_00; // binary literal | |
| a = 0_2; // octal | |
| // a = 0_9; illegal octal number | |
| // a = 3333._222; illegal | |
| // a = 2222_.222; illegal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class TryWithResources { | |
| public static AutoCloseable closeable(final String name) { | |
| return new AutoCloseable() { | |
| @Override | |
| public void close() throws Exception { | |
| System.out.println(name); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| counter = (i) -> -> i++ | |
| a = counter 0 | |
| b = counter 0 | |
| console.log a() | |
| console.log a() | |
| console.log b() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @at = (namespace, fn = ->) => | |
| root = @ | |
| for spc in namespace.split /\./g | |
| root = root[spc] ?= {} | |
| fn.call root | |
| root | |
| @at 'util.math', -> | |
| @square = (x) -> x * x |