mirror of
https://github.com/janet-lang/janet
synced 2025-04-14 23:03:13 +00:00
parent
a3d4ecddba
commit
77343e02e9
@ -2,6 +2,7 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased
|
||||
- Add `chr` macro.
|
||||
- Allow `_` in the `match` macro to match anything without creating a binding
|
||||
or doing unification.
|
||||
- Add `:range-to` and `:down-to` verbs in the `loop` macro.
|
||||
|
@ -316,6 +316,13 @@
|
||||
,payload
|
||||
(propagate ,res ,fib)))))
|
||||
|
||||
(defmacro chr
|
||||
"Convert a string of length 1 to its byte (ascii) value at compile time."
|
||||
[c]
|
||||
(unless (and (string? c) (= (length c) 1))
|
||||
(error (string/format "expected string of length 1, got %v" c)))
|
||||
(c 0))
|
||||
|
||||
(defmacro label
|
||||
"Set a label point that is lexically scoped. Name should be a symbol
|
||||
that will be bound to the label."
|
||||
|
@ -136,4 +136,7 @@
|
||||
(assert (deep= @"cde" (buffer/blit @"" a -1 2 5)) "buffer/blit 4")
|
||||
(assert (deep= @"de" (buffer/blit @"" a -1 3 5)) "buffer/blit 5")
|
||||
|
||||
# chr
|
||||
(assert (= (chr "a") 97) "chr 1")
|
||||
|
||||
(end-suite)
|
||||
|
Loading…
x
Reference in New Issue
Block a user