Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
fdamirv
@fdamirv
*refers
arundilipan
@arundilipan

Does state+ add state in-place to a GameObject or does it return an immutable representation of a GameObject? I wanted to do something like

(-> fireball
      (state+ :physics {:speed 10})
      (state+ :traits {:damage 10 :effect :burn}))

but I'm not sure whether that would work?

Never mind, it doesn't look like it
Saikyun
@Saikyun
You have update-state as well, where you can use
Saikyun
@Saikyun
-> and assoc :)
Saikyun
@Saikyun
I think you could use doto and state+ as well. :)
fdamirv
@fdamirv

Does state+ add state in-place to a GameObject or does it return an immutable representation of a GameObject? I wanted to do something like

(-> fireball
      (state+ :physics {:speed 10})
      (state+ :traits {:damage 10 :effect :burn}))

but I'm not sure whether that would work?

state+ returns just a value you pass as a last argument.
So you cann't use it in threading macro as you want.
update-state returns new value your state stored (similar to state+).

In your case:
(state+ fireball :physics {:speed 10})
will return
{:speed 10}
On the other hand
(update-state fireball :physics assoc :speed 10)
will also return
{:speed 10}
But if you later do:
(update-state go :physics assoc :angularSpeed 3.14)
then
{:speed 10, :angularSpeed 3.14}
will be returned.

So update-state does not fit to -> threading-macro.

But you can use another threading macro - doto:

(doto go
      (arc/state+ :physics {:speed 10})
      (arc/state+ :traits {:damage 10 :effect :burn}))
fdamirv
@fdamirv
Pay attention: doto will return go.
Saikyun
@Saikyun
I meant one could put threading inside of the update-state call :)
fdamirv
@fdamirv

I think you could use doto and state+ as well. :)

Sorry, i didn't see that. @saikyun already proposed doto

Le-Brut
@Le-Brut
@nasser thanks for the response on the time estimates! Very nice to see your progress on MAGIC.
Guys, am I getting the right vibe from the Arcadia's wiki that miracle is the only repl for emacs capable of the basic features such as completion and jump-to-definition? Also, do any of the repls support syntax checking?
I am also getting a warning that the expected Unity version is 2018 (I am using 2019.3). Any known bugs/incompatibilities for U2019?
@Saikyun Hi! I am trying to set up miracle and ran into a bit of trouble, how do I satisfy the clojure-complete dependency? I tried putting the repo in Assets as clojure_complete, did AOT compile but I am getting this error: https://pastebin.com/0KZP4CkR BTW Thanks for the tutorials, they were a good place to start!
Saikyun
@Saikyun
@Le-Brut hey, thanks for the kind words ^_^ I'm sorry about that awkward dependency, I believe you need to get this specific version: https://github.com/sogaiu/clojure-complete/tree/clr-support
you can clone the repo then check out the branch clr-support
in the assets-directory as you said :)
if you have a folder in the Assets dir and the folder has a project.clj, arcadia will find it :)
I updated the docs here https://github.com/Saikyun/miracle/blob/master/README.md#installation
if you have time @Le-Brut , feel free to test them. sadly can't since I'm at work, but I think I did it right :)
Saikyun
@Saikyun
wrt: 2019 -- I think it has worked well for me last time I tried :) was 2-3 months ago so might not have been 2019.3. I think you'll be fine
I think there has been work done for better cider support with arcadia, but I haven't been involved in that. if you search this channel you might be able to find more information :)
also @sogaiu do you know if clj kondo works with clojure clr? I seem to recall you mentioning it some time
as a response to @Le-Brut thoughts on syntax checking
sogaiu
@sogaiu

@Saikyun i haven't tested clj-kondo with clojure clr, but because of this: https://github.com/clojure/clojure-clr/wiki/Specifying-types

i doubt it works out-of-the-box.

iiuc, clj-kondo uses a forked rewrite-clj and that uses tools.reader, so i would guess at the very least using a clojure-clr-aware tools.reader replacement might be necessary.

also, there are things specific to handling :clj and :cljs in the clj-kondo code base and i don't think there is any mention of :cljr in the source, so that would be another thing that is likely to need some attention.

