Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
19
Task/Truncate-a-file/Lasso/truncate-a-file.lasso
Normal file
19
Task/Truncate-a-file/Lasso/truncate-a-file.lasso
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
define file_truncate(path::string, size::integer) => {
|
||||
|
||||
local(file = file(#path))
|
||||
|
||||
fail_if(not(#file -> exists), -1, 'There is no file at the given path')
|
||||
fail_if(#file -> size < #size, -1, 'No point in truncating a file to a larger size than it already is')
|
||||
|
||||
#file -> setSize(#size)
|
||||
|
||||
}
|
||||
local(filepath = '//Library/WebServer/Documents/Lasso9cli/trunk/testing/lorem_ipsum_long.txt')
|
||||
|
||||
stdoutnl(file(#filepath) -> readbytes)
|
||||
stdoutnl('Original size: ' + file(#filepath) -> size)
|
||||
|
||||
file_truncate(#filepath, 300)
|
||||
|
||||
stdoutnl(file(#filepath) -> readbytes)
|
||||
stdout(file('Truncated size: ' + #filepath) -> size)
|
||||
Loading…
Add table
Add a link
Reference in a new issue