Fork me on GitHub
Drew Verlee00:12:30

I have a set of functions used just for testing, I would think it would be a bad idea to keep them under src, I would rather nest then under a test namespace to be more clear. What's the recommend way to handle that


@drewverlee Sure, if they're test-only functions, they go in test, not src.


Not everything in test has to be an actual test 🙂 We have test versions of our Components under test and some utility code (esp. around WebDriver stuff).

Drew Verlee00:12:55

Ill need to figure out how to tell my repl to find the file, I'm probably missing something obvious


@drewverlee Not sure whether you're using Boot or Leiningen, but however you tell it find your tests, any code under test should then be visible -- your tests aren't special: alll code under test would be accessible.


also, I have a library that puts transit formatted runtime data into files under test/data/


(since I want to use the data to recreate specific conditions for unit tests, so it seems like a natural place for it)


Possible load in repl or single .clj (without project.clj or boot) Clojure repositories? Like in other languages, direct loading in the clj file?


If you have no external deps you can load a single file with load-file - that's literally what it does.


Thanks the infos. Yes, there is external deps. @U07TDTQNL @noisesmith


Yes, 1.9 cli and deps > sounds very interesting 4 datascience projects


how do i get the index of a map value inside a vector of maps? considering i have one of the maps at hand


nvm, i was using .indexOf wrong xD


hi! I have namespace in separate file: '(ns other) (print '3)' it is in my classpath. how can I load it from repl so it does the print function?


I tried '(require 'other)' but it did not run the function...


found it '(use 'antras :reload-all)'


but still did not print...


I have a super basic question about datascript / datomic. I am assuming this is discussed somewhere but I don't even know what words to search for to lead me to the information. Assume that I want to keep track of how much various people like various kinds of foods (on a scale of 0 to 10). E.g., let's say I want to record that Joe's liking for ice cream is an 8. I am assuming that I am asserting a fact about the entity which is the pair (Joe, ice cream), right? What's the recommended way to do this so that I can do queries like "what are all the foods that Joe likes at least 5?" Thank you!


After spending a few minutes in my hammock I decided that the entity that I am asserting stuff about has got to be (Joe, ice cream). In addition to asserting :liking 8, I should also assert something like :liking-person :Joe and :liking-food :ice-cream. Doing it like this will make it easy to compose a query to answer "what are all the foods that Joe likes at least 5?"


Hi guys! I cant figure out how I include css from cljsjs libraries. Specifically this one: cljsjs.rc-slider


I tried cljsjs-ring but it seems like it's not the tool for the job


to serve css out of a jar via ring, you'll want the wrap-resource middleware


For my previous question, the "right" solution I describe above raises the further question of how to make the combination of :liking-person and :liking-food attributes unique, so that I can easily retract facts by just asserting a new one. Any hints would be greatly appreciated!


I dont have this css. I have installed via lein library cljsjs/rc-slider. And it should come with styles but I dont see them


cljsjs/rc-slider adds a jar to your classpath, wrap-resource lets you serve css to a client out of a jar


if it doesn't come with the css you need, ... I have no idea how to help you with that, are you just supposed to figure out on your own how to find and include the css?


I am not sure if I understood you. Can you elaborate on wrap-resourse? Ring already serves MY resources from /resourses/public. How is it related to external library?


wrap-resource isn't about resources/public


it's about things that might be in a jar (including your resources/public if you create and run an uberjar)


The problem is that in JS imports would be like:

import Slider, { Range } from 'rc-slider';
import 'rc-slider/assets/index.css';
But since Im using clojurescript I can only require [cljsjs.rc-slider] and it works (html is generated). But what about css?


it means that you can serve any item inside any jar used by your project to a client


@non.dmitriy yeah I have no idea where index.css is - all I was saying is that I would expect cljsjs to be sane and include index.css in its artifact, and if it does that, you can serve index.css from ring via wrap-resource


that's what wrap-resource is for


ok, what would be arguments for wrap-resourse in this case? (wrap-resource handler <???>)


the path to the index.css inside the jar - I'd think they would be documenting this stuff though...


so if the jar has "public/rc-slider/assets/index.css" you could use (wrap-resource handler "public/rc-slider") then ask for "assets/index.css" in your html shell


a jar is a zip file, and you can use lein cp to see all the jars you use


you should be able to go in and see what's in that jar


For the record, after some more time in the hammock I realized that adding :liking-person-food [:Joe :ice-cream], and marking the :liking-person-food attribute unique, seems to provide a solution to my problem. Using more conventional database terminology then, what I want is to assert {:person-food [:Joe :ice-cream] :person-fk :Joe :food-fk :ice-cream :liking 8}, with the :person-food attribute having been marked unique.


@noisesmith thank you for your help. I guess it really is not in the jar 😞


OK - yeah, I wonder what they actually expect people to do?


same here. As for me I am gonna go cry til the end of the day:D


@sabbatical2017 when you add an entity to the database it gets an internal eid (entity id)


you can add an entity like [ :person/name "Joseph" :food/type "icecream" :food/rating 8]


when you do a search against the database, then you'll do a quantum balancing act: give me the EID where my queries are satisfied [?eid :person/name "Joseph" ?eid :food/type "icecream" ] if you want to write more facts to the database, you can just use one attribute to tie in a new value to your what-the-heck-is-this-entity-chain , say you want to add another food that joseph likes: [:person/name "Joseph" :food/type "veggie burger" :food/rating 10] now when you do a search in the db for all entities that have :person/name "Joseph" it'll actually return 2 EIDs, in a query: [ ?eid :person/name "Joseph" ?eid :food/rating > 5 ] would also return two EIDs (my syntax is not datomic proper here)

Quan Nguyen23:12:18

Anyone know if there's a standard lib function that does something like (foo f g [a b]) => [(f a) (g b)]?