I would like to treat a symbol as a function, and apply it to some arguments.
In other words, if I did something like
(define sym '+)
(apply '+ '(1 2))
I would obtain the answer 3. Is there any way I can do this? The following
works, but I'm wondering if it's the best way:
(eval `(apply ,sym '(1
> At Eli's suggestion, I'm conducting a poll. Does anybody on this list
> use the 'plot' module, or know of someone who does?
Well, I've used it in the past, and I'm thinking about using it in the future.
Nice module! Don't worry about breaking compatability on my account, though.
One thing I
I'm looking to implement some simple programs using mzlib/awk, but the manual
page is rather impenetrable to me. Are there any examples I can use to get an
idea as to how to use it?
_
For list-related administrative tasks:
http://lists.racket-
In scribble, I'm trying to create an unnumbered list like so:
* Foo
* Bar
I do
#lang scribble/manual
@itemlist{ @item{Foo} @item{Bar} }
but it gives me
itemlist: contract violation, expected: item?, given: " "
contract from: /scribble/base.rkt, blaming:
C:\Users\mcarter\repos\tacc\carali\
How do I create summing rules?
Suppose I have the following facts:
post(cash, 26) .
post(cash, -16) .
post(cash, 50) .
post(beer, 20) .
How do I create a rule "bal"
bal(X, ???)
such that the ??? gives me the sum of the second arguments in post satisfying
the first argument X?
Also, is there a
Fascinating. Thanks for the link.
I have a lot - and I do mean a lot - to learn about it. I tried putting in some
simple "facts", and noted how the querying worked. Oh my. It was a bit of an
eye-opener. I see what you mean about the querying. It's as if a lot of what is
in the developers "domai
I've been in the process of writing a little financial accounts package in
Racket. I'm wondering if, instead of writing a lot of scheme code, a lot of
funtionality could be more expressively and concisely be written in Datalog.
I've never used Datalog before, nor Prolog, but I know it's somethin
- Original Message -
> From: Matthew Flatt
> The latest nightly build works correctly on my machine.
That seems to fix things. Many thanks!
_
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users
- Original Message -
> From: Neil Van Dyke
> Does "scribble/comment-reader" do what you need?
Unfortunately, I can't really say, as the Racket documentation on my machine
seems to be broken at the moment :( All I'm trying to do is put in a literal
semi-colon. I've tried ;; and @; ,
I'm documenting my module in a scribble file, and I have a @racket segement in
which I would like to include a semicolon. How do I escape a semicolon?
_
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users
>From: Matthew Flatt
>Sent: Friday, 2 September 2011, 15:56
>I think the problems that you saw are now fixed in the nightly build.
I did the following:
1. Deleted c:\Racket directory (where I install Racket)
2. Deleted C:\Users\mcarter\AppData\Roaming\Racket
- Original Message -
> From: Matthew Flatt
> To: Mark Carter
> Cc: "users@racket-lang.org"
> Sent: Tuesday, 30 August 2011, 15:07
> Subject: Re: [racket] Module docs
>
>T hanks for the details. I see that `raco setup' in a fresh install on
> W
Hi. I zapped everything I could see and installed Racket 5.1.3. I also made
sure I eliminated by PLTCOLLECTS environment variable, and any place that
DrRacket looks in for modules. I used mklink on Win 7 to create a hard link
from
C:\Users\mcarter\AppData\Roaming\Racket\5.1.3\collects\caral
It seems that by trying various things at random I was able to get
documentation to work. I see that there are TWO sets of documents: one in the
docs directory, and another in the planet-docs directory, and maybe a cache
directory, too.
All a bit confusing.
___
I've got things to a stage where my scribble file for my module is actually
produced: it resides in the "doc" subdir. How do I persuade Racket to link the
documentation in with the help system of DrRacket?
_
For list-related administrative tasks
- Forwarded Message -
> From: Matthew Flatt
> I'm puzzled by the warnings, where the same collection is named in two
> ways. Can you show the command line that produced this output?
raco setup carali
Actually, you can visit the root of the project at this link:
https://github.com/bl
I'm trying to build some documentation for my modules, although it's far from
clear what the procedure should be.
I can use my module, but I can't access its help from F1 within DrRacket. I
have issued the command
raco setup carali
and I have obtained the output:
raco setup: version: 5.1.2.3 [
I'm trying to do a regexp split, but I can't get it to work. Here's my code:
(require mzlib/pregexp)
(define str "17.4 25.4 15.7 13.7 19.4 20.9 ")
(pregexp-split #rx"[:space:]+" str)
The output is
'("17.4 \t25.4 \t15.7 \t13.7 \t19.4 \t20.9 \t")
which is of course not
I'm trying to do a regexp split, but I can't get it to work. Here's my code:
(require mzlib/pregexp)
(define str "17.4 25.4 15.7 13.7 19.4 20.9 ")
(pregexp-split #rx"[:space:]+" str)
The output is
'("17.4 \t25.4 \t15.7 \t13.7 \t19.4 \t20.9 \t")
which is of course not
> From: Matthew Flatt
> http://docs.racket-lang.org/guide/reflection.html
>
> for more information about namespaces.
In the end, I couldn't get no loving from it. BUT, I did discover the following
...
Suppose I define the file cache.rkt:
(module cache racket
(provide encache inspect-cac
>The `namespace-set-variable-value!' function might work.
It doesn't quite work:
(define foo 42)
(define bar 'foo)
(namespace-set-variable-value! bar 43)
foo ; => 42, but I want it to be 43
I guess it's perfectly possible to work around it by defining a cache as a
hash, and then getting an se
Is it possible to set an id from a symbol, call it set-symbol? For example, I
might type
(define life -12)
(set-symbol 'life 42)
life ; => 42
The reason I want to do this is so that I can store a cache of variables to
disk.
The cache will contain a list of variables to be stored. So I might ul
- Original Message -
> From: Tony Garnock-Jones
> #lang racket
> (require srfi/19)
> (define (date->seconds date epoch-date)
> (time-second
> (time-difference (date->time-utc date)
> (date->time-utc epoch-date
> (date->seconds (current-date)
>
I'm trying to do a calculation which requires converting a date into years.
Converting a date into seconds is OK, too.
The problem is, there doesn't seem to be a good way of doing this in Racket.
There is a date->seconds function, which looks useful. However, the make-date
function takes in a
I just discovered something. I installed v 5.1.2.3 on my Win XP machine. When I
try to start DrRacket, I obtain
"DrRacket.Exe - Entry Point Not Found: The procedure entry point DecodePointer
could not be located in the dyynamic link library KERNEL32.dll."
So maybe Win XP with any SP should jus
>
>From: Stephen Chang
>I created an executable on Win7 with racket 5.1.2.3 following the
>indicated steps and using the given code (I had to comment out some
>stuff because I dont have the required files), and I was able to run
>it on win xp (sp2) as well.
>
> I created a very basic exe with racket 32bit on windows 7 (64bit) and
> it ran fine on winxp.
>
> I used raco exe and not raco distribute though. Also, I'm not sure
> what it means to have gracket as a base. Which option is that? Mark,
> can you provide some more details about what you are try
>It should work fine if the distribution was made on the 32 bit
>version, which is the only released Windows version for 5.1.1. If
>that's what was used, then I think that there's some unknown problem.
I'm on a 32-bit version of Win 7.
_
For l
I'm using Racket 5.1.1. on win 7. I created an executable of type
"distribution" and base "gracket". A zip file is created.
It runs fine on my machine. I have had a report that it doesn;t run on Win XP,
and when it was tried on Win Vista, the user obtained an error 'can't load dll
libracket3m_
OK, I'm trying to generate module docs, so I run
raco setup
but I get
raco setup: --- building documentation ---
raco setup: error running: (lib carali/http.rkt)
dynamic-require: name is not provided: 'doc by module:
#
raco setup: rendering: scribblings/main/start.scrbl
Any clues on this one
> From: Vincent St-Amour
> A #lang declaration implicitly wraps the rest of the file in a module
> form. Putting an explicit module form there is redundant, and is an
> error.
Ah, well, that is interesting. Many thanks.
_
For list-related adm
Responder wrote:
--- begin ---
You need to enable @{...} syntax.
If you module currently starts
#lang racket/base
change it to
#lang at-exp racket/base
which mixes @{...} syntax support onto the `racket/base' language.
--- end ---
My reply:
It doesn't work. I get
module: illegal use (not
OK, I cleared up some of my problems in a previous post. It seems I have to do
raco setup
to rebuild the module and documentation.
There's a problem, though. I have:
(provide/doc
(proc-doc/names
http-get
(-> string?
string?) ; the output
(string-url)
@{Say something meaningful
I'm still quite puzzled as to how to document my modules.
I have a directory called "carali", which contains rkt files. One of the files
is http.rkt, containing the code:
(module maths racket
(provide http-get)
(require racket/port)
(require net/url)
(require scribble/srcdoc)
(provide/doc (
I have some code that I would like to put in scribble. So far, I have:
Example use of stats:
@code{"(require carali/money)
(stats 'barc '(
41.00 43.20 40.60 50.20 55.66 52.74 64.87 66.25
21.63 22.70
))
"}
When I run scribble,
Suppose I just create a simple web server:
(define (kickoff req)
(kickoff
(send/suspend
(lambda (k-url)
(response/xexpr
`(html (body (a ([href ,k-url]) "Hello world!"
;;; Start the server
(define (go)
(define log-to (build-path (find-system-path 'home-dir)
My personal module is coming together, and I would like to write some
documentation for it. Scribble seems the way to go, but I don't really know how
to tackle the problem. What's the best practise? Create a folder called
scribblings and write scrbl files within it? Is there a way that the html
> From: Jay McCarthy
> (a ([href ,what-you-have]) "link text")
OK now guys, now I'm getting seriously excited about the prospect using Racket
for web servers. I reworked my stateful counter example. Here it is:
#lang racket
a stateful web server
(require web-server/formlets
web-
I thought I'd try to implement a stateful counter web app using DrRacket.
Here's
my code:
#lang racket
define a really simply counter
;;; required libraries
(require web-server/formlets
web-server/servlet
web-server/servlet-env)
(define (counter request)
(let ((coun
Are there any examples on using lex and yacc, as I'm having trouble getting
started. I am trying to write a simple calculator. Here's what I've got so far:
#lang racket/base
(require parser-tools/lex)
(define lex (lexer
((:+ "[0-9]") (values 'int (string->number lexeme)))
Suppose I wanted to make a client/server application that communicates via a
protocol which has to be designed for that application. A neat way of doing it
would be for the client to send s-exprs to the server via TCP, which were then
evaluated. This is a huge security risk, though, because natu
So, I'm learning the ropes of using Racket as a webserver. I'm building a
simple
VAT (tax) calculator. I present my code at the end of this post (which you can
also download via google code).
I think it would be helpful to me if you could critique it a little.
The idea is that you point your
- Original Message
> From: Robby Findler
> (with-handlers ([exn:fail? (lambda (exn) put-specified-default-here)])
> try-something-here)
That's the fellow!
Here's a little convenience macro I defined:
(define-syntax catch-errors
(syntax-rules ()
((catch-all error-v
I can't get my head around Racket's exception mechanism. I want to say "try
something, and if it fails, return a specified default value".
This returns the expected result:
(with-exception-handler (lambda (x) "Oops") (/ 1 0))
because it returns "Oops". However, if I type
(with-exception-han
- Original Message
> From: Jay McCarthy
> Are you requiring scribble/manual? What error makes you think it doesn't
work?
Ah, I see! I had been using
#lang scribble/base
instead of
#lang scribble/manual
Changing it makes things right.
Many thanks!
_
> @link["url"]{descriptive text}
>
Thanks, but I still can't get it to work. Here's what I typed:
@link["http://beginnersinvest.about.com/cs/valueinvesting1/a/101302a.htm"]{Seven
tests of Defensive Stock Selection}
I've tried all sorts of variants, with quotes in various places, but noth
I'm trying to write some documentation using Scribble. It looks quite good, but
I'm having some problems with understanding how I express internal links.
Suppose my URL is http://www.google.com and I want the descriptive text to be
Google Search Engine. How is it done in Scribble?
__
I downloaded sources for Racket 5.0.1, as I would like to build it for
Slackware.
After unpacking and moving to the src directory, I type
./configure
and then
make
A lot of compilation goes on, but it bails out with:
./../../wxcommon/wxJPEG.cxx:967: warning: 'png_struct_def::jmpbuf' is
deprecat
- Original Message
> From: Jay McCarthy
> I'm interested in figuring out what is overwhelming and alleviating
> it. Unless you're overwhelmed by its featurefullness ;)
Yes - there's just a lot to absorb all at once. The example blog for Racket is
very good. There's things that pu
- Original Message
> From: Nadeem Abdul Hamid
> To: Mark Carter
> Cc: users@racket-lang.org
> Sent: Tue, 24 August, 2010 19:33:05
> Subject: Re: [racket] Web input-string with pre-fllled value
>
> >
> > I would like to pre-fill the VAT Rate inp
I'm trying to construct a simple tax calculator in Racket for use over the web.
Here's my code so far:
#lang web-server/insta
(require web-server/formlets)
(define new-post-formlet
(formlet
(div "Amount: " ,{input-string . => . amount}
;,(select-input '("Net" "Gross") . => . type)
Is thee a way of adding a directory to the 'collects' path, or some other way
of specifying where Racket should look for collections?
_
For list-related administrative tasks:
http://lists.racket-lang.org/listinfo/users
Scheme newbie here. I've always had a bee in my bonnet for the Lispy languages,
but had never gotten into them fully for one reason or another. I've been
playing with DrRacket, and have been able to plot graphs using it. Way cool!
Anyway, my actual question is: using DrRacket, is there a way of
53 matches
Mail list logo