History

io: add path-rename

Sigrid Solveig Haflínudóttir committed 3 months ago

Commit 479022e1 parent 493967310 files · +87 −23Browse files

Unified · Split

10 files
  1. boot/sl.boot +22 −20
  2. src/docs.sl +11 −1
  3. src/dos/sys.c +6 −0
  4. src/io.c +10 −0
  5. src/macos/sys.c +6 −0
  6. src/plan9/sys.c +11 −0
  7. src/posix/sys.c +6 −0
  8. src/slpriv.h +2 −0
  9. src/windows/sys.c +6 −0
  10. test/io.sl +7 −2
boot/sl.boot+22−20
@@ -59,8 +59,8 @@ lst)) str->num ((s (:base NIL))) exp ((p)) caaaar ((lst)) io-column ((io)) · 58 unmodified lines
59seq)) compare ((a b)) length ((seq)) error (msg) print-exception ((e)) set-top-level-value! ((sym59seq)) compare ((a b)) length ((seq)) error (msg) print-exception ((e)) set-top-level-value! ((sym
60expr)) load ((path/io (eval eval))) getpid (NIL) keyword? ((v)) aref ((sequence subscript0 . rest)) sym? ((v)) defmacro ((form . body)) u64 (((n60expr)) load ((path/io (eval eval))) getpid (NIL) keyword? ((v)) aref ((sequence subscript0 . rest)) sym? ((v)) defmacro ((form . body)) u64 (((n
610))) int-valued? ((x)) assv ((key lst)) bignum (((n 0))) copy-vec ((vec)) eqv? ((a b)) list (rest) __init_globals (NIL) eof? ((v)) revappend ((lst610))) int-valued? ((x)) assv ((key lst)) bignum (((n 0))) copy-vec ((vec)) eqv? ((a b)) list (rest) __init_globals (NIL) eof? ((v)) revappend ((lst
62tail)) quote ((expr)) nreconc ((lst tail)) defc*r ((name)) read-all-of ((fn io)) cddddr ((lst)) prog1 ((expr . rest)) logior (ints) cadr ((lst)) cdadr ((lst)) nan? ((v)) caar ((lst)) div0 ((a62tail)) quote ((expr)) nreconc ((lst tail)) defc*r ((name)) read-all-of ((fn io)) cddddr ((lst)) prog1 ((expr . rest)) logior (ints) cadr ((lst)) cdadr ((lst)) nan? ((v)) caar ((lst)) path-rename ((old
63n)) set-syntax! ((sym fn)) mod0 ((a n)) last-pair ((lst)) path-cwd (((to NIL))) arr? ((v)) cadaar ((lst)) unwind-protect ((expr63new)) div0 ((a n)) set-syntax! ((sym fn)) mod0 ((a n)) last-pair ((lst)) path-cwd (((to NIL))) arr? ((v)) cadaar ((lst)) unwind-protect ((expr
64finally)) cos ((r)) io-skip ((io offset (:end NIL))) with-bindings ((binds . body)) every ((pred64finally)) cos ((r)) io-skip ((io offset (:end NIL))) with-bindings ((binds . body)) every ((pred
65lst)) atom? ((v)) p64 (((n 0))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) letrec ((binds . body)) with-output (((var) . body)65lst)) atom? ((v)) p64 (((n 0))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) letrec ((binds . body)) with-output (((var) . body)
66((var io) . body)) cdar ((lst)) cdaar ((lst)) iota ((count (start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol66((var io) . body)) cdar ((lst)) cdaar ((lst)) iota ((count (start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol
@@ -87,11 +87,11 @@ group syntax) "StreetLISP syntax and macros." defdoc "Define documentation for · 20 unmodified lines
87group debug) "Debugging utilities." +most-negative-fixnum+ "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current column number of the IO object.\n\nColumn number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." traced? "Return `T` if the tracing is enabled for the function, `NIL`\notherwise." cond "Select one of the clauses by evaluating the condition, evaluate the\naccompanied expressions for the matching clause and return the result.\n\nDifferent clause form variants are available. The most common is\n`(test then…)`, which gives the result of `then…` if `test` did not\nevaluate to `NIL`. Second form, `(test)`, which gives the result\nof `test` unless it's `NIL`. Third form, `(test => fn)`, calls `fn`\nwith a single argument which is the non-`NIL` result of evaluating\n`test`.\n\nThe special `else` clause condition, if specified, is used as a fallback\nif none of the other conditions were satisfied. If none were satisfied\n_and_ `else` was not provided, `NIL` is returned." (doc87group debug) "Debugging utilities." +most-negative-fixnum+ "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current column number of the IO object.\n\nColumn number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." traced? "Return `T` if the tracing is enabled for the function, `NIL`\notherwise." cond "Select one of the clauses by evaluating the condition, evaluate the\naccompanied expressions for the matching clause and return the result.\n\nDifferent clause form variants are available. The most common is\n`(test then…)`, which gives the result of `then…` if `test` did not\nevaluate to `NIL`. Second form, `(test)`, which gives the result\nof `test` unless it's `NIL`. Third form, `(test => fn)`, calls `fn`\nwith a single argument which is the non-`NIL` result of evaluating\n`test`.\n\nThe special `else` clause condition, if specified, is used as a fallback\nif none of the other conditions were satisfied. If none were satisfied\n_and_ `else` was not provided, `NIL` is returned." (doc
88group io) "Files and I/O functionality." s64 "Construct a 64-bit signed number." io-flush "Flush the contents of the output buffer to the underlying IO." assoc "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `equal?`." + "Return sum of the arguments or `0` when none specified." path-delete "Delete the name from the filesystem.\n\nThrows an IO error if the path does not exist or it failed to be\nremoved." cadadr "Shorthand for (car (cdr (car (cdr lst))))." foldr1 "Same as `foldr` but using the first element of the sequence as the\ninitial accumulator." compare "Return -1 if `x` is less than `y`, 0 if equal, and `1` if `y` is\ngreater than `x`." length "Return the length of the sequence.\n\nString's length is measured in UTF-8 codepoints. For tables the number\nof key-value pairs is returned.\n\nNote: for circular lists the result is `NIL`. A type error exception is\nthrown on improper lists, which are not considered valid sequences." *io-err* "Current (default) error output IO stream.\n\nFunctions may use `*io-err*` for error output, which then can be\nredirected to a different IO using `with-bindings`." print-exception "Print the exception in a human-readable form.\n\nExceptions are lists containing various information about the error.\nThey may optionally, as the first element, contain the error location\nof the form `(io row column)`." error "Raise an error." set-top-level-value! "Evaluate the expression and assign the result to the symbol in the top\nlevel (global) environment.\n\nThe use of this function is discouraged. For the usual assignment of\nvalues to names it is recommended instead to use `(def …)` and/or\n`(set! …)`." load "Read and evaluate expression from the file or IO object.\n\nIf the argument is an IO object it is _not_ closed after the load\nfinishes." getpid "Return the process ID of the StreetLISP VM within the operating system\nit's running on." keyword? "Return `T` if the argument is a keyword, `NIL` otherwise." aref "Return the sequence element specified by the subscripts. The sequence\ncan be an array, vector, a list. Multi-dimensional sequences\nof variating types are also supported." sym? "Return `T` if `v` is a symbol, `NIL` otherwise." defmacro "Define a new macro." u64 "Construct a 64-bit unsigned number." int-valued? "Return `T` if `x` is a number and is equal (as in `=`) to an\ninteger value of `x`." Instructions "VM instructions mapped to their encoded byte representation." assv "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eqv?`." bignum "Construct a bignum. As opposed to a fixnum, its value is not limited." copy-vec "Return a copy of the vector with the same elements.\n\nNo copies of the values themselves are created, the original values\nare reused." eqv? "Return `T` if both `a` and `b` are of the same value and primitive\n(leaf) type, `NIL` otherwise. Neither cons cell nor vector are not\nconsidered primitive types as they may define deep structures." +f64-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0 +f64-epsilon+)` is not equal to `1.0`." list "Return a list constructed of the arguments." __init_globals "Initialize globals that need to be set at load time." eof? "Return `T` if the argument is `#<eof>`, `NIL` otherwise.\n\nThis object is returned by I/O functions to signal end of file,\nwhere applicable." +pi+ "Mathematical constant π." revappend "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list is copied to construct the reversed version." quote "Leave the expression unevaluated." nreconc "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list may be modified by this function." defc*r "Define a shorthand for list access using `car` and `cdr`." (doc88group io) "Files and I/O functionality." s64 "Construct a 64-bit signed number." io-flush "Flush the contents of the output buffer to the underlying IO." assoc "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `equal?`." + "Return sum of the arguments or `0` when none specified." path-delete "Delete the name from the filesystem.\n\nThrows an IO error if the path does not exist or it failed to be\nremoved." cadadr "Shorthand for (car (cdr (car (cdr lst))))." foldr1 "Same as `foldr` but using the first element of the sequence as the\ninitial accumulator." compare "Return -1 if `x` is less than `y`, 0 if equal, and `1` if `y` is\ngreater than `x`." length "Return the length of the sequence.\n\nString's length is measured in UTF-8 codepoints. For tables the number\nof key-value pairs is returned.\n\nNote: for circular lists the result is `NIL`. A type error exception is\nthrown on improper lists, which are not considered valid sequences." *io-err* "Current (default) error output IO stream.\n\nFunctions may use `*io-err*` for error output, which then can be\nredirected to a different IO using `with-bindings`." print-exception "Print the exception in a human-readable form.\n\nExceptions are lists containing various information about the error.\nThey may optionally, as the first element, contain the error location\nof the form `(io row column)`." error "Raise an error." set-top-level-value! "Evaluate the expression and assign the result to the symbol in the top\nlevel (global) environment.\n\nThe use of this function is discouraged. For the usual assignment of\nvalues to names it is recommended instead to use `(def …)` and/or\n`(set! …)`." load "Read and evaluate expression from the file or IO object.\n\nIf the argument is an IO object it is _not_ closed after the load\nfinishes." getpid "Return the process ID of the StreetLISP VM within the operating system\nit's running on." keyword? "Return `T` if the argument is a keyword, `NIL` otherwise." aref "Return the sequence element specified by the subscripts. The sequence\ncan be an array, vector, a list. Multi-dimensional sequences\nof variating types are also supported." sym? "Return `T` if `v` is a symbol, `NIL` otherwise." defmacro "Define a new macro." u64 "Construct a 64-bit unsigned number." int-valued? "Return `T` if `x` is a number and is equal (as in `=`) to an\ninteger value of `x`." Instructions "VM instructions mapped to their encoded byte representation." assv "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eqv?`." bignum "Construct a bignum. As opposed to a fixnum, its value is not limited." copy-vec "Return a copy of the vector with the same elements.\n\nNo copies of the values themselves are created, the original values\nare reused." eqv? "Return `T` if both `a` and `b` are of the same value and primitive\n(leaf) type, `NIL` otherwise. Neither cons cell nor vector are not\nconsidered primitive types as they may define deep structures." +f64-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0 +f64-epsilon+)` is not equal to `1.0`." list "Return a list constructed of the arguments." __init_globals "Initialize globals that need to be set at load time." eof? "Return `T` if the argument is `#<eof>`, `NIL` otherwise.\n\nThis object is returned by I/O functions to signal end of file,\nwhere applicable." +pi+ "Mathematical constant π." revappend "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list is copied to construct the reversed version." quote "Leave the expression unevaluated." nreconc "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list may be modified by this function." defc*r "Define a shorthand for list access using `car` and `cdr`." (doc
89group misc) "Miscellaneous." read-all-of "Return the list containing the values returned by call `(fn io)` repeated\nuntil the IO object runs out of data." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first\nexpression." logior "Return the result of bitwise OR (inclusive OR) operation on integers." cadr "Shorthand for `(car (cdr lst))`, that is, _first element of the\nsecond element_." cdadr "Shorthand for (cdr (car (cdr lst)))." (doc89group misc) "Miscellaneous." read-all-of "Return the list containing the values returned by call `(fn io)` repeated\nuntil the IO object runs out of data." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first\nexpression." logior "Return the result of bitwise OR (inclusive OR) operation on integers." cadr "Shorthand for `(car (cdr lst))`, that is, _first element of the\nsecond element_." cdadr "Shorthand for (cdr (car (cdr lst)))." (doc
90group doc) "Writing and reading documentation." nan? "Return `T` if `v` is a floating point representation of NaN, either\nnegative or positive, `NIL` otherwise." caar "Shorthand for (car (car lst))." div0 "Return the quotient of the truncated division `a/n`." set-syntax! "Associate a macro name with its application function." mod0 "Return the remainder of the truncated division `a/n`." last-pair "Return the last cell (pair) of the list." path-cwd "Return the full path to the current directory of the process, or\nchange it to the path specified with `to` argument." (doc90group doc) "Writing and reading documentation." nan? "Return `T` if `v` is a floating point representation of NaN, either\nnegative or positive, `NIL` otherwise." caar "Shorthand for (car (car lst))." path-rename "Rename a file or a directory.\n\nThrows an IO error if the path does not exist or it failed to be\nrename. On most operating systems (not Plan 9), files can be moved\nbetween directories." div0 "Return the quotient of the truncated division `a/n`." set-syntax! "Associate a macro name with its application function." mod0 "Return the remainder of the truncated division `a/n`." last-pair "Return the last cell (pair) of the list." path-cwd "Return the full path to the current directory of the process, or\nchange it to the path specified with `to` argument." (doc
91group compress) "Compression." *print-width* "Current maximal visible width (in terminal cells) of strings printed or `NIL`\nif strings are to be printed in full.\n\nTruncation does not occur in the middle of a codepoint or a grapheme cluster.\n\nNote: if a string contains an invalid rune or a control character for which\nits width is undefined, the string is printed in full if the rune in question\nwould fit otherwise." arr? "Return `T` if the argument is either a vector or an array, `NIL`\notherwise." cadaar "Shorthand for (car (cdr (car (car lst))))." unwind-protect "Evaluate `expr` first, then `finally`, regardless of whether\nevaluating the former resulted in any exception thrown or not.\n\nIf an exception has been thrown, it will be raised _after_ evaluating\n`finally`, else the result of `expr` is returned." cos "Return the cosine of `r`, where `r` is given in radians." io-skip "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset." *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." with-bindings "Evaluate expressions with the values of the specified variables\noverriden for the duration of the evaluation." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise." atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible." p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise." apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function." cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`." letrec "Same as the first form of `let` but each of the binding\nexpressions may reference any of the variables bound, before\nor after." with-output "Evaluate expressions in `body` with `var` bound to `io` during the\nevaluation.\n\nIf expression `io` was not specified (first form), `var` will point\nto a new in-memory buffer and the resulting contents will be returned\nas a string.\n\nWith the second form the result of the last expression in the `body`\nwill be returned instead." cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements:\n\n (start start+step … start+(count-1)*step)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nexception `key-error` will be thrown." (doc91group compress) "Compression." *print-width* "Current maximal visible width (in terminal cells) of strings printed or `NIL`\nif strings are to be printed in full.\n\nTruncation does not occur in the middle of a codepoint or a grapheme cluster.\n\nNote: if a string contains an invalid rune or a control character for which\nits width is undefined, the string is printed in full if the rune in question\nwould fit otherwise." arr? "Return `T` if the argument is either a vector or an array, `NIL`\notherwise." cadaar "Shorthand for (car (cdr (car (car lst))))." unwind-protect "Evaluate `expr` first, then `finally`, regardless of whether\nevaluating the former resulted in any exception thrown or not.\n\nIf an exception has been thrown, it will be raised _after_ evaluating\n`finally`, else the result of `expr` is returned." cos "Return the cosine of `r`, where `r` is given in radians." io-skip "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset." *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." with-bindings "Evaluate expressions with the values of the specified variables\noverriden for the duration of the evaluation." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise." atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible." p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise." apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function." cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`." letrec "Same as the first form of `let` but each of the binding\nexpressions may reference any of the variables bound, before\nor after." with-output "Evaluate expressions in `body` with `var` bound to `io` during the\nevaluation.\n\nIf expression `io` was not specified (first form), `var` will point\nto a new in-memory buffer and the resulting contents will be returned\nas a string.\n\nWith the second form the result of the last expression in the `body`\nwill be returned instead." cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements:\n\n (start start+step … start+(count-1)*step)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nexception `key-error` will be thrown." (doc
92group random) "Random numbers generation." * "Return product of the arguments or `1` when none specified." T "A boolean \"true\"." putprop "Associate a property with the symbol, return the value." *io-out* "Current (default) output IO stream.\n\nFunctions may use `*io-out*` for output, which then can be redirected\nto a different IO using either `with-output-to` or (a more general)\n`with-bindings`." repl "Run interactive prompt in a loop, reading and evaluating the\nexpressions entered by the user and printing the results.\n\nThis function is executed automatically if StreetLISP is started in\ninteractive mode." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception." table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers." zip "Return a list where each nth element is a list of the corresponding\nelements from the parameter lists.\n\nThe resulting list is as long as the shortest of the arguments." str-width "Return the number of columns needed to represent a string or a rune.\n\nIf a non-printable control rune is encountered, the result is `NIL`,\nelse it is a non-negative integer. Rune `#\\null` is considered of width zero." acos "Return the arc cosine of `x` in radians." time->str "Return the number of nanoseconds since Epoch formatted as time and date.\n\nThis is the opposite of `str->time`." to-proper "Return a proper list that is a copy of the original list." caddr "Shorthand for (car (cdr (cdr lst)))." table-keys "Return the list of all keys of the table." catch "Evaluate `expr` and catch any exception thrown while evaluating by a\ncall to `throw` with the specified `tag`.\n\nIf no exception was thrown, return the result of the expression. In\ncase an exception thrown has a different tag, raise it further, to be\ncaught on a higher level of exception handling logic." __start "The system boot image entry.\n\nThis is the first function executed by the VM after initialization." NIL "An empty list. Can be used as the opposite of T in boolean\nexpressions." floor "Return the largest integer that is less than or equal to `x`.\n\nInfinity and NaN `floor` to themselves." add-exit-hook "Puts an one-argument function on top of the list of exit hooks.\n\nOn shutdown each exit hook is called with the exit status as a single\nargument, which is `NIL` on success or a string describing the error\notherwise.\n\nThe hook added last will be called first." str-join "Return concatenated elements of `strlist`, separated between each\nother with `sep`, as a single string.\n\nThe separator can be of any type suitable for `io-write` - a rune,\nstring, array of C primitives." (doc92group random) "Random numbers generation." * "Return product of the arguments or `1` when none specified." T "A boolean \"true\"." putprop "Associate a property with the symbol, return the value." *io-out* "Current (default) output IO stream.\n\nFunctions may use `*io-out*` for output, which then can be redirected\nto a different IO using either `with-output-to` or (a more general)\n`with-bindings`." repl "Run interactive prompt in a loop, reading and evaluating the\nexpressions entered by the user and printing the results.\n\nThis function is executed automatically if StreetLISP is started in\ninteractive mode." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception." table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers." zip "Return a list where each nth element is a list of the corresponding\nelements from the parameter lists.\n\nThe resulting list is as long as the shortest of the arguments." str-width "Return the number of columns needed to represent a string or a rune.\n\nIf a non-printable control rune is encountered, the result is `NIL`,\nelse it is a non-negative integer. Rune `#\\null` is considered of width zero." acos "Return the arc cosine of `x` in radians." time->str "Return the number of nanoseconds since Epoch formatted as time and date.\n\nThis is the opposite of `str->time`." to-proper "Return a proper list that is a copy of the original list." caddr "Shorthand for (car (cdr (cdr lst)))." table-keys "Return the list of all keys of the table." catch "Evaluate `expr` and catch any exception thrown while evaluating by a\ncall to `throw` with the specified `tag`.\n\nIf no exception was thrown, return the result of the expression. In\ncase an exception thrown has a different tag, raise it further, to be\ncaught on a higher level of exception handling logic." __start "The system boot image entry.\n\nThis is the first function executed by the VM after initialization." NIL "An empty list. Can be used as the opposite of T in boolean\nexpressions." floor "Return the largest integer that is less than or equal to `x`.\n\nInfinity and NaN `floor` to themselves." add-exit-hook "Puts an one-argument function on top of the list of exit hooks.\n\nOn shutdown each exit hook is called with the exit status as a single\nargument, which is `NIL` on success or a string describing the error\notherwise.\n\nThe hook added last will be called first." str-join "Return concatenated elements of `strlist`, separated between each\nother with `sep`, as a single string.\n\nThe separator can be of any type suitable for `io-write` - a rune,\nstring, array of C primitives." (doc
93group sys) "OS-specific functions." >= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)." void? "Return `T` if `v` is `#<void>`, `NIL` otherwise." +f32-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`." length= "Perform a bounded length test and return `T` if the length is `n`,\n`NIL` otherwise.\n\nUse this instead of `(= (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." lognot "Return the result of bitwise NOT (complement) operation on an integer." int? "Return `T` if the argument is an integer, `NIL` otherwise." nanoseconds-monotonic "Return the number of nanoseconds passed since the first call to this\nfunction.\n\nThe first call will always return 0." io-discard-buffer "Discard the contents of the output buffer of the writable IO." with-input-from "Evaluate expressions in `body` with `*io-in*` set to `io` during the\nevaluation." *stdout* "Standard output IO stream." car "Return the first element of a cons cell (head of a list) or `NIL` if\nnot available." ceiling "Return the smallest integer that is greater than or equal to `x`.\n\nInfinity and NaN `ceiling` to themselves." arr "Construct a packed array containing the specified arguments.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune." length> "Perform a bounded length test and return `T` if the length is greater\nthan `n`, `NIL` otherwise.\n\nUse this instead of `(> (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." arg-error "Raise an argument error exception." (doc93group sys) "OS-specific functions." >= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)." void? "Return `T` if `v` is `#<void>`, `NIL` otherwise." +f32-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`." length= "Perform a bounded length test and return `T` if the length is `n`,\n`NIL` otherwise.\n\nUse this instead of `(= (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." lognot "Return the result of bitwise NOT (complement) operation on an integer." int? "Return `T` if the argument is an integer, `NIL` otherwise." nanoseconds-monotonic "Return the number of nanoseconds passed since the first call to this\nfunction.\n\nThe first call will always return 0." io-discard-buffer "Discard the contents of the output buffer of the writable IO." with-input-from "Evaluate expressions in `body` with `*io-in*` set to `io` during the\nevaluation." *stdout* "Standard output IO stream." car "Return the first element of a cons cell (head of a list) or `NIL` if\nnot available." ceiling "Return the smallest integer that is greater than or equal to `x`.\n\nInfinity and NaN `ceiling` to themselves." arr "Construct a packed array containing the specified arguments.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune." length> "Perform a bounded length test and return `T` if the length is greater\nthan `n`, `NIL` otherwise.\n\nUse this instead of `(> (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." arg-error "Raise an argument error exception." (doc
94group number) "Operations on numbers, mathematical constants." asin "Return the arc sine of `x` in radians." log "Return the logarithm of `x` in `base`.\n\nDefault base is `e`, returning natural logarithm of the first\nargument." put! "Store the value associated with the key and return the table.\n\nAny existing value associated with the key will be replaced." cdaddr "Shorthand for (cdr (car (cdr (cdr lst))))." ash "Return the integer shifted by the specified number of bits to the\nright (negative `nbits`) or left (positive `nbits`)." str-sub "Return the portion of the string within the specified bounds.\n\nThe `start` and `end` index by rune. Specifying any index out of bounds\nof the string will result in an exception thrown.\n\nIf `end` isn't specified the portion is assumed to begin at `start`\nuntil the end of the original string." vec-alloc "Construct a vector of the specified `length` by repeating\nthe elements in `rest`." arr-alloc "Construct a packed array of the specified `length` by repeating\nthe elements in `rest`.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune." cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." max "Return the largest among the arguments." memv "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eqv?`." closure? "Return `T` if the argument is a function that is implemented in LISP\n(as opposed to a C builtin), `NIL` otherwise." read-all "Return a list of terms read from the IO object until it ran out of\ndata." help-print-header "Format and print signature(s) of the term for `(help term)` output." arg-counts "VM instructions mapped to their expected arguments count." sleep "Halt the StreetLISP VM for the specified duration of time in seconds.b" s16 "Construct a 16-bit signed number." rune? "Return `T` if the value is a rune, `NIL` otherwise." os-setenv "Add or replace the value of the environment variable `name` to\n`value`.\n\nIf `value` is `NIL`, the variable is deleted from the environment if\nit exists." __script "Execute a single file at `path`.\n\nAn unhandled exception will result in it being printed to `*io-err*`\nand the process exiting with a non-zero (non-empty in case OS is Plan\n9) status signaling an error to its parent.") *doc-extra* #table(append ((:doc-example . "(append '(1) '(2 3) '(4))\n; ↳ (1 2 3 4)")94group number) "Operations on numbers, mathematical constants." asin "Return the arc sine of `x` in radians." log "Return the logarithm of `x` in `base`.\n\nDefault base is `e`, returning natural logarithm of the first\nargument." put! "Store the value associated with the key and return the table.\n\nAny existing value associated with the key will be replaced." cdaddr "Shorthand for (cdr (car (cdr (cdr lst))))." ash "Return the integer shifted by the specified number of bits to the\nright (negative `nbits`) or left (positive `nbits`)." str-sub "Return the portion of the string within the specified bounds.\n\nThe `start` and `end` index by rune. Specifying any index out of bounds\nof the string will result in an exception thrown.\n\nIf `end` isn't specified the portion is assumed to begin at `start`\nuntil the end of the original string." vec-alloc "Construct a vector of the specified `length` by repeating\nthe elements in `rest`." arr-alloc "Construct a packed array of the specified `length` by repeating\nthe elements in `rest`.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune." cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." memv "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eqv?`." max "Return the largest among the arguments." closure? "Return `T` if the argument is a function that is implemented in LISP\n(as opposed to a C builtin), `NIL` otherwise." read-all "Return a list of terms read from the IO object until it ran out of\ndata." help-print-header "Format and print signature(s) of the term for `(help term)` output." arg-counts "VM instructions mapped to their expected arguments count." sleep "Halt the StreetLISP VM for the specified duration of time in seconds.b" s16 "Construct a 16-bit signed number." rune? "Return `T` if the value is a rune, `NIL` otherwise." os-setenv "Add or replace the value of the environment variable `name` to\n`value`.\n\nIf `value` is `NIL`, the variable is deleted from the environment if\nit exists." __script "Execute a single file at `path`.\n\nAn unhandled exception will result in it being printed to `*io-err*`\nand the process exiting with a non-zero (non-empty in case OS is Plan\n9) status signaling an error to its parent.") *doc-extra* #table(append ((:doc-example . "(append '(1) '(2 3) '(4))\n; ↳ (1 2 3 4)")
95(:doc-example . "(append '(1))\n; ↳ (1)") (:doc-group . list) (:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)95(:doc-example . "(append '(1))\n; ↳ (1)") (:doc-group . list) (:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
96(:doc-see . file) (:doc-see . path-delete)) cadddr ((:doc-group . list)) sort ((:doc-example . "; simple sort (note: symbols > numbers)\n(sort '(1a 1 0 2b e 3) <)\n; ↳ (0 1 3 1a 2b e)")96(:doc-see . file) (:doc-see . path-delete)) cadddr ((:doc-group . list)) sort ((:doc-example . "; simple sort (note: symbols > numbers)\n(sort '(1a 1 0 2b e 3) <)\n; ↳ (0 1 3 1a 2b e)")
97(:doc-example . "; sort in lexicographical order (as strings)\n(sort '(1a 1 0 2b e 3) < :key str)\n; ↳ (0 1 1a 2b 3 e)")97(:doc-example . "; sort in lexicographical order (as strings)\n(sort '(1a 1 0 2b e 3) < :key str)\n; ↳ (0 1 1a 2b 3 e)")
@@ -383,20 +383,18 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 285 unmodified lines
383(:doc-see . u64)) io-flush ((:doc-group . io) (:doc-see . io-discard-buffer) (:doc-see . io-buffer-mode)) assoc ((:doc-example . "(def L (assoc-list 'a 0 'b 1))\n(assoc 'b L)\n; ↳ (b . 1)\n(assoc 'c L)\n; ↳ NIL")383(:doc-see . u64)) io-flush ((:doc-group . io) (:doc-see . io-discard-buffer) (:doc-see . io-buffer-mode)) assoc ((:doc-example . "(def L (assoc-list 'a 0 'b 1))\n(assoc 'b L)\n; ↳ (b . 1)\n(assoc 'c L)\n; ↳ NIL")
384(:doc-group . list) (:doc-see . assoc-list) (:doc-see . assq) (:doc-see . assv)) + ((:doc-group . number)384(:doc-group . list) (:doc-see . assoc-list) (:doc-see . assq) (:doc-see . assv)) + ((:doc-group . number)
385(:doc-group . builtin)) path-delete ((:doc-group . io)385(:doc-group . builtin)) path-delete ((:doc-group . io)
386(:doc-see . file) (:doc-see . path-exists?)) cadadr ((:doc-group . list)) foldr1 ((:doc-example . "(foldr1 + (iota 10))\n; ↳ 45")386(:doc-see . path-exists?) (:doc-see . path-rename)) cadadr ((:doc-group . list)) foldr1 ((:doc-example . "(foldr1 + (iota 10))\n; ↳ 45")
387(:doc-group . list)387(:doc-group . list) (:doc-see . foldr) (:doc-see . foldl1)) compare ((:doc-example . "(compare 'a 'b)\n; ↳ -1")
388(:doc-see . foldr)388(:doc-example . "(compare 1 1)\n; ↳ 0")
389(:doc-see . foldl1)) compare ((:doc-example . "(compare 'a 'b)\n; ↳ -1")389(:doc-example . "(compare \"b\" \"a\")\n; ↳ 1")
390(:doc-example . "(compare 1 1)\n; ↳ 0") (:doc-example . "(compare \"b\" \"a\")\n; ↳ 1") (:doc-group . compare)390(:doc-group . compare) (:doc-group . builtin)) length ((:doc-example . "(length \"абвгд\")\n; ↳ 5")
391(:doc-group . builtin)) length ((:doc-example . "(length \"абвгд\")\n; ↳ 5")391(:doc-example . "(length #(abc 123))\n; ↳ 2") (:doc-example . "(length #table(0 a 1 b 2 c))\n; ↳ 3")
392(:doc-example . "(length #(abc 123))\n; ↳ 2")
393(:doc-example . "(length #table(0 a 1 b 2 c))\n; ↳ 3")
394(:doc-example . "(length (arr 'u32 1 2 3 4))\n; ↳ 4")392(:doc-example . "(length (arr 'u32 1 2 3 4))\n; ↳ 4")
395(:doc-example . "(length '(1 2 3 4 5))\n; ↳ 5")393(:doc-example . "(length '(1 2 3 4 5))\n; ↳ 5") (:doc-example . "(length '(1 2 3 4 . 5)) ; improper list\n; ‼ type error: expected cons, got fixnum: 5")
396(:doc-example . "(length '(1 2 3 4 . 5)) ; improper list\n; ‼ type error: expected cons, got fixnum: 5")394(:doc-example . "(length '#0=(1 . #0#)) ; circular list\n; ↳ NIL") (:doc-group . array) (:doc-group . list)
397(:doc-example . "(length '#0=(1 . #0#)) ; circular list\n; ↳ NIL")395(:doc-group . table) (:doc-see . proper-list?)) *io-err* ((:doc-group . io) (:doc-see . *io-out*)
398(:doc-group . array) (:doc-group . list) (:doc-group . table) (:doc-see . proper-list?)) *io-err* ((:doc-group . io)396(:doc-see . *io-in*)
399(:doc-see . *io-out*) (:doc-see . *io-in*) (:doc-see . with-bindings)) print-exception ((:doc-example . "(def e (list (list *stdin* 3 10) 'type-error 'str 123))\n(print-exception e)\n; ‼ *stdin*:3:10: type error: expected str, got fixnum: 123")397(:doc-see . with-bindings)) print-exception ((:doc-example . "(def e (list (list *stdin* 3 10) 'type-error 'str 123))\n(print-exception e)\n; ‼ *stdin*:3:10: type error: expected str, got fixnum: 123")
400(:doc-group . error) (:doc-see . *exception-print-level*)398(:doc-group . error) (:doc-see . *exception-print-level*)
401(:doc-see . *exception-print-length*)) error ((:doc-example . "(error \"oops: \" 123)\n; ‼ error: oops: 123")399(:doc-see . *exception-print-length*)) error ((:doc-example . "(error \"oops: \" 123)\n; ‼ error: oops: 123")
402(:doc-example . "(trycatch (error 0 \"oops\" 'extra) identity)\n; ↳ (error \"oops\" 0 extra)")400(:doc-example . "(trycatch (error 0 \"oops\" 'extra) identity)\n; ↳ (error \"oops\" 0 extra)")
@@ -428,9 +426,13 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 25 unmodified lines
428(:doc-example . "(logior 2 3 4)\n; ↳ 7")426(:doc-example . "(logior 2 3 4)\n; ↳ 7")
429(:doc-group . number)) cadr ((:doc-example . "(cadr '(1 2 3))\n; ↳ 2")427(:doc-group . number)) cadr ((:doc-example . "(cadr '(1 2 3))\n; ↳ 2")
430(:doc-example . "(cadr '(1))\n; ↳ NIL") (:doc-example . "(cadr NIL)\n; ↳ NIL") (:doc-group . list)428(:doc-example . "(cadr '(1))\n; ↳ NIL") (:doc-example . "(cadr NIL)\n; ↳ NIL") (:doc-group . list)
431(:doc-group . builtin)) cdadr ((:doc-group . list)) nan? ((:doc-group . number) (:doc-group . builtin)) caar ((:doc-group . list)) div0 ((:doc-example . "(div0 10 3)\n; ↳ 3")429(:doc-group . builtin)) cdadr ((:doc-group . list)) nan? ((:doc-group . number) (:doc-group . builtin)) caar ((:doc-group . list)) path-rename ((:doc-group . io)
432(:doc-example . "(div0 -10 3)\n; ↳ -3") (:doc-example . "(div0 -10 -3)\n; ↳ 3") (:doc-example . "(div0 10 -3)\n; ↳ -3")430(:doc-see . path-delete) (:doc-see . path-exists?)) div0 ((:doc-example . "(div0 10 3)\n; ↳ 3")
433(:doc-group . number) (:doc-see . mod0) (:doc-see . div) (:doc-group . builtin)) set-syntax! ((:doc-group . syntax)431(:doc-example . "(div0 -10 3)\n; ↳ -3")
432(:doc-example . "(div0 -10 -3)\n; ↳ 3")
433(:doc-example . "(div0 10 -3)\n; ↳ -3")
434(:doc-group . number) (:doc-see . mod0)
435(:doc-see . div) (:doc-group . builtin)) set-syntax! ((:doc-group . syntax)
434(:doc-see . defmacro) (:doc-see . get-syntax)) mod0 ((:doc-example . "(mod0 10 3)\n; ↳ 1") (:doc-example . "(mod0 -10 3)\n; ↳ -1")436(:doc-see . defmacro) (:doc-see . get-syntax)) mod0 ((:doc-example . "(mod0 10 3)\n; ↳ 1") (:doc-example . "(mod0 -10 3)\n; ↳ -1")
435(:doc-example . "(mod0 -10 -3)\n; ↳ -1") (:doc-example . "(mod0 10 -3)\n; ↳ 1") (:doc-group . number)437(:doc-example . "(mod0 -10 -3)\n; ↳ -1") (:doc-example . "(mod0 10 -3)\n; ↳ 1") (:doc-group . number)
436(:doc-see . div0) (:doc-see . mod)) last-pair ((:doc-example . "(last-pair '(1 2 3))\n; ↳ (3)")438(:doc-see . div0) (:doc-see . mod)) last-pair ((:doc-example . "(last-pair '(1 2 3))\n; ↳ (3)")
src/docs.sl+11−1
@@ -248,7 +248,17 @@ · 247 unmodified lines
248 Throws an IO error if the path does not exist or it failed to be248 Throws an IO error if the path does not exist or it failed to be
249 removed.»249 removed.»
250 :doc-group io250 :doc-group io
251 :doc-see file251 :doc-see path-exists?
252 :doc-see path-rename)
253
254(defdoc (path-rename old new)
255 «Rename a file or a directory.
256
257 Throws an IO error if the path does not exist or it failed to be
258 rename. On most operating systems (not Plan 9), files can be moved
259 between directories.»
260 :doc-group io
261 :doc-see path-delete
252 :doc-see path-exists?)262 :doc-see path-exists?)
253 263
254(defdoc (path-exists? path)264(defdoc (path-exists? path)
src/dos/sys.c+6−0
@@ -134,6 +134,12 @@ sys_fd_setup(int fd) · 133 unmodified lines
134 USED(fd);134 USED(fd);
135}135}
136 136
137int
138sys_rename(const char *old, const char *new)
139{
140 return rename(old, new);
141}
142
137void143void
138sys_init(void)144sys_init(void)
139{145{
src/io.c+10−0
@@ -577,6 +577,16 @@ BUILTIN("path-delete", path_delete) · 576 unmodified lines
577 return sl_void;577 return sl_void;
578}578}
579 579
580BUILTIN("path-rename", path_rename)
581{
582 argcount(2);
583 const char *old = tostr(args[0]);
584 const char *new = tostr(args[1]);
585 if(sys_rename(old, new) != 0)
586 bthrow(error(sl_errio, "could not rename %s to %s", old, new));
587 return sl_void;
588}
589
580void590void
581io_init(void)591io_init(void)
582{592{
src/macos/sys.c+6−0
@@ -142,6 +142,12 @@ sys_fd_setup(int fd) · 141 unmodified lines
142 USED(fd);142 USED(fd);
143}143}
144 144
145int
146sys_rename(const char *old, const char *new)
147{
148 return rename(old, new);
149}
150
145void151void
146sys_init(void)152sys_init(void)
147{153{
src/plan9/sys.c+11−0
@@ -195,6 +195,17 @@ sys_open(const char *fname, ios_flags flags, usize mode) · 194 unmodified lines
195 : open(fname, of);195 : open(fname, of);
196}196}
197 197
198int
199sys_rename(const char *old, const char *new)
200{
201 Dir d;
202
203 nulldir(&d);
204 d.name = new;
205
206 return dirwstat(old, &d) > 0 ? 0 : -1;
207}
208
198void209void
199sys_fd_setup(int fd)210sys_fd_setup(int fd)
200{211{
src/posix/sys.c+6−0
@@ -210,6 +210,12 @@ sys_fd_setup(int fd) · 209 unmodified lines
210 USED(fd);210 USED(fd);
211}211}
212 212
213int
214sys_rename(const char *old, const char *new)
215{
216 return rename(old, new);
217}
218
213BUILTIN("getpid", getpid)219BUILTIN("getpid", getpid)
214{220{
215 USED(args);221 USED(args);
src/slpriv.h+2−0
@@ -208,8 +208,10 @@ char *uint2str(char *dest, usize len, u64int num, int base) sl_nonnull(1) sl_ret · 207 unmodified lines
208// these wrappers retry operations until success or a fatal error208// these wrappers retry operations until success or a fatal error
209int sys_read(int fd, u8int *buf, usize n, usize *nread) sl_fd_rd(1) sl_wr(2, 3) sl_wr(4) sl_nonnull(2, 4);209int sys_read(int fd, u8int *buf, usize n, usize *nread) sl_fd_rd(1) sl_wr(2, 3) sl_wr(4) sl_nonnull(2, 4);
210int sys_write(int fd, const void *buf, usize n, usize *nwritten) sl_fd_wr(1) sl_rd(2, 3) sl_wr(4) sl_nonnull(2, 4);210int sys_write(int fd, const void *buf, usize n, usize *nwritten) sl_fd_wr(1) sl_rd(2, 3) sl_wr(4) sl_nonnull(2, 4);
211
211int sys_open(const char *fname, ios_flags flags, usize mode) sl_cstr(1) sl_nonnull(1);212int sys_open(const char *fname, ios_flags flags, usize mode) sl_cstr(1) sl_nonnull(1);
212void sys_fd_setup(int fd) sl_fd(1);213void sys_fd_setup(int fd) sl_fd(1);
214int sys_rename(const char *old, const char *new) sl_cstr(1) sl_cstr(2) sl_nonnull(1, 2);
213 215
214void bcc_init(void);216void bcc_init(void);
215void compress_init(void);217void compress_init(void);
src/windows/sys.c+6−0
@@ -177,6 +177,12 @@ sys_fd_setup(int fd) · 176 unmodified lines
177 _setmode(fd, _O_BINARY);177 _setmode(fd, _O_BINARY);
178}178}
179 179
180int
181sys_rename(const char *old, const char *new)
182{
183 return rename(old, new);
184}
185
180void186void
181sys_init(void)187sys_init(void)
182{188{
test/io.sl+7−2
@@ -124,7 +124,7 @@ · 123 unmodified lines
124(assert-fail (path-cwd "." ".") arity-error)124(assert-fail (path-cwd "." ".") arity-error)
125(assert-fail (path-cwd "does/not/exist") io-error)125(assert-fail (path-cwd "does/not/exist") io-error)
126 126
127;; path-exists? + path-delete127;; path-exists? + path-rename + path-delete
128(assert (path-exists? "."))128(assert (path-exists? "."))
129(assert (not (path-exists? "doesnotexist.txt")))129(assert (not (path-exists? "doesnotexist.txt")))
130(assert-fail (path-delete "doesnotexist.txt") io-error)130(assert-fail (path-delete "doesnotexist.txt") io-error)
@@ -139,8 +139,13 @@ · 8 unmodified lines
139(assert-fail (io-write f (u8 0)) io-error) ; write on read-only139(assert-fail (io-write f (u8 0)) io-error) ; write on read-only
140(assert (eof? (io-read f 'u8)))140(assert (eof? (io-read f 'u8)))
141(assert (void? (io-close f)))141(assert (void? (io-close f)))
142(assert (path-delete "doesexist.txt"))142(assert-fail (path-rename "doesnotexist.txt" "moved.txt"))
143(assert (path-rename "doesexist.txt" "moved.txt"))
143(assert (not (path-exists? "doesexist.txt")))144(assert (not (path-exists? "doesexist.txt")))
145(assert (path-exists? "moved.txt"))
146(assert (path-delete "moved.txt"))
147(assert (not (path-exists? "doesexist.txt")))
148(assert-fail (path-delete "moved.txt"))
144 149
145(def lines '("12345 абвгд weoiwhefohwefoihweoifh wefiweu3209u092039 jhksjdvksdjvbksdvb qwhqhfohwefe weofhweofhoiewhfoiwhefh\n"150(def lines '("12345 абвгд weoiwhefohwefoihweoifh wefiweu3209u092039 jhksjdvksdjvbksdvb qwhqhfohwefe weofhweofhoiewhfoiwhefh\n"
146 "hello, world!\n"151 "hello, world!\n"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t