Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 05:47
    pyrmont commented #914
  • 05:28
    harryvederci commented #914
  • 00:16

    bakpakin on master

    Consolidate related tests Support looking up missing symb… Remove :modules dynamic binding and 4 more (compare)

  • 00:16
    bakpakin closed #914
  • 00:16
    bakpakin commented #914
  • Jan 24 07:47
    andrewchambers closed #486
  • Jan 24 07:47
    andrewchambers commented #486
  • Jan 24 02:16
    pyrmont synchronize #914
  • Jan 24 02:08
    pyrmont synchronize #914
  • Jan 23 01:37

    bakpakin on master

    Update CHANGELOG.md (compare)

  • Jan 22 23:11
    sogaiu commented #533
  • Jan 22 17:45
    ishehadeh closed #912
  • Jan 22 16:55
    pyrmont synchronize #914
  • Jan 22 16:31
    pyrmont commented #533
  • Jan 22 16:24
    pyrmont commented #912
  • Jan 21 23:15

    bakpakin on master

    Fix formating on master. Avoid possible infinite loop in… Merge branch 'master' of github… (compare)

  • Jan 21 23:00
    bakpakin commented #914
  • Jan 21 22:45

    bakpakin on master

    Add ppc64 to os/arch Same as #… Merge pull request #915 from Al… (compare)

  • Jan 21 22:45
    bakpakin closed #915
  • Jan 21 22:40
    bakpakin commented #915
pp
@damnpepe:matrix.org
[m]
It is fixed here, thank you
pp
@damnpepe:matrix.org
[m]
speaking of macros, I am playing with these two:
(defmacro vars [& bindings]
  ~(upscope
     ,;(seq [[n v] :in (partition 2 bindings)] (tuple 'var n v))))

(defmacro defs [& bindings]
  ~(upscope
     ,;(seq [[n v] :in (partition 2 bindings)] (tuple 'def n v))))
tionis
@tionis:matrix.org
[m]

How would one increase the value of a field in a 3-dimensional array by one (like the ++ macro does) the janet way?

To give an example I want to increase the 1 to a 2:

@(
  @(
    @(0 0 0) 
    @(0 1 0) 
    @(0 0 0)) 
  @(
    @(0 0 0) 
    @(0 0 0) 
    @(0 0 0))
)
1 reply
llmII
@llmii:matrix.org
[m]
(++ (get 1 (get 1 (get 0 3darray)))) possibly
I may have fudged the indexing a bit with the gets but that's sorta it
tionis
@tionis:matrix.org
[m]
this gives me the same error as the get-in macro
```
compile error: expected 2 element tuple for l-value to set
llmII
@llmii:matrix.org
[m]
what's the result of (get 1 (get 1 (get 0 3darray)))?
tionis
@tionis:matrix.org
[m]
nil
llmII
@llmii:matrix.org
[m]
that's why
tionis
@tionis:matrix.org
[m]
(get-in grid [0 0 0]) gives me 0
1 reply
llmII
@llmii:matrix.org
[m]
need to use a get that gets the thing you need gotten
oh hmm, what does (get-in wait, you're using@(instead of@[`?
tionis
@tionis:matrix.org
[m]
yes, they should be the same if I read the docs correctly
llmII
@llmii:matrix.org
[m]
(def arr [0 1 2 3 4])
(put arr 0 (+ 1 (get arr 0)))
# @[1 1 2 3 4]
so...
try put-in
tionis
@tionis:matrix.org
[m]
Oh I overlooked that
Maybe i should look into making my own ++in macro
llmII
@llmii:matrix.org
[m]
I guess it's put and alike for associative datastructures and set for vars
hmmm, no, set works on keyed data structures per the specials doc
but yes, I sorta would have assumed (++ (variant-amount-of-gets-here)) would have worked
tionis
@tionis:matrix.org
[m]
Ok, this does the trick for me:
(defmacro ++in [variable arr] ~(,put-in ,variable ,arr (+ (,get-in ,variable ,arr) 1)))
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
I think update-in is probably the best way to do what you want using standard pieces
1 reply
Relevant to the recurring conversation about more powerful version resolution in jpm, this is apparently all the rage: https://nex3.medium.com/pubgrub-2fb6470504f
crocket
@crocket
On gentoo linux, I manage jpm packages as gentoo packages. On other linux distributions, jpm needs to take care of jpm package updates.
jpm doesn't seem to have a command for updating installed jpm packages.
bakpakin
@bakpakin:matrix.org
[m]
Reinstalling a package should update. No easy way to update all at once though besides iterating through the manifest
pp
@damnpepe:matrix.org
[m]
bakpakin: what is the easiest way to use u64 with string/from-bytes please?
or even better I have 64 bit number and I need to create string with bytes from it :-)
pp
@damnpepe:matrix.org
[m]
This is the best I have managed to do it :-)
(string/from-bytes 2r01111111
                           ;(seq [i :down-to [56 0 8]]
                              (scan-number (string (band (brshift (int/u64 dl) i) 0x000000FF)))))
the 64bits number is the seq
@saikyun: PS: finaly fixing trevor, as I got over the 16 bits size tooo :-)
pp
@damnpepe:matrix.org
[m]
maybe string and scan-number is good enough, at least for me now
saikyun
@saikyun

@saikyun: PS: finaly fixing trevor, as I got over the 16 bits size tooo :-)

haha, nice! :D

I took a break from working on my blog, hopefully I'll get to it again sometime soon :)
2 replies
I got a new job and will work 50% on creating a game using Freja :D starting in janetuary
yumaikas-
@yumaikas:matrix.org
[m]
Congratulations 🎉
1 reply
pp
@damnpepe:matrix.org
[m]
bakpakin: just an idea, but I guess we can have (get (int/64 1) 0) for the first byte and so on?
bakpakin
@bakpakin:matrix.org
[m]
@pp that sounds like a very bad interface
pp
@damnpepe:matrix.org
[m]
true :)
harryvederci
@harryvederci
Nice saikyun, will you blog about making the game?
saikyun
@saikyun
@harryvederci I was mostly thinking about blogging about Freja, but atm I've only written half a blog post, so who is to tell :P
llmII
@llmii:matrix.org
[m]
If one was to need a config file for software they've written, what do people typically use with Janet
I see there is support for toml and json. No idea about yaml or ini. I really dislike json for configuration files, but I have used json with Janet for talking to other processes so I know that works well. XML and alike are most definitely a no go.
pp
@damnpepe:matrix.org
[m]
I am using .jdn where needed
llmII
@llmii:matrix.org
[m]
pp: approachable from a human standpoint? (like, can comment in the file)
pp
@damnpepe:matrix.org
[m]
very good question about which I am not sure, but it is a Janet code at the end, so I guess you can
llmII
@llmii:matrix.org
[m]
hmmm, since it's janet code, I guess the major diff between it and regular janet code is it only allows returning values? as in, protected from arbitrary code exec?
pp
@damnpepe:matrix.org
[m]
well I am reading the config this way: (def file-conf ((compile (parse (slurp file))))) so definitely executing the code