Re: Guile Potluck 2021

2021-03-01 Thread pukkamustard



Hi,

I'd like to contribute an initial version of guile-cbor (v0.1.0) 
to the

potluck:

https://inqlab.net/git/guile-cbor.git/

The Concise Binary Object Representation (CBOR), as specified by 
RFC
8949, is a binary data serialization format. CBOR is similar to 
JSON but
serializes to binary which is smaller and faster to generate and 
parse.


guile-cbor provides a Guile implementation of CBOR.

Happy hacking!
pukkamustard

Mike Gran  writes:


Hello All-

In celebration of the (slightly belated) 10-year anniversary of 
Guile
v2.0, we're having another Guile Potluck!  The Guile Potluck is 
a
randomly annual event to give people a chance to show off their 
Guile
projects and skills.  Think of it as a game jam, but, not 
constrained

to games.

To participate, on or before Mar 6, send an email to 
guile-user@gnu.org
with instructions on how to find your entry, which could be 
anything

you like.  For example,

   - a script showing off some feature of Guile or your favorite 
   Guile

   library
   - a blog post describing something interesting about Guile
   - an updated release of a neglected library
   - a mini-game
   - a graphical or audio demoscene-type demo

There probably won't be any prizes.  But there will definitely 
be an e-

mail and blog post about the entries.

If you think you might attempt to participate, please reply to 
this e-
mail so I can gauge the feasibility of some sort of 
participation swag.


Regards,
Mike Gran, on behalf of the Guile team





Seeking Advice on syntax/macros in separate files

2021-03-01 Thread Andrew Burgess
Hello,

I'm trying to understand how I am supposed to make use of
define-syntax type constructs (or possibly, when working with older
code define-macros) in a code base split over many files

I'm updating a code base from guile 1.8.8, and currently having it
running successfully on guile 2 and 3.  With the new auto-compilation
in guile 2 and 3 I'm now trying to work out how users will invoke the
tool.

My concerns are based on this page of the guile manual:

  
https://www.gnu.org/software/guile/manual/html_node/Compilation.html#Compilation

specifically this:

  "... Guile does not yet do proper dependency tracking, so that if
  file a.scm uses macros from b.scm, and b.scm changes, a.scm would
  not be automatically recompiled."

