Fork me on GitHub
#beginners
<
2022-08-18
>
quan xing00:08:19

How do I align comments in VSCode. I press TAB can aligned clojure code, but comments is not align. I press Space key every time

Evan Z01:08:57

When working with CIDER/shadow-cljs, do you expect stuff in the browser to update when you C-x C-e?

Drew Verlee04:08:53

I think so, assume that's an eval command.

quan xing03:08:34

In vscode use ctrl+alt+c i`` can instrument a top level function for debugging like this : the function name add double line. How can I cancel it , exit debugging

dpsutton03:08:55

Most likely just reevaluate the function

quan xing04:08:41

alt+enter the function is break everytime. I don't know how to cancel it

chucklehead04:08:59

Shift+F5 should exit the debugger, or there should be a debug toolbar that looks like, and you can click the icon on the right

pez05:08:07

Re-evaluating the function definition should do it.

popeye10:08:44

does array-map guarantees the order of elements when retrieving?

delaguardo10:08:07

what do you mean by retrieving?

delaguardo11:08:06

if you want to iterate over array-map the order will be the same as it was when array-map was called. But if your array-map is big (> 32 elements (?), unsure about exact number) adding an element might turn array-map into hash-map which does not preserve insertion order.

popeye11:08:08

Thanks for the response @U04V4KLKC

popeye11:08:24

Which collection type provide me insertion order ?

delaguardo11:08:42

nothing from clojure core, but there is a library - https://github.com/clj-commons/ordered

popeye11:08:46

i mean if I add a value in the list ( 1 2 3 4 5 6 7 8 9) does it return in same order when I try to retrieve it?

delaguardo11:08:16

and usually when I start looking at this library it is an indicator I should be using different data structure in the first place. sequence or vector

delaguardo11:08:58

retrieve how?

delaguardo11:08:14

and how you add an element to the list, this is also important.

delaguardo11:08:50

fyi, array-map has nothing to do with list

popeye11:08:15

ex- if I retrieve it using for -loop or doseq does it return in the same order ? 1 - 9 or , it might shuffle the order

delaguardo11:08:21

no, the order will be the same as it was in the list.

popeye11:08:24

Same if we use vector?

delaguardo11:08:32

maybe you could explain your problem a bit more?

popeye12:08:20

No, this confirmation should be fine for me 🙂 Thanks

andy.fingerhut17:08:33

for, map, and many other Clojure functions and macros that "iterate over elements of a collection" do so by calling seq on that collection. So it is the order of elements returned by seq on that collection that is the implementation issue that answers your question.

andy.fingerhut17:08:54

seq on lists and vectors is guaranteed to contain elements in the order that they are in that list or vector.

andy.fingerhut17:08:55

seq on a Clojure map returns the same key/value pairs in the same order for the same identical Clojure map object, but if you then add a new key, or remove a key, to produce a new Clojure map, calling seq on the new map provides no guarantees on the relative order of key/value pairs, as compared to the original map.

andy.fingerhut17:08:09

seq on the ordered library variant of maps does provide guarantees that key/value pairs will be returned in "insertion order", as described in its documentation, because its implementation is different than the built-in Clojure maps.

schmalz16:08:38

Hi, I'm struggling with following the instructions to build an uberjar in https://clojure.org/guides/tools_build! It's almost certainly something laughably simple, but when I run clj -T:build uber I get an error:

Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
-T:build (No such file or directory)
So I don't think it's even getting to the function defn in my build.clj file! Any help would be much appreciated!

hiredman16:08:26

where did you get clj from

schmalz16:08:43

That's a good point, I think the one I have is a little out of date!

ls -l `which clj`
-rwxr-xr-x 1 root root 217 Sep 15  2018 /usr/local/bin/clj

schmalz16:08:54

Much better:

clj -version
Clojure CLI version 1.11.1.1155
Thank you for your help - I have an uberjar now!

hiredman16:08:42

it may not be the same command referenced in that guide