Fork me on GitHub
Edward Ciafardini12:08:58

I'm trying to update this so that it works with the current ns form rules: lein test keeps failing and giving messages like: Syntax error macroexpanding clojure.core/ns at (twilio/core.clj:1:1). import - failed: #{:refer-clojure} at: [:ns-clauses :refer-clojure :clause] spec: :clojure.core.specs.alpha/ns-refer-clojure

Edward Ciafardini12:08:09

I replaced the (import [ URLEncoder]) with ring.util.codec and that seemed to resolve the issue.


is there a (core) predicate that answers whether something is a scalar? Like #{int? string? ...}


No, as that is an open ended set


complement coll? is probably closest, but colls are also an open ended set

👍 3

I often stub my toes against exactly that notion. In some talk about spec it was said “There can always be more stuff”. I don’t need to enumerate all the things nor do I need to find some abstraction over that. Just specify what is needed where it is needed. Ty


“not a composite value”


well string is a composite value, but you know what I mean


I'm not sure what you mean by composite ... What would be some qualifying inputs? 7 ? 3.14159 ? radical 2 ?


@denis.baudinot Maybe (complement sequential?)? ... Sorry on my phone so I can't actually check it

Jon Boone15:08:18

something other than number?


There's number? ... so one could do (complement number?) perhaps


@denis.baudinot (complement coll?) perhaps?


Maybe it should be an explicit set


(`sequential?` is not true of several collection types so (complement sequential?) won't be accurate)


Clojure is open to new scalars and new coll types


Perhaps if you explain the problem you're trying to solve, we can offer a more specific solution?

☝️ 3

I’m thinking im terms of “a thing that is inherently atomic” in database terms


I cannot really say that can I?


“Sean, Alex, Jon, L0st, Sova”


I guess a best effort would be (complement coll?)


I'm not even sure what "inherently atomic" in database terms means -- that depends on the database technology, doesn't it?


Yeah that’s the problem: I don’t use a specific database, just that’s where the idea comes from I guess


first normal form


In some databases, that would be a whole document (definitely a "collection" of data), in others it would be a row, in others just a tuple...


“not complex and not a function”


Atomic = a single bit? :)


But, again, what problem are you trying to solve?


Right I guess In terms of SQL or Datalog databases


I recently added vectors as an atomic type for the Asami database, though I did (arbitrarily) restrict them to not allowing collection types as members. So it’s definitely vague!

👍 2

I'm not hearing a problem statement here, just academic curiosity about terminology 🙂


ok sorry 🙂 I have to think about it more before I can ask the right question! ty


I consider operations as something that can be atomic, not values.


dev=> (doc compare-and-set!)
([atom oldval newval])
  Atomically sets the value of atom to newval if and only if the
  current value of the atom is identical to oldval. Returns true if
  set happened, else false
Atomic operation.


dev=> (doc swap!)
([atom f] [atom f x] [atom f x y] [atom f x y & args])
  Atomically swaps the value of atom to be:
  (apply f current-value-of-atom args). Note that f may be called
  multiple times, and thus should be free of side effects.  Returns
  the value that was swapped in.
Atomic operation.


I guess it is easier to think of it in scheme, where it wouldn’t have a car/cdr


(and that's true of databases too: ACID - Atomic, etc - refers to operations)


I’m led to think of mathematical logic, and in particular Prolog, where base terms are called atoms


Ty for your answers and hints. I resolved the issue, for reference: I realised that this part of the program doesn’t know or shouldn’t care if that makes sense. I tried to write a spec for something that this module can’t possibly validate without leaking the implementation of another module.


So my question was wrong in the first place 😄


😄 those are some of the best questions. At least you are interrogating / questioning what is possible while preserving simplicity. It sounds like you want to know the type of the data and just be wary of turning any generic screw drivers into fruit-brand context-specific screw drivers that cost extra. it's the right-to-repair movement for your source code 😛

😄 2
Parvesh Monu19:08:43

Hi everyone, I hope you all are doing great. I am very new to Clojure World. I am working on a ClojureScript, shadow-cljs project. I am trying to use an npm package in the project. I installed it using "yarn add react-native-swipe-list-view".  But I don't know if something is wrong with the package or this is not the right way to add a dependency. Because that added module is showing Syntax Error: "Cannot use Import Statement outside a module". It will be a big help if someone can point me to a resource to fix this issue. I posted other Info's like screenshots on this URL:


@U02AB40BP0W you want want to ask in #shadow-cljs "yarn add" is the right way to add a js dep. What is make test running?


I feel like that might just a bug in that library. it seem rather self contained.

Parvesh Monu22:08:44

Hi @ , Thank you very much for your reply. According to my research shadow-cljs implements a custom JS bundler and bundles node_modules into something that can be used with clojurescript. And that npm package uses ES6 Syntax and shadow-cljs having trouble bundling that. I think I need to use babel to convert that into browser-friendly code first. I just need to figure out how to use babel to do that. You are right I should ask question in #shadow-cljs Thanks


Are you just doing: (:require ["module-name" :refer (export)])

Parvesh Monu22:08:19

@U0K064KQV Thank you very much for your reply. Yes, it mentions adding the dependency. Also, what will be the similar syntax to ES6 to use for coding in clojurescript. But problem is, npm package that I added is using ES6 syntax.


Ya, that's fine, shadow works with ES6 imports as well

Parvesh Monu22:08:42

I don't know but here it is breaking, just because package has ES6 syntax


I think you're not using the package correctly

Parvesh Monu22:08:14

As you can see in error message in link, error is only in node_modules directory. That I not even modified. Problem is happening while shadow-cljs converting that code for clojurescript


I think you might want: (:require ["react-native-swipe-list-view" :refer (SwipeRow)]) maybe? I'm not too sure, but I know that shadow should be able to handle ES6


Ya, I think you are just not using the right syntax for importing in ClojureScript.


Or you might need to do: swipe-list-view/SwipeRow maybe?

Parvesh Monu23:08:01

This is my swiper search for keyword react-native-swipe-list-view. You can see there is only one manually added place, others are automated files like yarn.lock. And you can see my import there.


SwipeRow is supposed to be a Class?

Parvesh Monu23:08:03

Oh sorry I forget to mention, I am quite sure about syntax. Because I am able to run code and app is running on phone with this imported class. Means this code is right.


oh, its just the bundling that's struggling? Ya, you'd probably need theller to help you with that

Parvesh Monu23:08:10

bundling is the issue


It could be you're not specifying something as a module that should be

Parvesh Monu23:08:18

Ya that's good advice, I am messaging him. Thanks!


Ya, he'll be better help, I'm also a beginner with JS and ClojureScript 😛

😄 2
Parvesh Monu23:08:46

Still, Thank you very much for your time. 🙂