Skip to content

Commit

Permalink
small steps
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-johnson-4 committed Nov 15, 2024
1 parent b208aaf commit 0d6f1bb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions PLATFORM/C/LIB/smart-string.lm
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,25 @@ print := λ(: x SmartString). (: (
) ())
(SmartString( (.data x) lowp hip ))
) SmartString);

tail-string := λ(: x SmartString). (: (
([:]( 1_i64 (.length x) ))
) SmartString);

[] := λ(: x SmartString)(: low I64). (: (
(if (<( low 0_i64 )) (
(set low (+( (as (.length x) I64) low )))
) ())
(let lowp (+( (.start x) low )))
(if (<( lowp (.start x) )) (
(fail 'Index\sOut\sOf\sBounds:\sSmartString.[]_s)
) ())
(if (>=( lowp (.end x) )) (
(fail 'Index\sOut\sOf\sBounds:\sSmartString.[]_s)
) ())
([]( lowp 0_u64 ))
) U8);

head-string := λ(: x SmartString). (: (
([]( 0_i64 ))
) SmartString);

0 comments on commit 0d6f1bb

Please sign in to comment.