1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: updateimport () and []array

This commit is contained in:
yuyi
2020-04-26 19:49:31 +08:00
committed by GitHub
parent 7b39ab6d06
commit 9f4d498ff1
59 changed files with 181 additions and 254 deletions

View File

@ -1,13 +1,11 @@
module main
import (
cli
os
)
import cli
import os
fn main() {
mut cmd := cli.Command{
name: 'cli',
name: 'cli',
description: 'An example of the cli library',
version: '1.0.0',
parent: 0
@ -22,7 +20,7 @@ fn main() {
parent: 0
}
greet_cmd.add_flag(cli.Flag{
flag: .string,
flag: .string,
required: true,
name: 'language',
abbrev: 'l',

View File

@ -1,8 +1,6 @@
module main
import (
some_module
)
import some_module
fn main(){
mut sub := some_module.get_subscriber()

View File

@ -1,8 +1,6 @@
module some_module
import (
eventbus
)
import eventbus
const (
eb = eventbus.new()

View File

@ -12,8 +12,8 @@ fn expr_to_rev_pol(expr string) ?[]string {
if expr == '' {
return error('err: empty expression')
}
mut stack := []string
mut rev_pol := []string
mut stack := []string{}
mut rev_pol := []string{}
mut pos := 0
for pos<expr.len {
mut end_pos := pos

View File

@ -9,7 +9,7 @@ const (
fn main() {
rand.seed(time.now().unix)
rand.next(MAX) // skip the first
mut arr := []int
mut arr := []int{}
for _ in 0..LEN {
arr << rand.next(MAX)
}
@ -33,7 +33,7 @@ fn quick_sort(arr mut []int, l int, r int) {
quick_sort(mut arr, sep+1, r)
}
[inline]
[inline]
fn swap(arr mut []int, i int, j int) {
temp := arr[i]
arr[i] = arr[j]

View File

@ -1,10 +1,8 @@
module main
import (
vweb
vweb.assets
time
)
import vweb
import vweb.assets
import time
const (
port = 8081

View File

@ -22,7 +22,7 @@ fn main() {
m[word] = m[word] + 1 // TODO m[key]++
}
// Sort the keys
mut keys := m.keys()
mut keys := m.keys()
keys.sort()
// Print the map
for key in keys {
@ -33,7 +33,7 @@ fn main() {
// Creates an array of words from a given string
fn extract_words(contents string) []string {
mut splitted := []string
mut splitted := []string{}
for space_splitted in contents.to_lower().split(' ') {
if space_splitted.contains('\n') {
splitted << space_splitted.split('\n')
@ -43,7 +43,7 @@ fn extract_words(contents string) []string {
}
}
mut results := []string
mut results := []string{}
for s in splitted {
result := filter_word(s)
if result == '' {