Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 24 23:47
    bakpakin commented #1037
  • Sep 24 23:45
    bakpakin commented #1037
  • Sep 24 00:59
    andrewchambers commented #1037
  • Sep 22 15:58

    bakpakin on master

    Fix pass by reference in window… (compare)

  • Sep 22 15:55
    bakpakin reopened #1037
  • Sep 22 08:16
    kamisori commented #1037
  • Sep 21 19:16
    kamisori commented #1025
  • Sep 21 07:48
    kamisori commented #1037
  • Sep 21 07:47
    kamisori commented #1037
  • Sep 21 07:38
    kamisori commented #1037
  • Sep 21 07:21
    kamisori commented #1025
  • Sep 21 00:59
    soxfox42 closed #1034
  • Sep 21 00:59
    soxfox42 commented #1034
  • Sep 20 20:45
    bakpakin closed #1001
  • Sep 20 20:45
    bakpakin closed #1037
  • Sep 20 20:44
    bakpakin commented #1037
  • Sep 20 20:42

    bakpakin on master

    Fix ifdef in capi.c for janet_g… (compare)

  • Sep 20 20:37

    bakpakin on master

    Address #1037 - move stack hack… (compare)

  • Sep 20 16:01
    kamisori commented #1025
  • Sep 20 16:00
    kamisori commented #1025
Sean Walker
@swlkr
it would be cool if there was a datastructure called "lemon" because you know, lemon/slice
John Gabriele
@uvtc
:)
John Gabriele
@uvtc
Where is Janet Mendoza? If I search that name the results are all people with that name.
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
In elixir it’s ‘take’
John Gabriele
@uvtc
Ooof. Whoops. It's at https://github.com/bakpakin/mendoza .
skuza
@skuza:matrix.skuz.xyz
[m]
is there a way to error in the C API?
Eric Shimizu Karbstein
@GrayJack
@skuza:matrix.skuz.xyz I think it's the janet_panicv function
skuza
@skuza:matrix.skuz.xyz
[m]
was going to ask why jpm build was trying to read build - spent half an hour repeatedly running janet build and expecting it to work 🤦
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]

So according to my understanding of Janet's tree-shaking, anything that's not included in the entrypoint of a native executable shouldn't be included in the resulting binary. Given that, I have this toy module:

(def- strs
  @["this is a string"])

(def- wrapped (map string/bytes strs))

(defn main [& args]
  (each s wrapped (pp s)))

I ran strings on the resulting binary and this is a string was in the output. What was I missing?

bakpakin
@bakpakin:matrix.org
[m]
Interestingly, when marshaling integers less than 200, they are converted directly to a corrsponding byte
so (print (marshal wrapped)) should show the string
but that is the array being marshalled, not the original string
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
interesting
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
As I recall, it's not tree-shaking the standard library yet, but it's a possibility - is that right?
bakpakin
@bakpakin:matrix.org
[m]
It depends what you are doing
Functions from the core library will have tree shaking and there is a way to not allocate the standard library at startup - however, there is no guarantee that the core library bytecode will not be included in the final binary.
skuza
@skuza:matrix.skuz.xyz
[m]
is there a robust way to get the arity of a function/cfunction? disasm works but not on cfunctions
that is, ((disasm nil?) :arity)
sogaiu
@sogaiu:matrix.org
[m]
probably not what you're looking for, but fwiw, for functions that take at least one argument, calling them with zero arguments gives an error message including arity info (in some cases?).
i guess one can use compile and examine the return value too.
e.g. (compile '(put 1))
gives:
@{:column 11 :error "<function put> expects at least 3 arguments, got 1" :line 8}
not great for sure
there's this neat thing andrewchambers made: https://github.com/andrewchambers/janet-where-defined to find definition locations of things including c functions. i don't suppose it would have any hints -- it does require debug symbols for c functions though.
andrewchambers
@andrewchambers
@skuza:matrix.skuz.xyz not really a reliable way atm
Levi R. I. Tan Ong
@levitanong
Hi all! I'm trying to develop a simple slack bot on janet (basically an http server) and I'm using circlet and ijanet on emacs. Right now I have an insane workflow where every time I change something, I have to interrupt the entire janet process (C-c C-c on emacs) and restart the repl, reevaluate the buffer, then start the server. The experience with vscode is pretty much the same. Is there a better way?
saikyun
@saikyun
Do you have eval buffer in ijanet? :)
If you want to keep state around, you can implement defonce: https://github.com/janet-lang/janet/discussions/607
I don't know anything about circlet though
Levi R. I. Tan Ong
@levitanong
ah sorry, i phrased it weirdly. I'm running ijanet on emacs (and yes i have the eval buffer) and i'm trying to use circlet, which is a webserver based on mongoose. It has a (while true) to keep the server running, and it seems like the repl is blocked while this is happening. Having said this, I realize the solution might simply be to wrap it in a coroutine. That would make it async, and perhaps not block the repl.
andrewchambers
@andrewchambers
I think you need to consider which bits of state are persistent and which are not
and use vars
and manually code some reloading logic
but i think its possible
saikyun
@saikyun
I solved a similar problem with netrepl and ev/call. Relevant bits of code: https://github.com/Saikyun/text-experiment/blob/main/src/main.janet#L503
I also used dofile to get an env and merge it into the root env: https://github.com/Saikyun/text-experiment/blob/main/src/file_handling.janet#L54
@sogaiu:matrix.org has some info about using netrepl from Emacs, but I'm not sure if that code is public
Zach Smith (subsetpark)
@subsetpark:matrix.org
[m]
There’s an ijanet now??
sogaiu
@sogaiu:matrix.org
[m]
i think the emacs netrepl code i have is here: https://gist.github.com/sogaiu/aa957885d965e4b874fc83c55f873719
@subsetpark: may be you found it already, but iiuc, ijanet refers to this: https://github.com/SerialDev/ijanet-mode
andrewchambers
@andrewchambers
@bakpakin:matrix.org i sometimes wonder if polymorphic number functions should have just called methods instead of using polymorphic operators. It seems more orthogonal
e.g.
(:+ a b)
it seems pretty clear what is going on
so the answer to writing a polymorphic formula would have been to use methods for everything
i guess that would have required methods on things like Number
the syntax doesn't even look that bad imo
i guess it would put you in the situation that to use int/s64 you would be required to use methods
andrewchambers
@andrewchambers
in hind sight i think basically everything numeric function that is polymorphic should be under a namespace like