Fork me on GitHub
#beginners
<
2022-07-23
>
zydy01:07:07

I have a function defined

(defn sentence [] (concat (noun-phrase) (verb-phrase)))
With the functions noun-phrase and verb-phrase not yet defined. The compiler doesn't like this:
Syntax error compiling at (REPL:1:27).
Unable to resolve symbol: noun-phrase in this context
But it's not really an "error", at least to me considering the function did get compiled and so is really a warning. Is there a way to temporarily disable/mute this? Within Cider (Emacs) it's especially annoying with a popup every time.

seancorfield01:07:43

In Clojure, all symbols must be defined before you use them.

3
seancorfield01:07:18

Essentially, Clojure namespaces need their functions defined "bottom-up".

phronmophobic01:07:28

There's a couple options: 1. you can place the noun-phrase and verb-phrase definitions before the sentence definition (my preference) 2. you can add a (declare noun-phrase verb-phrase) statement before the sentence definition

phronmophobic01:07:46

I've always found the cider error popup annoying, you can customize cider-auto-jump-to-error and cider-auto-select-error-buffer to nil to prevent that behavior.

phronmophobic02:07:51

If you do M-x customize-group and go to the cider group, then you can browse the options under "Cider Auto Jump To Error" and "Cider Auto Select Error Buffer"

zydy02:07:16

Thank you both for the clarification and suggestions.

zydy02:07:26

Making that change to cider now, hate that.

vlad_poh02:07:52

How does a perennial beginner up their proficiency/expertise when they don't code/develop for a living?

zydy02:07:41

Probably the same as the professionals: build stuff, collaborate

vlad_poh02:07:12

Tried building stuff but it's always basic. I’ve never used multimethods, see their utility but nothing compels me to use them. Dabbled in the datalog variants but didn't get past rules

seancorfield02:07:55

@U06GMV0B0 Are there open source projects you depend on? You can get involved with those to expand your horizon in terms of experience. But also remember that not all Clojure features are in common production usage (multimethods, yes, I'd say so but not everything).

Bob B02:07:08

I think the things I personally find helpful outside of work are: • practice (obvs) • helping others - often people with questions have problems that are different from what I'm used to, and answering those questions (even if someone else gets there first and I don't actually send my answer) can help new ideas click for me

👍 1
vlad_poh02:07:33

@U04V70XH6 good point I remember reading Stu's book a decade ago and pretty sure defstruct was a thing. Haven't seen it since. Wrt to libs I’ll take a closer look

kennytilton10:07:03

"Basic" can work. I am doing nothing but adding localstorage for persistence to a ClojureDart TodoMVC and, unlike with the Web variant, I am getting killed -- and learning a ton. You might need a variety of small projects. A bigger project building sth that amuses you (think Wordle) is preferred.

👍 1
Jim Strieter05:07:50

Does anyone know a general way of inverting a matrix in neanderthal? I found the method of (upper triangular) x (lower triangular) but, from what I've read, that only works for some invertible matrices, not all invertible matrices. Am I correct or am I missing something? Is there some straightforward way of doing this that I'm not picking up on?

sova-soars-the-sora12:07:57

not transpose? invert?

blueberry21:07:34

https://neanderthal.uncomplicate.org/codox/uncomplicate.neanderthal.linalg.html search for inverse. In general, you triangularize the matrix first, and then cal tri, or tri!. Maybe there's something else for specific cases, but this one is the first thing that comes to my mind (I'd have to check out my book to refresh my memory, and I don't have time for that now :)

sova-soars-the-sora00:08:49

what the heck is a matrix inversion

Benjamin08:07:44

can I implement a constructor with reify ? - ah I think I should use proxy (still don't get how to provide a constructor with 1 arg)

Ben Sless14:07:21

Might have to gen-class

sova-soars-the-sora12:07:32

@benjamin.schwerdtner construct what? (Object. ___) is a way to construct an Object named _

Benjamin13:07:51

I meant providing a constructor implementation. This is for interacting with some existing api, not normal clojure