
@comradesparklepony has joined the channel

Belated reply. I’m not questioning how Racket implements its CFFI. I’m questioning why anyone would want to use it directly for a big library of calls when it doesn’t scale. That is, there’s a level of abstraction which, imo, should be written on top of it. For example, given the collected C function prototypes, structs, unions, typedefs, etc., luajit can generate the FFI in seconds. Now, something like libgdiplus on Windows is like 600 functions plus supporting data structures / pointers. Who would want to spend their time to hard-code that to a Racket CFFI when a layer one level up could code generate it in seconds?

To start, it may be easier to use an antlr C grammar definition to pull in the C declarations and then gen the Racket CFFI.

Haven’t looked into the luajit source code but, if the FFI slurping part of it is extractable then it just needs the Racket CFFI code gen part.

@catherine.c.stwrt has joined the channel

Have you looked at SWIG? http://www.swig.org/Doc4.0/SWIGDocumentation.html#Preface_nn2


Thanks, 2nd one looks good. It would be ideal to have it all coded in Racket.

I’m too new to Racket to be highly productive. Right now, I’m developing some day trading tools in Racket to learn it.

The older you get, the more you want to integrate rather than create from scratch. You realize your time is more valuable as you have less of it to live.

hello. Can somebody say me how use scribble/lp and @interactive together?

@wwall Can’t remember any details, but I have an example: https://github.com/soegaard/soegaard.github.io/blob/master/_src/posts/2013-06-27-drawing-a-bezier-curve.lp.rkt


Check out jeapostrophe’s blog. I think he uses scribble/lp for most of his posts.


my simple code


in @interaction i want to see result 3 but i see test-plus: undefined;
cannot reference an identifier before its definition

Think of interaction as having a repl.

@interaction[(+ 1 2)]
works in the same way as entering (+ 1 2) into the repl.

So if (test-plus 1 2)
is going to work, you need to define test-plus
in the repl first.

i understand it. i have question how i can link my rkt file an interaction? which expression need for #:eval in @interaction?

in rkt file have definition for test-plus. how i can say scriblle for use this module as part of eval?

Do you need the interaction in the same file?

yes

i want to have code, docimentaton and example in one file

Let me try an experiment - I am not sure you can use them in the same file. But I think it will work from into.scbrl

file part1.rkt is very big, and if i use an intro file for examples - i’ll have a lot to rewrite , and the meaning of lp then lost

A step on the way: into.rkt #lang scribble/manual
@require[scribble/lp-include]
@(require scribble/racket scribble/manual scribble/eval)
@(define (make-eval)
(define eval (make-base-eval))
(eval '(require "part01.rkt"))
(eval '(require scribble/lp-include))
(eval '(lp-include "part01.rkt"))
eval)
@section{task 1.}
@(require "part01.rkt")
@(interaction #:eval (make-eval)
(test-plus 1 2))
and part01.rkt #lang scribble/lp
@(require scribble/racket scribble/manual scribble/eval)
This is simple definiition
@chunk[<testdata>
(define (test-plus x y)
(+ x y))]
result of evalution is
@interaction[(test-plus 1 2)]
@chunk[<*>
(require racket)
(provide test-plus)
<testdata>]

ЯндексПереводчик
Thank you so much for the example, but it doesn’t quite fit me. D to think that do can be.

I can’t see how @interaction would work in the same file. The chunks aren’t evaluated. They are collected in the <*> chunk and that’s what is exported.

But I could be missing something.

Anyone knows who wrote scribble/lp ? Matthew or Eli perhaps?


#lang scribble/lp2
@(require scribble/base
scribble/eval)
@title{An Example}
This would be a @bold{wonderful} way to accomplish things!
@chunk[<*>
(define (f x)
<f-body>)]
@chunk[<f-body>
(* x x)]
And then, I could show an example:
@(begin
(require syntax/location)
(define here (quote-source-file))
(define evaluator (make-base-eval))
(evaluator `(begin
(dynamic-require '(file ,here) #f)
(current-namespace
(module->namespace '(file ,here))))))
@examples[
#:eval evaluator
(f 10)
]

This ought to work with interaction
instead of examples
as in the example.

Great! You’re a great man. Thank you very much. I already wanted to deal with macros and write my lp implementation - but you saved me. Thank you very much

this code works fine

Great to hear it works. I wonder how!

Eeek! I’ve just noticed that the racket wiki home page still has Racket2 references on the home page. https://github.com/racket/racket/wiki If anyone with a GitHub account could change to rhombus-brainstorm I’d be most appreciative

Will do

The project description of https://github.com/racket/rhombus-brainstorming is also still “RFCs for Racket 2 design”

Only repo owner can fix that, I think.