This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (3)
- # beginners (83)
- # calva (11)
- # cider (24)
- # cljdoc (2)
- # cljs-dev (1)
- # clojure (216)
- # clojure-berlin (1)
- # clojure-dev (18)
- # clojure-europe (8)
- # clojure-italy (5)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-spec (34)
- # clojure-uk (75)
- # clojuredesign-podcast (12)
- # clojurescript (33)
- # clojutre (13)
- # community-development (1)
- # core-async (38)
- # crux (8)
- # cursive (19)
- # datomic (28)
- # duct (3)
- # emacs (1)
- # events (5)
- # figwheel-main (3)
- # fulcro (93)
- # kaocha (20)
- # lambdaisland (2)
- # off-topic (40)
- # pathom (17)
- # pedestal (8)
- # quil (1)
- # re-frame (14)
- # reitit (19)
- # shadow-cljs (34)
- # sql (8)
- # tools-deps (6)
- # vim (1)
- # yada (18)
I wonder why clojure's relational algebra functions (in
clojure.set) are based off of "tables" being sets of maps, when relations aren't usually sets (they can contain duplicate rows)
if you read Codd's original database stuff (like https://www.seas.upenn.edu/~zives/03f/cis550/codd.pdf), it's sets. later was extended to bags and that became the norm in sql.
hey team im still a little confused by the quote macro https://clojure.org/reference/reader#_quote would someone be able to give me another example of the usage outside of the one provide? or some additional context around it?
the Clojure evaluation model is to read (turn characters into Clojure data), then evaluate that Clojure data
the two main special cases are symbols (which evaluate to what they refer to) and lists (which invoke the first element of the list with the other elements as args)
so the places where quote is useful are mostly where you want to suspend evaluation - symbols and lists
as a shortcut it's being used on the vector, but really it's like
(require ['honeysql.core :as 'sql] ['honeysql.helpers :refer :all :as 'helpers])
would you be able to give a "real world" example of when you would want to use a read list?
but a lot of the power of Clojure/Lisp/homoiconicity is that your code IS data and you can manipulate it as such
and that means you can make a dsl that uses literal lists and choose to interpret it
spec is another example - in
(s/def ::foo (s/and int? pos?)) - the
(s/and int? pos?) is a symbolic form interpreted by a spec macro
ok ok cool, ima do more reading / playing around but that makes sense (sorta because i am still new) i have starred your responses to refer back to them. thanks for taking time to explain that to me @alexmiller i truly appreciate it
btw. the limit doesn't apply to Starred messages in the usual way - at least I can still see my starred messages from 2018
True, you can see any messages you've Starred -- but you can't jump to them (and see the conversation in context) for older ones.
Most channels here are archived in Zulip (and searchable) going back to near the start of 2019.
They're also logged here https://clojurians-log.clojureverse.org/ but that service has been a bit in flux as the maintainer has had a number of problems with the pipeline of data processing and keeping the server processes stable. It should become stable and up-to-date in due course.
(right now I think the clojureverse log archives are only processed to the end of August)
Zulip is a nice way to catch up on conversations here because the client is all keyboard driven -- and you can read almost any Slack channel there, even if you're not a member of the channel here!
honestly a little slow but i am learning! having some end goal def helps a lot more than "do these practice problems"
in my example, i have the logic already done for what i want in node now i just need to port it over which def helps me a ton
Yeah, I hear ya! At work we're rewriting one of our legacy apps, switching it to Clojure, and while it's mostly "grunt work" it's often an opportunity to enhance the functionality in ways that would have been harder in the old code because so much of it turns into data manipulation in Clojure and that makes it easier to do more with it, without adding a lot of code...
totally! i would also be open, once im done migrating things over, to have people take a look at the code and critique it since i dont really have anyone doing code reviews for me
One of the things about our app rewrite is that it's a JVM app already and we're calling into Clojure code from the legacy code as we rewrite pieces. So I provide a JVM option at start up for Clojure's runtime to start a Socket REPL, and then I can connect my editor into the running legacy app and do live RDD into the app without needing to restart and reload etc. I love that about Clojure.
(we have Socket REPLs running in several production apps -- including the production version of this legacy app -- which allows us to apply live patches if something critical comes up, so we don't need to have a full deployment/downtime for some stuff)
Hello. I've been learning clojure.spec recently. I'm curious that the error message is not detailed in instrumentation.
@ FWIW, here's what I see in the default REPL:
You do get the extra information you want. I also tested
(! 544)-> clj -A:test Clojure 1.10.1 (ns myspace.test (:require [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st])) nil (defn square [x] (* x x)) #'myspace.test/square (s/fdef square :args (s/cat :num number?) :ret number?) myspace.test/square myspace.test=> (st/instrument `square) [myspace.test/square] myspace.test=> (square "3") Execution error - invalid arguments to myspace.test/square at (REPL:1). "3" - failed: number? at: [:num] myspace.test=>
lein repl(for Leiningen 2.9.1) and it also prints that extra information. So this seems to be a Cursive problem (maybe ask about error reporting in the #cursive channel).
this is my code
(ns myspace.test (:require [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st])) (defn square [x] (* x x)) (s/fdef square :args (s/cat :num number?) :ret number?) (st/instrument `square) (square "3")
this is the printed error message.
Syntax error (ExceptionInfo) compiling at (test.clj:14:1). Call to #'myspace.test/square did not conform to spec.
I want to see this error message. Is there a way?
Call to #'myspace.test/square did not conform to spec: val: "3" fails at [:args] predicate: number?
My dev environment is Win10 + intellij + cursive. And dependencies of project.clj is,
:dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/test.check "0.10.0"]]
Current react and reagent have diverged a bit. If you’d like to learn reagent, it’s probably best of just jumping in with reagent. The way state is handled - with r/atoms - and how renders are scheduled - is different from basic react, and hiccup is different from jsx so it’s easier to just jump in imo. Current react in a functional style tends to favour use of hooks, which are not really used in reagent, you’d need to look at a different lib like hx
Reagent is pretty fun and straightforward to pick up - in some ways, less to think about than react itself
I use reagent/re-frame a lot, and honestly there’s very little React-specific stuff I actually use. It’s a good idea to know at least how the basic React component lifecycle in case you need to write any advanced components, but the Reagent stuff is largely “independent” of React, in terms of how the developer experiences it.
Reagent lets you use React props and so on, but I almost never even think in terms of props, except in the case of advanced components, or interacting with React libs that use them (which I personally rarely do).
So I’d say yeah, just go for Reagent, and pick up the React details as you need them.
@manutter51 @danieleneal Many thanks to both of you… that's actually good news for me!
Anyone know of a good library (Clojure or Java) for converting PDF files to some kind of Clojure-like data structure?
I have a group of about 300 PDFs that my company receives monthly. Each month, it takes an individual about a week to read all of the data on it and move it to an Excel spreadsheet for our Ops team. That's an enormous amount of time for us and we're looking to automate it.
My task is to build a PDF parser, nothing crazy advanced, to read in a PDF file and pull specific blocks of data from it (typically in table form). My plan right now is:
1. Read PDF file
2. Convert to HTML
3. Parse HTML to map via hiccup/hickory/etc...
4. Extract wanted data table via a
5. Convert data table to a structure I can efficiently work with based on my reqs from the next step
6. Write to a file our Ops team likes (Not sure what this is going to be yet, probably CSV to import to Excel)
Where I'm hung up is the PDF -> Data step. I've found
dotemacs/pdfbox on GitHub which allows for PDF->String but the string parsing is wildly complex and not a simple thing to expand on in the future.
Does anyone know of a Clojure or Java library that I can use to convert from PDF to HTML or have an approach to convert from PDF to data?
Not exactly what you're asking for, as it's a paid service, but @'s https://www.pdfdata.io/ does this. PDFs are fundamentally terrible at transmitting data, so I'm not sure you're gonna get something better that a wildly complex string that'll be fun* to parse. *not fun
Hey I saw that quite some time ago, the clojure developers created an implementation of rrb-vector here https://github.com/clojure/core.rrb-vector, was wondering why that never replaced the standard vector implementation, my understanding after reading the paper (and looking at scala implementation benchmarks) is that it strictly dominates the traditional vector
@joshlemer I have been doing some bug fixing on that library recently -- I do not think it has reached the quality/reliability level that one would wish before considering including it in Clojure core.
Even if it ever gets to that point, the Clojure core team is very cautious and selective about what they choose to include in core, and having it as a separate library available via a single
require and a single dependency added to your project is not a big hurdle.
The current core.rrb-vector implementation in that library is also slower than the built-in Clojure vectors, when you restrict yourself to operations that are supported by both.
not in the big oh notation run times for operations, but in the constant factors, which are also important.
>The current core.rrb-vector implementation in that library is also slower than the built-in Clojure vectors, when you restrict yourself to operations that are supported by both. Ah, that’s not ideal, and makes sense that it isn’t the default vector until/unless that changes