sogaiu
@sogaiu
regarding tooling i think it could be that the chlorine plugin for atom might work. i think we may have had it working at one point: https://github.com/mauricioszabo/atom-chlorine
the author has been pretty responsive on slack in the #chlorine channel fwiw
Le-Brut
@Le-Brut
@Saikyun Thanks for updating the instruction! This time I get an error on company-complete https://pastebin.com/zvBcMUwG
Should I expect to see that library compiled in Arcadia/Compiled? (cause it's not there after AOT Compile.)
It could be that I am using the latest version of company which introduced some incompatibility, but I get a feeling that it's rather because my clj files simply aren't getting loaded by Arcadia. I have a file Assets/tryload.clj where I define a namespace https://pastebin.com/6VLkR4tY, then restart unity, start player, do (in-ns :game.test-autoload) in the repl and get this error https://pastebin.com/8w8YgMGr
I then tried adding Assets/configuration.edn with: {:source-paths ["Assets/src"]} and Assets/src directory with some clj files (and a project.clj) defining their own namespaces, adding some (LOG "test") calls, hook+ on a camera, but none of those seem to have any effect. Since plain eval-defun works, I am pretty sure at this point that none of the files are simply getting loaded.
If that makes any difference, I am on Arch Linux, don't have any dashes in the filenames and tried Arcadia -> Clean All.
sogaiu
@sogaiu

not sure how helpful this is, but shouldn't the following:

(ns game.test-autoload (require [arcadia.core :refer :all]))

be something like:

(ns game.test-autoload
  (:require [arcadia.core :refer :all]))

?

i.e. :require instead of require

Le-Brut
@Le-Brut
@sogaiu you are right, let me try that instead : )
sogaiu
@sogaiu
also, i may be wrong but the in-ns form doesn't look quite right to me.

i think you might want:

(in-ns 'game.test-autoload)

or something

Saikyun
@Saikyun
what sogaiu says is correct :)
when it comes to clj files being loaded, you must either have a game object with an init hook, or you have to manually load files (e.g. using load-file). then if you require something from that ns (using :require), it will be loaded as well :)
here's some info on a hook that'll automatically start loading your code when arcadia starts: https://github.com/arcadia-unity/Arcadia/wiki/Using-Arcadia#storing-a-start-hook-in-the-scene
Le-Brut
@Le-Brut
Thanks, guys, my assumptions about loading were getting me really confused here!
Completion is still erroring out on me tho, but at least I know the library is working: https://pastebin.com/z3gef4t1
@Saikyun maybe I could try older emacs and company, which versions do you have?
Saikyun
@Saikyun
@Le-Brut I remembered now that I had some extra stuff in my emacs config... ^^; feel free to try it out: https://gist.github.com/Saikyun/cb8f916751ffb1977790ed594f900d4d
I'm very sorry that the installation is this messy. I haven't used miracle in a while. I'll add that to the readme as well
oh now I see, it was already in the readme, but further down: https://github.com/Saikyun/miracle#for-autocompletion-use-the-following-thanks-sogaiu
I restructured the readme a bit, so hopefully it's easier to see the part about autocomplete configuration now :)
Le-Brut
@Le-Brut
Oh, I had that in my config : ) Except for the miracle-eval-wrapping-sexp part (btw start-of-sexp is not part of emacs, I think) and I had company enabled. After some testing, I can say that the actual completion engine actually seems to function, as emacs receieves the list of completions! Which I think is good news (see https://pastebin.com/MLWw1yQ8 for details.) I have a feeling there was some breaking change in either emacs 27 or company mode, so I am gonna go test that now.
Saikyun
@Saikyun
whoops, miracle-eval-wrapping-sexp shouldn't be there, osrry ^^;
ah, I see. I'm using emacs 26.3 fwiw
it's worth mentioning you might have more luck using cider :) though I think making more extensions is easier with miracle (since the codebase is small)
Le-Brut
@Le-Brut
Yeah, I read some of the discussions here, miracle.save vid looked nice if that's the kind of extensions you are talking about : ) The qualities of a small code base are always appreciated. I haven't figured out if cider got completion yet, I think @Tko1 was working on that though.
Saikyun
@Saikyun
yeah exactly :)