Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
[ ' [ 0 0 ] ] is point ( --> [ )
|
||||
|
||||
[ 0 ] is x ( --> n )
|
||||
|
||||
[ 1 ] is y ( --> n )
|
||||
|
||||
point
|
||||
dup x peek echo cr
|
||||
99 swap y poke
|
||||
y peek echo cr
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
struct{
|
||||
item.0
|
||||
{ item.1.0
|
||||
item.1.1
|
||||
{ item.1.2.0
|
||||
item.1.2.1
|
||||
item.1.2.2
|
||||
item.1.2.3
|
||||
} item.1.2
|
||||
item.1.3
|
||||
} item.1
|
||||
item.2
|
||||
}struct mystruct
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
mystruct ( create new instance of a mystruct )
|
||||
dup echo cr ( this is what it looks like )
|
||||
789 swap item.1.3 {poke} ( change one of the items )
|
||||
dup echo cr ( this is what it looks like now )
|
||||
item.1.3 {peek} echo cr ( retrieve the specified item )
|
||||
108
Task/Compound-data-type/Quackery/compound-data-type-4.quackery
Normal file
108
Task/Compound-data-type/Quackery/compound-data-type-4.quackery
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
[ witheach peek ] is {peek} ( { p --> x )
|
||||
|
||||
[ dip dup
|
||||
witheach [ peek dup ]
|
||||
drop ] is depack ( { p --> * )
|
||||
|
||||
[ reverse
|
||||
witheach
|
||||
[ dip swap poke ] ] is repack ( * p --> { )
|
||||
|
||||
[ dup dip
|
||||
[ rot dip
|
||||
[ depack drop ] ]
|
||||
repack ] is {poke} ( x { p --> { )
|
||||
|
||||
[ this ] is null ( --> [ )
|
||||
|
||||
[ stack ] is {}.path ( --> s )
|
||||
protect {}.path
|
||||
|
||||
[ stack ] is {}.struct ( --> s )
|
||||
protect {}.struct
|
||||
|
||||
[ nextword dup
|
||||
$ "" = if
|
||||
[ $ "Unexpected end of struct."
|
||||
message put
|
||||
bail ] ] is {}.checknext ( [ $ --> [ $ $ )
|
||||
|
||||
[ dup $ "{" =
|
||||
over $ "}" = or
|
||||
swap $ "}struct" = or if
|
||||
[ $ "Name missing after }."
|
||||
message put
|
||||
bail ] ] is {}.checkname ( [ $ $ --> [ $ )
|
||||
|
||||
[ nested
|
||||
namenest take
|
||||
join
|
||||
namenest put
|
||||
' [ ' ]
|
||||
{}.path share nested join
|
||||
actiontable take
|
||||
1 stuff
|
||||
actiontable put ] is {}.addpath ( [ $ $ --> [ $ )
|
||||
|
||||
[ nested
|
||||
namenest take
|
||||
join
|
||||
namenest put
|
||||
' [ ' ]
|
||||
{}.struct share nested join
|
||||
actiontable take
|
||||
1 stuff
|
||||
actiontable put ] is {}.addstruct ( [ $ $ --> [ $ )
|
||||
|
||||
[ {}.path take
|
||||
dup -1 peek
|
||||
1+
|
||||
swap -1 poke
|
||||
-1 join
|
||||
{}.path put
|
||||
[] {}.struct put ] is {}.{ ( [ $ --> [ $ )
|
||||
|
||||
[ {}.struct size 3 < if
|
||||
[ $ "Badly formed struct."
|
||||
message put bail ]
|
||||
trim {}.checknext
|
||||
dup {}.checkname
|
||||
{}.path take
|
||||
-1 split drop
|
||||
{}.path put
|
||||
{}.addpath
|
||||
{}.struct take
|
||||
{}.struct take
|
||||
swap nested join
|
||||
{}.struct put ] is {}.} ( [ $ --> [ $ )
|
||||
|
||||
[ {}.path take
|
||||
dup -1 peek
|
||||
1+
|
||||
swap -1 poke
|
||||
{}.path put
|
||||
{}.addpath
|
||||
{}.struct take
|
||||
' [ null ] join
|
||||
{}.struct put ] is {}.name ( [ $ --> [ $ )
|
||||
|
||||
[ trim {}.checknext
|
||||
{}.struct size
|
||||
2 != if
|
||||
[ $ "Badly formed struct."
|
||||
message put
|
||||
bail ]
|
||||
{}.addstruct ] is {}.}struct ( [ $ --> [ $ )
|
||||
|
||||
[ ' [ -1 ] {}.path put
|
||||
[] {}.struct put
|
||||
[ trim {}.checknext
|
||||
dup $ "{" = iff
|
||||
[ drop {}.{ ] again
|
||||
dup $ "}" = iff
|
||||
[ drop {}.} ] again
|
||||
dup $ "}struct" = iff
|
||||
[ drop {}.}struct ] done
|
||||
{}.name again ]
|
||||
{}.struct release
|
||||
{}.path release ] builds struct{ ( [ $ --> [ $ )
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
struct{ x y }struct point
|
||||
point
|
||||
dup x {peek} echo cr
|
||||
99 swap y {poke}
|
||||
y {peek} echo cr
|
||||
Loading…
Add table
Add a link
Reference in a new issue