Clojurians
#hoplon
<
2016-03-05
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

flyboarder14:03:34

Is there already a hoplon built-in fn that extends an existing element instead of creating a new one?

micha14:03:32

what does that mean, extend an existing element?

micha14:03:51

you can use jquery to fish around in the element and inject things, is that what you mean?

flyboarder14:03:14

maybe an example would be better…. one sec

flyboarder15:03:39

i just started writing a macro for it but im wondering if im not doing something the idomatic way and thats why im seeing a lot of repeating structure

micha15:03:46

yeah that's the classic functional way of programming

micha15:03:05

in lisp you can use macros to generate the boilerplate

micha15:03:21

vs in a non-functional language you'd be mutating a class or something

flyboarder15:03:35

ok so im on the right path with the macro then

flyboarder15:03:00

does hoplon have one built in which just adds additional attributes to the attr map?

micha15:03:11

yeah i think macros are more or less the facility you use to express structural sharing between things in lisp

micha15:03:42

there is the :attr attribute

micha15:03:21

you can also just apply the element as a function to a map with one attribute, like

micha15:03:34

(some-elem {:foo "bar"})

micha15:03:47

that will add additional attribute

flyboarder15:03:29

ok thanks, i thinks thats more or less how i have it now :simple_smile:

micha15:03:01

yep, macros will let you devise your own idioms that make sense for your application

micha15:03:13

building on the basic primitive operations