This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-20
Channels
- # announcements (5)
- # beginners (37)
- # calva (3)
- # cider (23)
- # clojure (98)
- # clojure-dev (16)
- # clojure-europe (5)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (7)
- # clojure-uk (52)
- # clojurescript (14)
- # cursive (15)
- # data-science (1)
- # datomic (20)
- # emacs (7)
- # flambo (2)
- # fulcro (10)
- # jackdaw (1)
- # jobs (3)
- # joker (2)
- # juxt (3)
- # keechma (3)
- # leiningen (8)
- # luminus (3)
- # music (1)
- # off-topic (83)
- # pathom (19)
- # re-frame (19)
- # reitit (4)
- # shadow-cljs (76)
- # spacemacs (95)
- # tools-deps (16)
I remember seeing a way here to turn a clojurescript var into some string, then calling a function to turn that string back into a reference to the same var. Anyone know how to do this?
@regen See https://stackoverflow.com/questions/54227193/clojure-clojurescript-argument-to-resolve-must-be-a-quoted-symbol/54236418#54236418
For context, Iβm trying to use https://storybook.js.org/docs/guides/guide-react/, and they want it
import React from 'react';
import { Button } from '@storybook/react/demo';
export default { title: 'Button' };
export const withText = () => <Button>Hello Button</Button>;
export const withEmoji = () => (
<Button><span role="img" aria-label="so cool">π π π π―</span></Button>
);
Are there any libraries that abstract mathematical functions in Clojure and ClojureScript so that both work roughly the same? Iβm thinking of things like rounding, exponents, logs. For the moment Iβm using conditional compilation, Math
for ClojureScript and a mixture of Math
and clojure.math.numeric-tower
for Clojure. But I donβt know how well this will work out.
How are required namespaces/functions used in the macro file? Can I require in cljs library functions or do functions always need to be fully qualified?
The example I see are fully qualified like so: https://github.com/bhauman/devcards/blob/master/src/devcards/core.clj#L18
I am not a macro expert, but if I understand them correctly, if you use your macro in a different namespace you might call the wrong function.
If you write a macro using the backtick, e.g. `map will resolve when the symbol is read to clojure.core/map, or whatever map resolves to in the namespace where the macro was defined, and the full namespace qualified version is what actually gets included in the definition of the macro. That makes it straightforward to know that when you call such macros, it will not use a local version of 'map', for example.
You can of course choose to write macros that do use a local version of a name where the macro is invoked, but it is at the choice of the writer of the macro.
And I should add that I am more experienced with macros in Clojure/Java than ClojureScript, so what I said above is accurate for Clojure/Java, but hopefully someone more knowledgeable of ClojureScript macros will correct any mistakes there if it is different.