We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This sequence:
(let [q (atom []) qpush (fn [q val] (swap! q conj val)) qpop (fn [q] (let [val (first @q)] (swap! q #(doall (subvec % 1))) val))] (qpush q 0) (qpush q 1) (let [p1 (qpop q)] (qpush q 2) ;; <- necessary ingredient (let [p2 (qpop q)] (prn :qpop2 p2) (prn :q @q))))
...fails like this during the second qpop:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..2: 3 #0 List.[] (dart:core-patch/array.dart:121:36) #1 PVIterator.current (package:matrix/cljd-out/cljd/core.dart:12525:13) #2 iterator_seq (package:matrix/cljd-out/cljd/core.dart:27415:66) #3 IteratorSeq.$_rest$0 (package:matrix/cljd-out/cljd/core.dart:12172:51) #4 IteratorSeq.$_next$0 (package:matrix/cljd-out/cljd/core.dart:12183:38) #5 next (package:matrix/cljd-out/cljd/core.dart:29328:52) #6 dorun$ifn.$_invoke$1 (package:matrix/cljd-out/cljd/core.dart:23451:24) #7 doall$ifn.$_invoke$1 (package:matrix/cljd-out/cljd/core.dart:23406:23) #8 main.qpop$1.<anonymous closure> (package:matrix/cljd-out/tiltontec/main.dart:44:31) #9 Atom.$_swap$BANG_$1 (package:matrix/cljd-out/cljd/core.dart:3683:28) #10 swap$BANG_$ifn.$_invoke$2 (package:matrix/cljd-out/cljd/core.dart:33376:17) #11 main.qpop$1 (package:matrix/cljd-out/tiltontec/main.da<…>
Change the doall to do and it fails printing the vector after the second qpop:
doall
do
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: RangeError (index): Invalid value: Not in inclusive range 0..2: 3 #0 List.[] (dart:core-patch/array.dart:121:36) #1 pv_reduce$ifn.$_invoke$5 (package:matrix/cljd-out/cljd/core.dart:30565:43) #2 SubVec.$_reduce$2 (package:matrix/cljd-out/cljd/core.dart:16947:35) #3 print_sequential (package:matrix/cljd-out/cljd/core.dart:30290:47) #4 SubVec.$_print$1 (package:matrix/cljd-out/cljd/core.dart:16746:24) #5 pr$ifn.$_invoke$vararg (package:matrix/cljd-out/cljd/core.dart:30069:43) #6 IFnMixin_XZ.$_apply$1 (package:matrix/cljd-out/cljd/core.dart:6701:14) #7 apply$ifn.$_invoke$2 (package:matrix/cljd-out/cljd/core.dart:18006:51) #8 prn$ifn.$_invoke$vararg (package:matrix/cljd-out/cljd/core.dart:30355:23) #9 IFnMixin_Z.$_invoke$2 (package:matrix/cljd-out/cljd/core.dart:6902:14) #10 main (package:matrix/cljd-out/tiltontec/main.dart:54:29) #11 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:<…>
The text was updated successfully, but these errors were encountered:
FWIW, this works:
(defn fifo-pop [q] (when-not (fifo-empty? q) (let [val (first @q)] (swap! q #(vec (rest %))) val)))
Sorry, something went wrong.
Fixed, thx eadb195
No branches or pull requests
This sequence:
...fails like this during the second qpop:
Change the
doall
todo
and it fails printing the vector after the second qpop:The text was updated successfully, but these errors were encountered: