This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-28
Channels
- # announcements (92)
- # aws (7)
- # babashka (13)
- # beginners (42)
- # clj-kondo (9)
- # cljdoc (25)
- # clojure (156)
- # clojure-europe (19)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-sg (1)
- # clojure-spec (3)
- # clojure-uk (6)
- # clojurescript (21)
- # copenhagen-clojurians (1)
- # cryogen (3)
- # cursive (9)
- # datahike (3)
- # datomic (5)
- # emacs (8)
- # graphql (4)
- # introduce-yourself (3)
- # jobs (2)
- # malli (1)
- # meander (8)
- # nrepl (3)
- # off-topic (8)
- # om-next (2)
- # pathom (11)
- # rdf (5)
- # reagent (59)
- # remote-jobs (4)
- # shadow-cljs (8)
- # tools-build (23)
- # vim (16)
If these don’t meet your needs, we could use more details on your use case @imxingquan
yes by By using sql `LIMIT` and `OFFSET` . Should I need to write 2 sql 'select count' and 'select limit', shouldn't I?
Or check the number of results you're getting back. Depends what you're doing with it
Tis a bad idea, generally to use LIMIT and OFFSET for doing pagination, it becomes a bigger bigger problem for larger and larger result sets
https://stackoverflow.com/questions/802373/how-to-count-and-limit-record-in-a-single-query-in-mysql ... Mysql will let you get the total number of rows without running the whole query twice.
(def foosym ^{:foo 10} (fn []))
does this not put the meta on the function? Where do I find the meta data when I do it like this?it puts metadata to the function not the var
(def foosym ^{:foo 10} (fn []))
(meta @#'foosym) ;; => {:foo 10}
functions (generically) do not support metadata (although some impls do in some cases)
that is, in impl types, IFn does not extend IMeta
but then why this happen?
(def foosym ^{:foo 10} (fn []))
(meta @#'foosym) ;; => {:foo 10}
Because AFunction supports metadata see: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFunction.java
But the interface IFn and Fn don't have too. Functions created with (fn ...) are going to be AFunction so that they can have meta which tells you the function name and column/line and all that I believe.
But all other functions not created with fn
unless they themselves implements IObj and IMeta won't support metadata.
> (although some impls do in some cases)
but I would not generally rely on this
if you read https://clojure.org/reference/metadata, it says "Note that metadata reader macros are applied at read-time, not at evaluation-time, and can only be used with values that support metadata, like symbols, vars, collections, sequences, namespaces, refs, atoms, agents, etc."
Speaking of interfaces like IFn
and IMeta
: I often see pertinent mentions of Clojure implementation details (most often interfaces), in in-depth answers to some more advanced questions. Is there a recommended resource (book/site/other) for learning about the most important bits of Clojure's implementation, and how they fit together?
I do not think that exists anywhere. There are some info and diagrams in Clojure Applied that cover parts of it
specifically the collection/seq parts
https://insideclojure.org/2016/03/16/collections/ covers similar ground
Thanks, @alexmiller. That's the kind of answer I was expecting. 👍
Is there any way to use Intelli-J/Cursive to generate clojure bindings for a local java projct?
How do I discriminate between values like '[:foo 1]
and [:foo 1]
?
user=> ''[:foo 1]
(quote [:foo 1])
user=>
before evaluation ' is a reader macro that wraps things in a list where the first item in the list is the symbol quoteusually if you are trying to distinguish the two you are starting to make a mistake with macros
Trying to write a function that accepts either a Datomic/Datascript query '[:find ...]
or a pull expression against a default query
for a function, functions receive evaluated arguments, in which case '[:foo 1]
and [:foo 1]
are identical
Gotcha, that makes sense