Fork me on GitHub
#clojure
<
2022-02-02
>
Nundrum00:02:17

I've hit something totally baffling. I have a project with a Seesaw GUI. I have a function that does (into {} ...) which works fine. But I need it sorted. When I change that to (into (sorted-map) ...) the GUI freezes. It seems like no matter where I put sorted-map it causes a freeze. The same function can be called on the same data from in vim-fireplace with no problem. No freeze.

Nundrum00:02:40

Integers. Specifically timestamps.

Nundrum00:02:51

It's a smallish map. 1440 entries.

hiredman00:02:06

I would look at what you are doing afterwards with the sorted map

Nundrum00:02:49

What are you thinking?

hiredman00:02:46

sorted-maps are not entirely drop in replacements for maps, some things will throw exceptions on sorted-maps that work on maps

hiredman00:02:59

so my guess is things aren't frozen, but a thread has died and stopped doing work because of exception

Nundrum00:02:04

Usually exceptions show up on the terminal, but nothing shows up after I change to the sorted map. I'm partitioning the map and the summing the partitions. I'll play with that, though.

Alex Miller (Clojure team)00:02:22

Take a thread dump and see what it's doing. Ctrl-/ on *nix, ctrl-break on win, or use jstack on the pid if not in process

Nundrum01:02:26

Best as I can figure, changing the sort was bubbling up a nil, and that was ... doing something bad. Somehow that was returning Inf along the way, and then I'm guessing that was making the (range) call run forever.

pinkfrog07:02:34

What does decomplecting mean, often saw words like decomplecting clojure

p-himik07:02:02

When in doubt, search through the transcripts of Rich Hickey's talks. :) The word "complect" is mentioned here, with a definition and a discussion: https://github.com/matthiasn/talk-transcripts/blob/9f33e07ac392106bccc6206d5d69efe3380c306a/Hickey_Rich/SimpleMadeEasy-mostly-text.md

thanks3 1
noisesmith21:02:02

Definition of complect
obsolete. : intertwine, embrace especially : to plait together : interweave.
de-complect

noisesmith21:02:22

to separate things that were woven

magnars07:02:19

It's a fancy word for "untangle".

rich 1
pinkfrog07:02:19

Yes. complect is tangle.

noisesmith21:02:41

more like "weave" than tangle, but yes - combining things is the core concept

noisesmith21:02:13

I find that distinction useful because a lot of "complecting" in software looks relatively simple - eg. combing the concept of a value with the concrete detail of a storage location. it is not a tangle in the code to do that. the aspects can be skillfully handled together. but they are woven together and this has larger scale consequences.

vlaaad07:02:57

or for “simplify”

pinkfrog08:02:58

What is step function as in the docstring of transduce

f should be a reducing
step function that accepts both 1 and 2 arguments

p-himik08:02:54

I'm 80% certain it's supposed to be read as "f should be a (reducing step) function [...]". So, just a reducing function - something that you'd pass as the first argument to reduce, nothing fancy (except for the fact that it must also have a 1-arity).

p-himik08:02:51

Although this section makes me think that it doesn't matter much how you group the words together: https://clojure.org/reference/transducers#_creating_transducers

p-himik08:02:12

Yep, although I don't use the word "step" myself, reading other discussion here after searching for "step function" tells me that that's a synonym for "reducing function".

Vladimir Pavlyuk10:02:13

Hi everyone! Did anyone have the experience of receiving Twitter approval to use its API Keys and Tokens? I am from the https://github.com/clojure-garden/clojure-garden team, maybe you've heard about this project at the re:Clojure conference. We are planning to create a LibRank ranking system based on social mentions and therefore it's necessary to get access to Academic Research. But Twitter refuses our request. What would you advise in this case?

vlaaad10:02:43

not sure if it helps 🤷

mpenet10:02:36

It's complicated to say the least. If you're trying to make a business out of it I say run away

mpenet10:02:12

I co founded a company that was relying quite a bit on their API. Every now and then they change the rules and make it difficult to adapt unless you get exceptions, most of the time through partnerships or just knowing people inside.

mpenet10:02:19

If it's for non profit I have no clue. In our cases we also leveraged the fact some of our clients were fortune 500, so they would get a "call" from them for particular use cases. The only times it was easy is when Twitter itself was the client

mpenet10:02:53

I left that world 3 years ago, so not sure how it is now.

mpenet10:02:06

Another trick was to re-use existing apps

mpenet10:02:01

Since we were working with their api for a long time we had this option for exploratory work

mpenet10:02:28

And lastly you can pay to get access, via gnip, at least back then

mpenet10:02:37

Seems now it's part of Twitter biz

mpenet10:02:29

