[racket-users] 7 GUIs

2019-06-01 Thread Matthias Felleisen

Someone recently mentioned the “7 GUIs” task. I spent a couple of days to write 
up minimal solutions: 

 https://github.com/mfelleisen/7GUI/blob/master/task-7.rkt 
 

In my spare time, I will develop this repo in more depth (types, units, etc) 
because it looks like a reasonably educational task. 


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/9A5BBCC3-C65A-4BFD-8C37-F7F35BCF39E7%40felleisen.org.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] New Package: Dynamic FFI - Write C Code Inline

2019-06-01 Thread Alexis King
This looks extremely cool. Thanks for your hard work—I will probably give this 
a try next time I use the FFI.

Alexis

> On Jun 1, 2019, at 14:06, David Benoit  
> wrote:
> 
> Hi All,
> 
> I've recently released a new library 
>  for dynamically generating 
> FFI bindings to C by parsing header files.
> It also allows users to create FFI libraries by writing C functions directly 
> inline in Racket programs.  
> 
> The library works as a native extension to Racket by linking with Clang's 
> parser libraries and converting AST declarations into FFI objects.
> As a result, the package depends on Clang and LLVM headers and libraries.  
> See the documentation  
> for info on installing dependencies.
> 
> I've only built the package on GNU/Linux so far.  If anyone is interested in 
> building the library on other OSes, it should be a fairly trivial port.
> 
> I'd like to give a special thanks to Jay McCarthy, who came up with the idea 
> for this project and was my adviser during its implementation.
> I hope its something the Racket community might find useful!
> 
> More usage examples are available in the docs and the test directory 
>  in the source 
> code.
> 
> Thanks!
> David B
> 
> I'll sign off with a quick preview:
> 
> #lang at-exp racket/base
> 
> (require dynamic-ffi/unsafe)
> 
> @define-inline-ffi[struct-test]{
>   #include 
>   #include 
>   #include 
> 
>   typedef struct {
> char *name;
> uint64_t value;
>   } number;
> 
>   char* names[] = {"zero", "one", "two", "three", "four", "five", "six"
>  "seven", "eight", "nine", "ten", "eleven", "twelve"};
> 
>   number add(number a, number b) {
> number c;
> c.value = a.value + b.value;
> if (c.value >12)  {
>   fprintf(stderr, "error: this example can only count to twelve...\n");
>   exit(1);
> }
> c.name = names[c.value];
> return c;
>  }
> }
> 
> ;; _list-structs are created by default.  I hope to optimize this in the 
> future.
> 
> (define n2 (list "two" 2))
> 
> (define n7 (list "seven" 7))
> 
> (printf "add(n2, n2): ~a\n" (struct-test 'add n2 n2))  ;; output: add(n2, 
> n2): (four 4)
> (printf "add(n7, n7): ~a\n" (struct-test 'add n7 n7))  ;; output: error: this 
> example can only count to twelve...
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/eff63a65-d1b7-475b-9240-7158b024d740%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/7F378714-5C17-4DD1-AA56-C6DE868E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] New Package: Dynamic FFI - Write C Code Inline

2019-06-01 Thread David Benoit
Hi All,

I've recently released a new library 
 for dynamically 
generating FFI bindings to C by parsing header files.
It also allows users to create FFI libraries by writing C functions 
directly inline in Racket programs.  

The library works as a native extension to Racket by linking with Clang's 
parser libraries and converting AST declarations into FFI objects.
As a result, the package depends on Clang and LLVM headers and libraries.  
See the documentation  
for info on installing dependencies.

I've only built the package on GNU/Linux so far.  If anyone is interested 
in building the library on other OSes, it should be a fairly trivial port.

I'd like to give a special thanks to Jay McCarthy, who came up with the 
idea for this project and was my adviser during its implementation.
I hope its something the Racket community might find useful!

More usage examples are available in the docs and the test directory 
 in the source 
code.

Thanks!
David B

I'll sign off with a quick preview:

#lang at-exp racket/base

(require dynamic-ffi/unsafe)

@define-inline-ffi[struct-test]{
  #include 
  #include 
  #include 

  typedef struct {
char *name;
uint64_t value;
  } number;

  char* names[] = {"zero", "one", "two", "three", "four", "five", "six"
 "seven", "eight", "nine", "ten", "eleven", "twelve"};

  number add(number a, number b) {
number c;
c.value = a.value + b.value;
if (c.value >12)  {
  fprintf(stderr, "error: this example can only count to twelve...\n");
  exit(1);
}
c.name = names[c.value];
return c;
 }
}

;; _list-structs are created by default.  I hope to optimize this in the future.

(define n2 (list "two" 2))

(define n7 (list "seven" 7))

(printf "add(n2, n2): ~a\n" (struct-test 'add n2 n2))  ;; output: add(n2, n2): 
(four 4)
(printf "add(n7, n7): ~a\n" (struct-test 'add n7 n7))  ;; output: error: this 
example can only count to twelve...





-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/eff63a65-d1b7-475b-9240-7158b024d740%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] outreach reddit /r/learnprogramming

2019-06-01 Thread Stephen De Gabrielle
Thanks,
I have set up an ifttt applet to email me if someone posts to
r/learnprogramming and includes the word racket so I can try answer if I
see the question and have the required time and knowledge to respond:
>If New post from search 'subreddit:learnprogramming Racket', then Send
yourself an email

I have similar set up for r/racket.

NB If I don't know the answer I try to direct them to the racket-users or
some site with other racketeers:
https://github.com/racket/racket/wiki/How-to-get-help

Stephen


On Sun, May 26, 2019 at 9:10 PM Neil Van Dyke  wrote:

> If you want an interesting place to do outreach for Racket,
> `/r/learnprogramming` has almost a million subscribers, and a search
> suggests that questions about Racket (and criticisms) tend to go
> unanswered:
>
> https://old.reddit.com/r/learnprogramming/
>
> https://old.reddit.com/r/learnprogramming/search?q=racket_sr=on
>
> https://old.reddit.com/r/learnprogramming/search?q=htdp_sr=on
>
> You can answer things, and point documentation, packages, etc., and also
> suggest that all the action is on `racket-users`.
>
> I was reminded of `/r/learnprogramming` when it was mentioned as as a
> venue for sneaky influencing, in this:
>
> https://www.nemil.com/musings/hack-an-engineer.html
>
> You can also promote Racket there in non-reactive ways, with posts and
> such, but don't take the sneaky bits in the article above as
> prescriptive, and repeat the mantra: Don't Be Evil (Really).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/0bf3eba2-abc2-fe06-6c03-b51364460852%40neilvandyke.org
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-%2Bzs5kZwVYTnnN8PPp44ss-n8%3Dinmc1HkT4ycQ2k7g%3DTA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.