Fork me on GitHub
#beginners
<
2016-01-13
>
jeff.engebretsen00:01:39

Is it possible to write Clojurescript with all Javascript interop and have it spit out a standalone Javascript file?

dnolen00:01:30

@jeff.engebretsen: that’s just how ClojureScript works

madstap00:01:43

I don't get what you mean by "with all Javascript interop", but yes

jeff.engebretsen00:01:16

When I look at the getting started it talks about Google closure and it has googl load my namespace. By all interop I mean no reliance on clojure functions so that the outputted .js can be given to a program expecting a vanilla js script file.

dnolen00:01:48

@jeff.engebretsen: what you’re saying is just how it works

jeff.engebretsen00:01:42

What about all that google closure stuff? Do I just not declare a namespace and cljs.jar will translate my forms to js code?

stuart-weir00:01:19

Hey guys, new to Clojure, but not new to Comp Sci., however it’s been quite a while since I’ve thought about recursion/depth-first/breadth-first/trees. Anyone have any good resources?

meow00:01:33

@jeff.engebretsen: what is that google closure stuff - js code

meow00:01:15

have you written a small cljs program yet and compiled it and looked at the result

meow00:01:26

did it not produce a .js file

meow00:01:56

isn't that what you are asking it to do and @dnolen is trying to tell you - that's how it works

meow01:01:07

somewhere something is getting lost

meow01:01:43

so, maybe work up an simple program first before trying to do it differently - just do it and look at it and understand how it works by design

meow01:01:24

that is why david is always advising people to do the intro as written with no tooling - to demystify things so you understand better

meow01:01:38

teach a man to fish instead of giving him a fish

meow01:01:42

hope that helps

meow01:01:35

@stuart-weir: you could start with something really simple like https://clojuredocs.org/clojure.walk/walk

meow01:01:49

since you are new to clojure

meow01:01:18

recursion is a bit overrated and I like the into function better - https://clojuredocs.org/clojure.core/into

meow01:01:27

especially with transducers

jeff.engebretsen01:01:23

@meow: I have. It produced a suite of .js files. I'm asking it to take a single .cljs file and output a single .js file. I did the simple program without tooling from the clojurescript quickstart wiki. It produced html script tags.

meow01:01:42

ok, I haven't done the quickstart in a while

meow01:01:44

pretty sure when I was doing cljs with boot that I had one simple html harness and compiled to one .js file except maybe the google clojure js files

meow01:01:55

trying to remember

meow01:01:09

my github doesn't contain the compiled files, of course

meow01:01:35

the html harness is one level higher because I use the same one for multiple apps

meow01:01:49

here is what it contains:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <div id="app"></div>
        <script src="app.js"></script>
    </body>
</html>

meow01:01:03

so I just had an app.js file

meow01:01:10

david will help

dnolen01:01:26

@jeff.engebretsen: @meow: this is in fact covered in the Quick Start - if you want a single file you need to use :advanced or :simple optimizations

meow01:01:47

yeah, I was thinking that might be the case

meow01:01:25

@jeff.engebretsen: it really pays to do that quickstart a couple of times until it really makes sense - its all there

datajohnny15:01:36

hello, I was wondering if anyone can help me out with this: https://gist.github.com/datajohnny/3b82660ba27fd80f448c

datajohnny15:01:50

I am getting that error and I cant explain why

plaxdan15:01:21

On line 11 are you constructing a new Person record but without the name and age args?

datajohnny15:01:28

I thought I was passing the record that was being evaluated that passed the rule

plaxdan15:01:16

> clojure.lang.ArityException: Wrong number of args (0) passed to: core/eval6101/-&gt;Person—6116 There’s only a couple of places in the code where ->Person is being used.

vanrysss22:01:41

Hi, I'm having an issue when trying to start up a new project. My project file is barfing on this `(defproject api-gateway "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.7.0"] [compojure "1.4.0"] [ring/ring-defaults "0.1.5"] [org.clojure/data.json "0.2.6"]] :plugins [[lein-ring "0.9.7"]] :ring {:handler api-gateway.handler/app} :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring/ring-mock "0.3.0"]]}} {:user {:plugins [[com.palletops/uberimage "0.4.1"]]}}) `

vanrysss22:01:15

it's telling me that there's no value for the user plugin key?

vanrysss22:01:18

sorry about that

jonahbenton22:01:06

:user is a key in :profiles

jonahbenton22:01:54

remove the } that closes :profiles after :dev, and the { before :user

vanrysss22:01:43

oh man, thanks!