Finally make a clean sweep and delete / organize old files. Add skeleton for LaTeX formal writeup in doc/ and change license (since this is all new code from the past few years) to BSD-2-Clause-Patent
This commit is contained in:
49
working_files/match_test.kp
Normal file
49
working_files/match_test.kp
Normal file
@@ -0,0 +1,49 @@
|
||||
(with_import "./match.kp"
|
||||
(do
|
||||
(println "first "
|
||||
(match 1
|
||||
1 true
|
||||
a (+ a 1)
|
||||
))
|
||||
|
||||
(println "second "
|
||||
(match 3
|
||||
1 true
|
||||
a (+ a 1)
|
||||
))
|
||||
(println "third "
|
||||
(match "str"
|
||||
1 true
|
||||
"str" "It was a string!"
|
||||
a (+ a 1)
|
||||
))
|
||||
(println "fourth "
|
||||
(match [ 1337 "str" ]
|
||||
1 true
|
||||
"str" "It was a string!"
|
||||
[ 1337 "str" ] "matched an array of int str"
|
||||
a (+ a 1)
|
||||
))
|
||||
(println "fifth "
|
||||
(match [ 1337 "str" 'sy ]
|
||||
1 true
|
||||
"str" "It was a string!"
|
||||
[ 1337 "str" 'sy ] "matched an array of int str symbol"
|
||||
a (+ a 1)
|
||||
))
|
||||
(println "sixth "
|
||||
(match [ 1337 "str" 'walla + 11 false 'kraken [ 'inner 'middle 'end ] [ 'inner1 'middle1 'end1 ] ]
|
||||
1 true
|
||||
"str" "It was a string!"
|
||||
[ 1337 "str" 'walla + a false b [ 'inner c 'end ] d ] (str "matched, and got " a b c d)
|
||||
a (+ a 1)
|
||||
))
|
||||
(println "seventh "
|
||||
(let (b 2)
|
||||
(match [ 1337 [ 1 2 3] 11 ]
|
||||
1 true
|
||||
"str" "It was a string!"
|
||||
[ 1337 [ a ~b c] 11 ] (str "matched, and got " a c " while checking based on inserted " b)
|
||||
a "sigh, failed to match"
|
||||
)))
|
||||
))
|
||||
Reference in New Issue
Block a user