#clojure log - Jun 25 2017

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

1:44 jeaye: I'm quite bad at core.logic, since I'm just learning it. Is there a better way to do this? https://gist.github.com/jeaye/bece34943b4508c789bde770ed168a56

1:45 In short, I'm type checking a fn definition by validating that each call in its body matches a supported overload.

3:01 amalloy: jeaye: does that actually work? if nothing else, valid-callo looks wrong to me

3:05 and you're using everyg a lot, which...i mean, i'm not a core.logic expert, but if your core algorithm uses finite-domain stuff like everyg, i'm not sure what you're getting out of core.logic. it seems like your problem would be much more easily written in basic clojure with (every? valid? calls)

3:08 anyway, the obvious error in vallid-callo is that core.logic goals do not perform side effects, so (let [...] goal1 goal2) is just the same as (let [...] goal2). to assert that two goals both match, you need to combine them in a core.logic grouping construct like l/fresh or l/all

3:24 xrash: what is the idiomatic way of executing a sequence of functions until one of them returns "not nil"?

3:28 dysfun: some ?

3:28 or some-fn if you want a fn back

5:24 lxsameer: hey folks

5:24 dysfun: hiya

5:24 lxsameer: how can i track a dependency conflict ?

5:24 dysfun: lein deps :tree

5:24 TEttinger: use the power of frustration

5:25 if you don't have a red lantern ring, then lein deps :tree may be a better choice

5:26 lxsameer: :)) thanks guys

6:24 dysfun: :/ carmine is unhappy

7:44 lxsameer: guys, how should i use fast-resource or resource in order to serve static files in pedestal ?

7:59 dysfun: clojure.spec is confusing me greatly: https://gist.github.com/jjl/ae57ac46f681a2a0c146856ddc4e7646

7:59 how can it not be invalid if there is something required and the collection is empty?

8:00 osfameron: I always read :req-un as a French shark

8:01 dysfun: it's a french require one

15:52 jeaye: amalloy: It "worked" in the tests I gave it. ;)

15:52 amalloy: solution: write better tests

15:53 jeaye: No, this is just in the repl.

15:53 As I said, I'm just toying around with core.logic and I don't understand it very well yet.

15:54 Thanks for the feedback though; I _can_ very easily write this in normal Clojure, and I have. Trying to do it in core.logic is a much more challenging exercise.

15:57 amalloy: well, practice is always good. you might have more fun if you explored the basics of core.logic first; starting with finite-domain stuff means you miss the exciting stuff like functions that can, given a desired output, produce a list of all possible inputs that would lead to it

15:57 but if this problem you're solving is the one that interests you, and you want to use it to practice core.logic, don't let me dissuade you

21:24 Seylerius: Funny-but-sad: I just learned about GCJ (and its possibility of compiling JARs to native code), and then immediately thereafter learned that it's dead, and wasn't even fully alive to begin with.


21:26 mercwithamouth: so i just stumbled across a book "Building Systems in Clojure and Clojurescript and they mention a library 'Redux'. Is this a library that people are still using? It doesn't seem to have been touched in a year

21:32 oh..scratch that...as small as it is it's just a simple pattern. cool beans

22:01 matthavener: mercwithamouth: sometimes you'll find that "hasn't been touched in a year" is a very good thing :D

22:07 TEttinger: Seylerius: there's still things that do that

22:08 Seylerius: TEttinger: Do tell

22:08 TEttinger: graal is in theory capable of it, and java 9 is supposed to have a graal-based AOT compiler for java

22:08 graal I have little faith in. java 9 even less

22:09 it claims it's delivered, but graal doesn't even run on windows. http://openjdk.java.net/jeps/295

22:10 only supports linux x64, heh

22:10 write once, run once

22:11 AOT initial release in JDK 9 is provided for experimental-only use and is restricted to Linux x64 systems running 64-bit Java with either Parallel or G1 GC.

22:11 may not use lambdas or invokedynamic or... much

22:12 there's the simple option of bundling a JRE with your jar.

22:13 packr does this for windows, linux, and mac, and I had it workin at one point with Clojure

22:13 the whole system for packr changed recently, it may be more compatible with uberjars

22:13 well, less than a year ago maybe

22:17 jtransc I haven't checked on in a while

22:18 https://github.com/jtransc/jtransc

22:18 looks like it gets better and better, but no clojure support yet

22:21 Seylerius: TEttinger: It's not JVM availability I'm concerned about so much as startup time.

22:21 TEttinger: nothing will help there

22:21 an SSD willl

22:21 Seylerius: Heh

22:22 TEttinger: really though. a solid-state drive will cause most startup time to shrink in general

22:23 I wonder if you could fit some minimal VM in a ramdisk

22:33 * Seylerius has an SSD.

22:33 * Seylerius accesses other machines that don't, however.

22:34 random_numbers: TEttinger: Yeah. Debian standard is small enough.

23:42 jirb: anybody know why (def ^:const WEEKEND #{DayOfWeek/SATURDAY DayOfWeek/SUNDAY}) is giving me an exception on compile?

23:42 "Can't embed object in code, maybe print-dup not defined: SATURDAY"

23:43 it's fine without the const tag

23:44 justin_smith: sounds like it can't create reloadable bytecode with that value directly embedded

23:44 "const" isn't just about whether something would change, it asks for a specific kind of optimization iirc

23:45 https://stackoverflow.com/a/9165999

23:50 so to go into more detail about this problem, making something a const says that compiled code that uses it shouldn't look up the var but should instead have the value embedded in it's bytecode, and the compiler is saying it doesn't know how to put that value in bytecode

23:50 jirb: ahh

23:51 yeah, i'd been looking at that SO but didn't know enough for it to be really meaningful

23:53 so i guess i'm wondering what the bounds are of what it can/can't put into bytecode, and possibly why

23:53 looks like it has no trouble with lists or maps containing objects

23:54 or sets containing longs

23:54 or sets of strings

23:54 justin_smith: jirb: note that the error message mentions print-dup, which is a multimethod clojure uses for data that should be readable

23:55 and that multimethod is extended to clojure datatypes plus strings and regexes etc.

23:55 you could try to defmethod print-dup for that data type and see what happens?

23:56 jirb: nice, good call

Logging service provided by n01se.net