Fork me on GitHub
Rob Haisfield00:06:37

Is there some way to get a continuous range (range of floats) instead of a range of integers?

Rob Haisfield00:06:07

I’m trying to create a schema for a data structure and say that -1 to 1 are the range of acceptable values for a valence


(range 0 1 0.1)

Rob Haisfield00:06:46

Hmm so that’s another discrete range with a small increment. Is it possible to get a continuous range? I want to say “This value can be any possible value between -1 and 1”

Rob Haisfield00:06:59

Alternatively, I could specify a very small interval and also have a function that would round any values to the accepted interval


a predicate satisfies that.


not sure what your requirements are, but enumerating lots of floating points sounds weird for those purposes


#(<= -1 % 1) or something like that

Rob Haisfield01:06:53

Ooooh that’s good

Martyna Miśkowiec12:06:20

Hey, i'm very-very new to clojure, and i'm having issues installing it on windows. Clj -h works just fine, but when i try to run a repl i'm getting 'Error: Could not find or load main class clojure.main'. Any ideas? Any help really appreciated!

Juλian (he/him)12:06:39

you're just running clj without arguments, right? which version are you using and which Java version?

Martyna Miśkowiec12:06:54

it's java 8, and clojure 1.10.3

Martyna Miśkowiec12:06:19

also, when i run ' java -cp .\clojure-tools- clojure.main ' directly on the jar it starts REPL with no issue


How was clojure installed?


Try the #clj-on-windows channel if you’re still stuck @U023X1UCEUB — folks there are pretty dedicated to getting Windows folks up and running with either the Powershell install or the Scoop package manager.

Erik B Good21:06:51

Hello, I was wondering if there was a guide somewhere to write proper boolean expressions. I am a bit surprised that there is no IN operator (similar to SQL), I was also wondering if there was any way of writing cleanly a bunch of OR expressions.. Any one have a blogpost or tutorial on some advanced conditional logic features of clojure?


can you explain what a proper boolean expression is?


Clojure sets are functions that can be used to check inclusion


(#{1 2 3 4 5} 1)


or (contains? #{1 2 3 4 5} 1) if that reads better for you


it will also return a boolean rather than a logical true value (which is generally true of any predicate that ends in ?)


boolean is a useful function to convert a logically true value (anything but nil or false) to an actual boolean value

Erik B Good21:06:18

What I meant by proper boolean expressions is complex valid boolean expressions. @U064X3EF3 that helps yeah I will make up for many OR by using this set notation. Thank you very much


I assume you're aware of or and and


if you have an example of a boolean expression from another language i can help you translate it. but it's largely gonna be a 1-1 infix to prefix translation


here's an example from our codebase that i'm looking at right now

(when (and (send-email-on-first-login-from-new-device)
             (first-login-on-this-device? login-history)
             (not (first-login-ever? login-history)))


these are macros (to do short-circuiting of eval) but can be turned into functions by wrapping in #( ) (with eager eval)

Erik B Good21:06:30

for instance let's say I had if x ==2 or x == 3 or x ==4. In python I could write if x in (2, 3 ,4) instead. Now I can use @U064X3EF3 to write (#{2 3 4} x) which looks good


there's also (if (<= 2 x 4) ...) that could possibly work depending on the domain (ie, floats aren't going through)


you could also do (some #(= x %) [1 2 3]) which can be generalised beyond equality checks


The resource from “.../js/jquery.min.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff) I have not run into this problem before, I don't know why the javascript is not loading, firfeox seems to be expecting text/html ... any thoughts?


JS should be served with a MIME type of text/javascript, not text/html.


Right... I tried adding type="text/javascript" to the <script> tag but it's still a porblam


What is serving up that JS file? That’s where the problem is.


Hmm. Well other JS files seem to work fine from the same server..


Use curl -I <url of JS file> to see what the server is sending back.


Well that's weird. my /img/ directory works fine through the CDN but my /js/ directory does not


thanks for the curl tip. more head scratching


In my server.clj I have (route/resources "public") in my non-authenticated routes


folders img and js both live there... img will load assets, js will give me the login page to the site o_O


I figured route/files ought to help serve js assets as well... maybe I need to add a specific line for that?


You mentioned a CDN above?


Can you try curl directly against the server (without the CDN) and compare the results against the same calls through the CDN?


yeah, I stopped using the CDN for now, to debug this...


It just gives me the application login page, which is text/html of course


so that makes sense, but why is it not serving /js/ files and instead acting like i'm in authenticated territory


And your JS and image folders are both under that public resources folder?


How are you applying the auth check in your code? Is it perhaps allowing various image file extensions through but not .js?


good time for a sanity check as any.. 😄 yeah they are both under resources/public/ img | js


hmm let me double check i actually uploaded them to the server d'oh


omg i'm a fruitcake


the assets weren't there! xD


Haha sorry for the mixup. I appreciate you and your helpful nature! 😃


i plugged the plug into itself.. why is nothing turning on

🔌 1
💡 1