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
James Muguira
@muguira-james

I am working c++ (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1), trying to add a key to a janet table.

I get the table with: JanetTable *tt = janet_table(0); .

I try to add an entry with: janet_table_put(tt, janet_wrap_string("count"), janet_wrap_number(10)); .

The key shows up as "" when I print the table in the repl?

why?
thank you in advance!

bakpakin
@bakpakin:matrix.org
[m]
Use janet_cstringv("count") to wrap the string. Janet wrap string expects an already memory managed string, allocated by the Janet runtime.
1 reply
Levi R. I. Tan Ong
@levitanong
Given that JPM now requires to be built on the machine, does this mean that for CI jobs, we to download and bootstrap jpm each time? If so, this seems a bit wasteful :O
bakpakin
@bakpakin:matrix.org
[m]
I'm not sure why you would need to, although bootstrapping is quick, you are really just paying for the download time
1 reply
tionis
@tionis:matrix.org
[m]
What would be the janet equivalend of piping to /dev/null with streams?
And what would be the best way to pipe a file into a program executed via os/execute without reading the whole thing into memory?
andrewchambers
@andrewchambers
I think you could literally open /dev/null and pass it as stdout
I'm less sure about streams vs files
but the same probably works
tionis
@tionis:matrix.org
[m]
I see, this wouldn't work across platforms though...
bakpakin
@bakpakin:matrix.org
[m]
Yes, only way to read from /dev/null stuff is with (os/open "/dev/null"). Windows has a special file "NUL" that is the same thing.
But those two should capture any system I know of
StayingAlive1998
@StayingAlive1998

@bakpakin:matrix.org It is not a problem with Janet. I figured out the problem. The Documentation should include a note to Check-Mark the C++ Build tools when installing the VS Build Tools. Now when i type cl.exe it gives me this: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools>cl.exe
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27048 for x86
Copyright (C) Microsoft Corporation. All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

StayingAlive1998
@StayingAlive1998
I think i already have Janet installed. I thought that was like step two for windows... lmao.
bakpakin
@bakpakin:matrix.org
[m]
Alright, sounds good. Yes, the build tools are only needed if you want to build Janet from source on windows or build C/C++ extensions for Janet
For hello world, you just need the .msi
StayingAlive1998
@StayingAlive1998
Alright so i created the hello world program file and it is on my desktop. I typed janet hello.janet in the janet window and got repl:1:1: compile error: unknown symbol janet
repl:1:7: compile error: unknown symbol hello.janet
bakpakin
@bakpakin:matrix.org
[m]
The Janet window is a Janet repl. Try what you did from cmd.exe
Eric Shimizu Karbstein
@GrayJack
What about if you try janet.exe hello.janet? Note that I'm not a windows users, it's just my wild guess
StayingAlive1998
@StayingAlive1998
Success. I am programmer now. Thank you.
StayingAlive1998
@StayingAlive1998
So is the Janet repl a virtual turing/state machine?
andrewchambers
@andrewchambers
The janet virtual machine is equivalent to one I suppose
sogaiu
@sogaiu:matrix.org
[m]
Bryan Maass
@escherize
I'm not sure how to diagnose this error message I get when running sudo jpm deps:
$ sudo jpm deps
From https://github.com/janet-lang/json
 * branch            HEAD       -> FETCH_HEAD
HEAD is now at c4671e8 Use normal, module level import in test file.
compiling json.c to build/json.o...
json.c:23:10: fatal error: 'janet.h' file not found
#include <janet.h>
         ^~~~~~~~~
1 error generated.
error: command failed with non-zero exit code 1
error: build fail
  in pdag [/opt/homebrew/Cellar/janet/1.22.0/lib/janet/jpm/dagbuild.janet] (tailcall) on line 79, column 23
  in <anonymous> [/opt/homebrew/Cellar/janet/1.22.0/lib/janet/jpm/pm.janet] on line 215, column 9
  in <anonymous> [/opt/homebrew/Cellar/janet/1.22.0/lib/janet/jpm/pm.janet] on line 200, column 5
  in bundle-install [/opt/homebrew/Cellar/janet/1.22.0/lib/janet/jpm/pm.janet] on line 198, column 3
  in deps [/opt/homebrew/Cellar/janet/1.22.0/lib/janet/jpm/commands.janet] (tailcall) on line 198, column 7
  in _thunk [/usr/local/bin/jpm] (tailcall) on line -1, column -1
  in cli-main [boot.janet] on line 3759, column 17
bakpakin
@bakpakin:matrix.org
[m]
I think the homebrew packaging needs a look - the latest Janet creates an extra symlink for janet.h but should be the same for previous versions. Janet.h should be installed by the installer
Bryan Maass
@escherize
I'll try building on this machine
thanks @bakpakin:matrix.org
bakpakin
@bakpakin:matrix.org
[m]
Both <janet.h> and <janet/janet.h> should work for includes with jpm
Also use jpm show-paths and look for headerpath
andrewchambers
@andrewchambers
whats the reason for the new symlink?
bakpakin
@bakpakin:matrix.org
[m]
The convention of #include <janet.h> only worked with jpm by default - without any specially flags (compiling with cc mymod.c) the include declaration would be #include <janet/janet.h>
So in the latest installer I set it up to add a symlink so that janet.h was installed to both /usr/include/janet/janet.h and /usr/include/janet.h
basically, my editor was getting confused by the includes. Someone a while ago made a patch or an issue to move janet.h to janet/janet.h and I foolishly merged it
but I think there might be some issues with the meson version since I bet homebrew has an old meson version (just a guess)
andrewchambers
@andrewchambers
hmm, ok - dunno if I've seen other packages do that - install the same header into two places
bakpakin
@bakpakin:matrix.org
[m]
Yeah, it honestly shouldn't affect this at all though, it should just add a symlink so not sure why it would be unable to find janet.h
actually, just checking and I see a few packages that do this
andrewchambers
@andrewchambers
:P
bakpakin
@bakpakin:matrix.org
[m]
my ncurses install seems to lol, not exactly a great justification
libpng, and a few smaller ones.
StayingAlive1998
@StayingAlive1998
image.png
I found getline in the docs and setq in a CLisp tutorial and removed the q because it didnt highlight. How can i change a variable based on terminal input?
bakpakin
@bakpakin:matrix.org
[m]

I would be careful with a Common Lisp tutorial, Janet is not common lisp.

Your issue is that you need to declare a binding first with def. For example, (def name (getline)) will store a buffer in a binding name.

Please read the Janet documentation for examples
StayingAlive1998
@StayingAlive1998
I am reading them. I was vaguely on that path but it felt like a stretch. Thank you! will read up on those concepts!
StayingAlive1998
@StayingAlive1998
mind blown its all starting to make sense. This is such a clean and well documented language!
John Gabriele
@uvtc
@StayingAlive1998 , I wrote up some Janet "quick ref" notes that I think are pretty useful as well: http://www.unexpected-vortices.com/janet/notes-and-examples/language-basics.html
StayingAlive1998
@StayingAlive1998
Great! The more resources the merrier. I especially like a title you gave in the functions category "Lazy Seqs" haha. Thank you Mr.Gabriel.
John Gabriele
@uvtc
You're welcome. It's still pretty incomplete, but I update it every now and again.
Jeanne-Kamikaze
@jeannekamikaze
Hello guys. What happened to file/popen? Is there an equivalent under a different name now?