Normal Loone | 27 Jun 09:03 2016
Picon
Picon

Writing text% to file

Hello,

I currently want to write a program that includes writing out stuff written in the buffer. But I cant seem to
write out strings stored in text% properly.
Example:

(define txt (new text%))
(send txt insert "hello world" 0 11)
(send txt find-first-snip)

creates "hello world" on the command line.

But neither 
(write-to-file (send txt find-first-snip) path)

(define fdatei (open-output-file path))
(write (send txt find-first-snip) fdatei)

(send txt write-to-file out-stream 0 'eof)

actually writes the string, but does only write name of the struct in the file.

So how exactly do I get to the plain String-text in text% to be able to write it in a file?

best regards,
Loone

--

-- 
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+unsubscribe@...
(Continue reading)

Diego Rodriguez | 26 Jun 14:22 2016
Picon
Gravatar

Compile and Embedding

Hi,
i would like to execute a compiled rack script from an embedding racket program.
The script should contain references and calls to symbols (functions) dynamically added to the
environment from the embedding program.
I managed to make it work using scheme_eval_string_all but i would like to avoid parsing the string each
time i need to execute the script, so my idea was to compile it at program startup and then execute the jit
compiled version of it.
So I tried to parse the string once like do_eval_string_all function does (eval.c file inside the
sources), and instead of evaluating each parsed s-expression i used scheme_compile to generate the
compiled version of each s-expression.
Then after all the expressions were parsed i used scheme_eval_compiled_multi to evaluate them, but this
doesn't work.
In the eval.c file there is a function called scheme_compile_for_eval,
which i think should be the one to call for this scenario, but it's not exposed.

What do you suggest ? Is there another or proper (better) way to do this ?

Thanks

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Diego Rodriguez | 26 Jun 14:10 2016
Picon
Gravatar

VS 2015 Community and Racket Embedding

Hi,
i have followed the guide on the site to embed racket in a c program.
I have noticed the setup bats are not updated for visual studio 2015,
so i had hard times to make it work, but in the end i suceeded.
Now, i have a problem with raco tools, in particular after i have compiled
everything following the README, raco.exe help seems missing ctools and other commands.
The only availables commands are link pkg setup.
I have deceived the problem downloading the 6.5 sources from github and using the raco.exe of the stable
release to generate a compatible bytecode, but clearly i would like to know where i'm wrong with 6.5.7 version.

Thanks

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Matt A. Peerson | 24 Jun 23:49 2016
Picon

(namespace-variable-value) not working with a struct definition?

Hi,

When I define a struct (named e.g. "point") and use namespace-variable-value in REPL it gives the error:
namespace-variable-value: bound to syntax in: point

Is this normal? (although even if it is, it'll force me to use class definitions for my structs in my current project).

Thanks!

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

interested in TR internal error?

I was in the middle of editing a TR file, and I got this error:

../../racket/racket/share/pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt:270:0:
Internal Typechecker Error: contract-def-property: thunk called too early
  This should only be called after the type-checking pass has finished.
while typechecking:
here
originally:
here
>

This was a totally transient error, and I solved it by continuing to edit the file, but I saved a copy in case
anyone’s interested. I can file an (un-minimized) bug report, if desired. Anyone interested?

John

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Carlos Lopez | 24 Jun 17:05 2016
Picon

Using Futures with FFI functions

Hi Everyone, 

First of all, thank you for Racket; it is a great tool, specially the documentation.

I'm trying to use racket's futures to evaluate a function from a c library that takes some time to evaluate
but according to the future visualizer, there is a block and it never runs on its own thread. The block is
marked as scheme_force_value_same_mark.

The c function takes a string argument, loads a file from disk and returns a pointer to the data.

Is it possible to use futures with FFI-defined functions? If so, what rules would the c functions need to follow?

thanks,
carlos.

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.
Franco Raimondi | 23 Jun 10:54 2016
Picon

Question about assessing Racket students

Dear All,

I am a Lecturer at Middlesex University in London. We have been teaching Racket for the past 3 years to first
year students in CS (class size is approx 140 student) and so far we have assessed students by
“observing” their progress on “small competencies”. We call these “Student Observable
Behaviours”, you can find some details in this paper: http://www.rmnd.net/pubs/els14.pdf (see
section 4).

This approach works well especially for students who are continuously engaged. However, we feel that for
some students we fail to capture their ability to develop a more “substantial” piece of code.

If you are teaching Racket, would you mind sharing your assessment strategies?

Thanks!
Franco

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Steven Yang | 23 Jun 10:07 2016
Picon
Gravatar

Evaluation options to allow duplicate definition for identifier

Hello,

   The default racket evaluation doesn't allow duplicated definition for identifier, but for debugging and
exploring purposes, I want to have it on for the module I am working on. Is there option to turn it on/off?

    Meanwhile for `#lang r5rs`, it is also incompatible with the legacy behavior of scheme which allows
duplicate definition of identifiers. 

Best,

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

WurstfagottCon

So… I name some of my machines after medieval instruments. Crumhorn, sackbut. Time for a new one. List of
medieval instruments? Sure, here’s one. Oh, look! There’s one called the Rackett! Let’s see. 

Hmm… turns out the Rackett represents the pinnacle of medieval ingenuity, and sounds approximately
like someone blowing through a comb. It’s also nicknamed the Sausage Basoon, or “Wurstfagott”.

Can we rename our conference to WurstfagottCon?

John

--

-- 
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+unsubscribe@...
For more options, visit https://groups.google.com/d/optout.

Alex Knauth | 21 Jun 17:23 2016

Weird syntax-parse/macro-expansion question

Hello, I have a weird syntax-parse/macro-expansion question.

I have a macro that should raise a good error message. In the debugging output there are two possible
failures, both with the exact same error message and both pointing to what looks like the same syntax
object. However, these failures are different because while the syntax objects look the same and they
come from the same place, they are from two different expansions of the same syntax.

I get this error when I have two clauses of a macro which both fail in the same way, and in my minimal example
these clauses are identical:

#lang racket/base
(require syntax/parse syntax/parse/debug)
(debug-syntax-parse!)
(syntax-parse #'(foo 1)
  [(foo a)
   #:with (~fail #:unless #false "false is not true") (expand #'a)
   4]
  [(foo a)
   #:with (~fail #:unless #false "false is not true") (expand #'a)
   4])

I would like this to fail with the error message:

. foo: false is not true in: (quote 1)

Which it does when I only have one clause. But with the duplicate clauses I get:

. foo: bad syntax in: (foo 1)

The debugging info shows two maximal failures:
(Continue reading)

putting stx in TR structs

Alas, ensnared again by TR the seductress. Why must you raise my hopes only to dash them again?

To be more specific: I want to use TR to specify types for some of the stepper’s structures. However,
structures containing syntax objects are giving me fits. Here’s a simple program:

#lang racket

(module sub typed/racket
  (provide (struct-out wrapper))

  (struct wrapper ([x : Any])))

(require 'sub)

(wrapper-x (wrapper #'1234))

This type-checks, but fails at runtime with the error:

wrapper-x: contract violation
  Attempted to use a higher-order value passed as `Any` in untyped code:
#<syntax:/private/tmp/bar.rkt:10:22 1234>
  in: the range of
      (-> wrapper? Any)
  contract from: (/private/tmp/bar.rkt sub)
  blaming: /private/tmp/bar.rkt
   (assuming the contract is correct)
  at: /private/tmp/bar.rkt:6.10
>

I’ve tried a bunch of things, including specifying a good type for the x field ((Syntaxof Number) works,
(Continue reading)


Gmane