And just to confirm what the manual says, here's my test:

  $ cat f1.scm
  (use-modules (f2))
  (foo 123)
  (define-accessor xxx 3)
  (xxx 9)

  $ cat f2.scm
  (define-module (f2)
#:export (foo)
#:export-syntax (define-accessor))

  (define (foo arg)
(display "foo: ")
(display arg)
(newline))

  (define-syntax-rule (define-accessor name n)
(define (name obj)
  (display "accessor for field: ")
  (display n)
  (display " in ")
  (display obj)
  (newline)))

I'm then running `guile -L . -s f1.scm`, and indeed, as the manual
suggests, changes to `foo' are visible, but, unless I force
recompilation, changes to `define-accessor` are not.

I also tried replacing the use of `use-modules` with raw `include`,
but this is even worse, as now changes to `foo` are not seen either.

My choice of `define-accessor' is not random, this is drawn from an
example in the guile manual here:

  https://www.gnu.org/software/guile/manual/html_node/Vtable-Example.html

And here lies my confusion:

First, let me say I'm pretty much a scheme/guile newbie, but I thought
that macros (or syntax extensions) were a huge part of the power of
languages like scheme.  The guile manual itself uses them to show how
an object like system could be created.

However, it would seem natural to place such a system into a separate
file, presumably as a module.

But, and here's my problem: the first time I ship this software to the
user, everything's fine.  But if I ship them an update that touches
any of the macros, then I'm stuck.  The user now needs to be aware
that they have to take special steps in order to ensure the previously
compiled code is deleted.  And that's not great for a user experience.

So, my current thinking is to wrap the invocation of the guile script
in a shell script, which _always_ forces recompilation.  But, if I'm
doing that, I may as well just disable compilation completely.  But
this doesn't seem right.

So, I'm sure I must be missing something here.  How do others deal
with this situation?

- Am I missing an obvious solution for working with syntax/macros and
  multiple files?

- Am I wrong to think that syntax/macros are such a big part of the
  language?  Should I be limiting syntax/macro usage to small scopes,
  i.e. within a single file, and only true defines should be exposed
  outside of a file?

- Maybe Guile just isn't designed for writing large, multi-file
  projects?

- Maybe Guile projects are only ever shipped to users who are happy
  managing the compile cache themselves, e.g. more power users, and
  not really for general users?

As I said, I'm fairly new to guile/scheme so my expectation here is
that it's me that's missing something here.

Thank you for any help you can offer,

Andrew



Re: Guile Potluck 2021

2021-03-01 Thread Linus Björnstam
Hi Guilers!

I found some code I wrote while drunk. I had completely forgotten about it, but 
found it a fun little exercise. I would argue that falls under the "neglected 
library" category.

Anyway: It implements python-style generators, with yield and, more 
importantly, yield-from:

https://git.sr.ht/~bjoli/awesome-coroutine-generators

I tried to extend it while sober. It didn't work, so be warned  I guess. The 
code is somewhat a mess, but short enough to be understandable.
Best regards
  Linus Björnstam

On Thu, 18 Feb 2021, at 18:24, Mike Gran wrote:
> Hello All-
> 
> In celebration of the (slightly belated) 10-year anniversary of Guile
> v2.0, we're having another Guile Potluck!  The Guile Potluck is a
> randomly annual event to give people a chance to show off their Guile
> projects and skills.  Think of it as a game jam, but, not constrained
> to games. 
> 
> To participate, on or before Mar 6, send an email to guile-user@gnu.org
> with instructions on how to find your entry, which could be anything
> you like.  For example,
> 
>- a script showing off some feature of Guile or your favorite Guile
>library
>- a blog post describing something interesting about Guile
>- an updated release of a neglected library
>- a mini-game
>- a graphical or audio demoscene-type demo
>
> There probably won't be any prizes.  But there will definitely be an e-
> mail and blog post about the entries.
> 
> If you think you might attempt to participate, please reply to this e-
> mail so I can gauge the feasibility of some sort of participation swag.
> 
> Regards,
> Mike Gran, on behalf of the Guile team
> 
> 
> 
>



Re: Guile Potluck 2021

2021-03-01 Thread Aleix Conchillo Flaqué
On Mon, Mar 1, 2021 at 1:15 PM Linus Björnstam
 wrote:
>
> Hi Guilers!
>
> I found some code I wrote while drunk. I had completely forgotten about it, 
> but found it a fun little exercise. I would argue that falls under the 
> "neglected library" category.
>
> Anyway: It implements python-style generators, with yield and, more 
> importantly, yield-from:
>
> https://git.sr.ht/~bjoli/awesome-coroutine-generators
>
> I tried to extend it while sober. It didn't work, so be warned  I guess.

You know what to do then :-D.

> The code is somewhat a mess, but short enough to be understandable.
>

Aleix



Re: Guile Potluck 2021

2021-03-01 Thread Dr. Arne Babenhauserheide
Hi Guilers,

There’s one more thing for the Potluck:

I started doing some code-catas in Guile wisp:
https://www.draketo.de/software/wisp-code-katas

Liebe Grüße,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


Re: Guile Potluck 2021

2021-03-01 Thread Dr. Arne Babenhauserheide
Hi Linus,

I now created four profiles, one for the CSV import and three for the
trust calculation. They are generated with:

guile -L .
> (import (wispwot wispwot))
> ,profile (define changed-and-state (import-trust-csv 
> "trust-anonymized-2020-11-01-under-attack-sorted.csv"))
> ,profile ((@@(wispwot wispwot)import-trust-value) (cdr changed-and-state) 
> "OBSERVER" "OBSERVER" "15363" 100)
> ,profile ((@@(wispwot wispwot)import-trust-value) (cdr changed-and-state) 
> "OBSERVER" "OBSERVER" "242" 100)
> ,profile ((@@(wispwot wispwot)import-trust-value) (cdr changed-and-state) 
> "OBSERVER" "OBSERVER" "853" 100)

% cumulative   self 
time   seconds seconds  procedure
 21.92286.68286.68  wispwot/wispwot.scm:456:18
 21.14276.46276.46  wispwot/wispwot.scm:449:18
 20.86292.23272.82  vector->list
 13.26 2124682.83173.39  srfi/srfi-1.scm:600:7:map2
  6.46 84.52 84.52  %after-gc-thunk
  4.04 55.03 52.83  wispwot/wispwot.scm:457:17
  3.96 54.41 51.81  wispwot/wispwot.scm:450:17
  2.27 29.69 29.63  make-srfi-4-vector
  2.25 29.43 29.43  length+
  1.01 16.43 13.24  wispwot/wispwot.scm:276:0:calculate-scores
  0.93 12.19 12.19  list-tail
  0.53  6.92  6.92  display
  0.23  3.10  3.01  write
  0.16   1295.52  2.12  wispwot/wispwot.scm:375:0:import-trust-value
  0.07  0.95  0.95  object->string
  0.06   1309.39  0.80  srfi/srfi-1.scm:452:2:fold
  0.06  0.78  0.78  srfi/srfi-4.scm:85:20:u16vector-set!
  0.06  0.98  0.75  ice-9/pretty-print.scm:273:0:pretty-print
  0.05 11.09  0.69  wispwot/wispwot.scm:513:8
  0.05  4.98  0.66  ice-9/pretty-print.scm:258:2:rev-string-append
  0.05  0.66  0.66  srfi/srfi-4.scm:85:20:s8vector-ref
  0.05  0.63  0.63  vector-move-left!
  0.03 16.75  0.45  ice-9/pretty-print.scm:37:0:generic-write
  0.03  4.38  0.45  wispwot/wispwot.scm:349:0:vector-append!
  0.03  0.45  0.45  srfi/srfi-4.scm:85:20:s8vector-set!
  0.03  0.39  0.39  srfi/srfi-4.scm:85:20:u16vector-ref
  0.03 29.90  0.33  srfi/srfi-1.scm:580:2:map
  0.03  9.09  0.33  ice-9/pretty-print.scm:62:4:loop
  0.03  0.66  0.33  make-vector
  0.02 32.59  0.27  wispwot/wispwot.scm:194:0:calculate-ranks
  0.02  0.92  0.27  
wispwot/wispwot.scm:415:2:find-index-record-if-needed
  0.02  0.27  0.27  procedure?
  0.02  0.24  0.24  ice-9/boot-9.scm:1345:3
  0.02  0.24  0.24  make-string
  0.01  0.18  0.18  ice-9/pretty-print.scm:100:12
  0.01  0.18  0.18  min
  0.01  6.14  0.15  ice-9/pretty-print.scm:293:17
  0.01  0.21  0.15  ice-9/pretty-print.scm:72:22
  0.01  0.15  0.15  srfi/srfi-4.scm:85:20:u16vector->list
  0.01  0.15  0.15  remove
  0.01  0.12  0.12  length
  0.01  0.12  0.12  srfi/srfi-4.scm:76:2:make-u8vector
  0.01  0.12  0.12  random
  0.01  0.12  0.12  srfi/srfi-4.scm:85:20:s8vector-length
  0.01  0.15  0.09  srfi/srfi-4.scm:85:20:u16vector-length
  0.01  0.12  0.09  %read-line
  0.01  0.09  0.09  srfi/srfi-4.scm:85:20:list->u8vector
  0.01  0.09  0.09  srfi/srfi-4.scm:85:20:u8vector-set!
  0.01  0.09  0.09  hash-ref
  0.01  0.09  0.09  ice-9/pretty-print.scm:61:2:wr
  0.01  0.09  0.09  cdr
  0.00  1.40  0.06  ice-9/pretty-print.scm:58:2:out
  0.00  0.39  0.06  wispwot/wispwot.scm:504:4
  0.00  0.06  0.06  integer?
  0.00  0.06  0.06  ice-9/boot-9.scm:806:0:and=>
  0.00  8.08  0.03  ice-9/pretty-print.scm:95:4:pr
  0.00  0.24  0.03  srfi/srfi-4.scm:85:20:list->u8vector
  0.00  0.09  0.03  string-split
  0.00  0.03  0.03  srfi/srfi-4.scm:85:20:make-u16vector
  0.00  0.03  0.03  car
  0.00  0.03  0.03  srfi/srfi-4.scm:85:20:make-s8vector
  0.00  0.03  0.03  eof-object?
  0.00  0.03  0.03  srfi/srfi-4.scm:85:20:s8vector->list
  0.00  0.03  0.03  ice-9/pretty-print.scm:256:0:reverse-string-append
  0.00  0.03  0.03  list?
  0.00  0.03  0.03  ice-9/boot-9.scm:888:0:iota
  0.00  0.03  0.03  reverse!
  0.00  0.03  0.03  append
  0.00  0.03  0.03  list-head
  0.00  0.03  0.03  srfi/srfi-1.scm:584:5:map1
  0.00   1307.69  0.00  ice-9/ports.scm:428:0:call-with-input-file
  0.00   1307.69  0.00  :2:9
  0.00   1307.69  0.00  ice-9/ports.scm:492:3
  0.00563.14  0.00  remove
  0.00 84.52  0.00  anon #x7a24b0
  0.00 54.83  0.00  gc
  0.00  3.10  0.00  object->string
  0.00  0.12  0.00  ice-9/rdelim.scm:193:0:read-line
  0.00  0.03  0.00  inexact->exact
---
Sample count: 43863
Total time: 1307.687229447 seconds (726.756595442 seconds in GC)


% cumulative   self 
time   seconds seconds  procedure
 57.35 21.72