I do recall ppl having to make videos of the use case for approval towards the end, and even then it was hit/miss

Vladimir Pavlyuk17:02:45

@U050SC7SV @U47G49KHQ thanks a lot! Will take a look!

SK21:02:19

hi! When doing a (require '[nextjournal.clerk :as clerk]), I get the following: Execution error (IllegalArgumentException) at com.oracle.truffle.polyglot.OptionValuesImpl/failNotFound (OptionValuesImpl.java:279) Could not find option with name engine.WarnInterpreterOnly. No idea what this means?! Do I need to upgrade my JVM? (currently java 11)

mkvlr21:02:31

hi, yes, this is an issue with older versions of graal vm.

mkvlr21:02:46

we should document this, please try upgrading to a later version of graal vm or use any regular (non-graal) JDK

SK21:02:27

Upgraded to Java 17 (Azul Zulu version) and the same error shows up

mkvlr21:02:40

is this still graal vm?

mkvlr21:02:59

what version of graal vm are you using? Can you paste the output of java -version ?

mkvlr21:02:52

unfortunately the graal JDK ignores the library and uses it’s version of the scriptengine that’s built-in, even when it’s an older one and doesn’t understand all options the newer lib understands

SK21:02:52

openjdk version "17.0.2" 2022-01-18 LTS OpenJDK Runtime Environment Zulu17.32+13-CA (build 17.0.2+8-LTS) OpenJDK 64-Bit Server VM Zulu17.32+13-CA (build 17.0.2+8-LTS, mixed mode, sharing)

mkvlr21:02:36

huh, that’s very strange, never seen the error with a non-graal JDK

mkvlr21:02:51

how do you start your clojure process?

SK21:02:08

I don't even know what graal is doing at all, this is the first time I've heard about it

SK21:02:35

these are the libraries on the classpath that contain the word graal:

SK21:02:45

~/.m2/repository/org/graalvm/js/js-scriptengine/20.0.0/js-scriptengine-20.0.0.jar: ~/.m2/repository/org/graalvm/js/js/20.0.0/js-20.0.0.jar: ~/.m2/repository/org/graalvm/regex/regex/20.0.0/regex-20.0.0.jar: ~/.m2/repository/org/graalvm/sdk/graal-sdk/20.0.0/graal-sdk-20.0.0.jar: ~/.m2/repository/org/graalvm/truffle/truffle-api/20.0.0/truffle-api-20.0.0.jar

mkvlr21:02:04

ok, something is bringing in an older version

SK21:02:19

I'm using intellij/cursive

mkvlr21:02:35

is this project using deps.edn?

SK21:02:48

no, leiningen

mkvlr21:02:58

can you paste your project.clj?

SK21:02:21

ahhh got it!

SK21:02:31

there was this as dependency: [metasoarous/oz "1.6.0-alpha34"]

SK21:02:42

this is what brought in that 20.0.0 version of graalvm

SK21:02:02

thank you for your help!

mkvlr21:02:44

pleasure, glad you figured it out!

mkvlr21:02:09

I’m still a bit surprised that the newer version didn’t take precedence in that case

SK21:02:12

Yes, me too. What is graalvm about anyway? How does clojure use it?

mkvlr21:02:55

our markdown parsing library is written in javascript, and we call it from Clojure via the graal vm polyglot capabilities

SK21:02:43

I see, so this is your way of reusing some JS code in clojure

SK21:02:21

never heard of anything/anyone using JS code from Java or Clojure, but times change 🙂

mkvlr21:02:32

our goal is having one markdown parser that works in the browser and in Clojure. That’s how we ended up going with https://markdown-it.github.io

SK21:02:16

aha I see

SK21:02:26

are you the author of clerk btw?

SK21:02:05

ah ok sure 🙂 I just see on the website

🙃 1
SK21:02:54

Is #nextjournal the official channel for it?

SK21:02:35

I've worked my way through the demos and have some questions, I'll ask there

👍 1
seancorfield21:02:22

@surf-kid24 There's a #nextjournal channel that may be able to help with that?

👍 1
nivekuil22:02:00

is there a refactoring tool to rename a namespaced keyword, including destructures?

vlaaad22:02:36

yes, it's called Cursive 😄

vlaaad22:02:36

oh, I'm not sure how it handles namespacedness when renaming, but I saw it changing local bindings in :keys [...] block

respatialized23:02:44

apologies if this question has been asked before: is there an idiomatic way of detecting at runtime whether some code is running via a REPL or via CLI/`deps`/java invocation? Should I try to detect REPL libraries injected by tools like CIDER on the classpath or is there another way? XY problem: I want shutdown-agents to run with my test suite as a fixture in CI, but not in the REPL (because it will kill the REPL).