Carp/examples/bugs.carp
2018-02-02 12:07:13 +01:00

32 lines
742 B
Plaintext

;; This file contains examples of unsolved bugs
;; (load "Debug.carp")
;; (Debug.sanitize-addresses)
(project-set! "printAST" "true")
;; This shouldn't compile:
;; (defn faulty-repeat [n inpt]
;; (let [str ""]
;; (do
;; (for [i 0 n]
;; (set! &str &(append @str @inpt)))
;; @str)))
;; (defn main []
;; (let [strings (faulty-repeat 20 "x")]
;; (IO.println &strings)))
;; Instantiating generic struct with ref-type fails:
;; (deftype (Triv a) [x a])
;; (defn g [] (Triv.init &123))
;; (defn main []
;; (println* &(g)))
(defn main []
(let-do [t [1 2 3]
t-field (Array.nth &t 1)]
(do
(IO.println &(str @t-field))
(set! &t [4 5 6])
(IO.println &(str @t-field)))))