mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-05 22:48:42 +00:00
variable namespace, function declaration fixes
This commit is contained in:
parent
c31b20fa24
commit
f973f65b5b
17 changed files with 511 additions and 98 deletions
|
|
@ -16,7 +16,7 @@ def fact : n =
|
|||
| _ -> error "n must be positive"
|
||||
|
||||
decl find_prefix_hashes ('H : (#AccHash Char)) : String -> (Array 'H)
|
||||
def find_prefix_hashes 'H : str = {
|
||||
def find_prefix_hashes : str = {
|
||||
var hashes = (Array 'H).new (str.size () + 1)
|
||||
|
||||
; hashes:0 = 'H.of str:0
|
||||
|
|
@ -38,7 +38,7 @@ def find_substring : str substr = {
|
|||
const substr_hash = Hash.of substr
|
||||
|
||||
for i in 0..(str_hashes.size () - substr.size ()) do {
|
||||
const part_hash = Hash.diff str_hashes:(i + substr->size ()) str_hashes:i
|
||||
const part_hash = Hash.diff str_hashes(i + substr->size ()) str_hashes:i
|
||||
|
||||
if part_hash == substr_hash then {
|
||||
; result.push i
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue