Skip to content

Commit

Permalink
BuiltinHint: implement print (#476)
Browse files Browse the repository at this point in the history
* add print array utils

* add print_felt test

* add print_dict

* add missing semicolon

---------

Co-authored-by: lanaivina <[email protected]>
  • Loading branch information
TropicalDog17 and lana-shanghai authored Apr 15, 2024
1 parent 28df66d commit 0227e1a
Show file tree
Hide file tree
Showing 12 changed files with 23,973 additions and 2 deletions.
20 changes: 20 additions & 0 deletions cairo_programs/print_features/print_array.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%builtins range_check

from starkware.cairo.common.alloc import alloc

func main{range_check_ptr: felt}() {
let name = 0x4b4b5254;
let (arr: felt*) = alloc();
assert arr[0] = 1;
assert arr[1] = 2;
assert arr[2] = 3;
assert arr[3] = 4;
assert arr[4] = 5;
let arr_len = 5;
%{
print(bytes.fromhex(f"{ids.name:062x}").decode().replace('\x00',''))
arr = [memory[ids.arr + i] for i in range(ids.arr_len)]
print(arr)
%}
return();
}
Loading

0 comments on commit 0227e1a

Please sign in to comment.