翻訳版: https://github.com/vim-volt/volt/blob/jsondsl/_docs/json-dsl.md 翻訳版では無駄を省いた説明にする予定。
volt get 等のコマンドを実行すると次の二段階に分けて実行される。
:- consult(tree). | |
:- use_module(tree). | |
:- begin_tests(tree). | |
test(new_tree1) :- | |
new_tree(top, top++[]). | |
test(new_tree2) :- | |
new_tree(node++[], node++[]). |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"os" | |
"strconv" | |
"strings" |
[1] ?- eval(add(tInt(1), tInt(2)), R). | |
R = tInt(1+2). | |
[1] ?- eval(let(T, =, add(tInt(1), tInt(2))), R). | |
T = tInt(1+2), | |
R = tVoid. | |
[1] ?- eval(let(T, =, add(T2, tInt(2))), R). | |
T = tInt(_8418+2), | |
T2 = tInt(_8418), |
export default class Color { | |
private static cache = new Map<string, Color>(); | |
// https://developer.mozilla.org/ja/docs/Web/CSS/color_value | |
public static readonly BLACK = Color.fromRGB(0, 0, 0); | |
public static readonly SILVER = Color.fromRGB(192, 192, 192); | |
public static readonly GRAY = Color.fromRGB(128, 128, 128); | |
public static readonly WHITE = Color.fromRGB(255, 255, 255); | |
public static readonly MAROON = Color.fromRGB(128, 0, 0); |
function! s:run() abort | |
new | |
setlocal buftype=prompt | |
function! s:TextEntered(text) | |
if a:text == 'exit' || a:text == 'quit' | |
stopinsert | |
close | |
else | |
call append(line('$') - 1, 'Entered: "' . a:text . '"') | |
" Reset 'modified' to allow the buffer to be closed. |
command! -nargs=+ -complete=shellcmd ImportQF call s:import_qf(<q-args>, -1) | |
command! -nargs=+ -complete=shellcmd LImportQF call s:import_qf(<q-args>, winnr()) | |
function! s:import_qf(shellcmd, winnr) abort | |
if a:winnr >=# 0 | |
call setloclist( | |
\ a:winnr, [], 'r', {'lines': systemlist(a:shellcmd)} | |
\) | |
else | |
call setqflist( |
翻訳版: https://github.com/vim-volt/volt/blob/jsondsl/_docs/json-dsl.md 翻訳版では無駄を省いた説明にする予定。
volt get 等のコマンドを実行すると次の二段階に分けて実行される。
package main | |
import ( | |
"errors" | |
"fmt" | |
multierror "github.com/hashicorp/go-multierror" | |
) | |
func main() { |
function! s:fold(list, f, init) abort | |
let ref = {'result': a:init} | |
return map(copy(a:list), {_,v -> extend(ref, {'result': a:f(ref.result, v)})})[-1].result | |
endfunction | |
function! s:fold2(list, f, init) abort | |
let l = a:list + [a:init] | |
let end = len(a:list) | |
return map(l, {i,v -> i is# end ? l[i-1] : a:f(l[i-1], v)})[-1] | |
endfunction |