So I'm playing around with a simple doc-string system as a warmup in scheme, the idea being you could do something like:
(def-with-doc (foo a b)
(desc "Takes two parameters and sums them")
(param 'a "First parameter")
(param 'b "Second parameter")
(return "Sum of arguments")
(+ a b)
Which would be turned into:
(begin
...
Hi !
I am reading DrRacket document http://docs.racket-lang.org/guide/binding.html
There is a function
(define f
(lambda (append)
(define cons (append "ugly" "confusing"))
(let ([append 'this-was])
(list append cons))))
> (f list)
'(this-was ("ugly" "confusing"))
I see that we define function f, inside ...
We've been taught various syntax and told how to write definitions, but we've never written any code an ran it. What is the order that Scheme code runs in?
Thanks!
...
Hi,
I'm looking for a function in Scheme to replace a element in an equation by a value.
Exemple : '(+ a b c a) with (1 2 3) should give me '(+ 1 2 3 1). (I don't want to resolve the equation, it was just an exemple)
Basically, I want to say that a=1, b=2, c=3
To proceed, I extract the variables of my first list in another list.
The...
So here's my code:
(define *graph* (read(open-input-file "starbucks4.sxml")))
(define get-artifacts
(lambda (l)
(member (list 'opm:artifact) l)))
When I type get-artifacts(*graph*) I get an error saying procedure application: expected procedure, given:...(the whole of my file contents)
Anyone see what I'm doing wrong? Thanks gu...
This is my code:
(define p (read(open-input-file "starbucks4.sxml")))
(define get-artifacts
(lambda (l)
(member (list 'opm:artifact) l)))
(get-artifacts p)
I was told that the member function searches completely throughout a list. In the .sxml document there is a complicated list that has many elements called "opm:artifa...
im trying to load a sxml file... i manage to do that in scheme. now i want to go through it using recursion and located items that i want. my code is like this,
(define file (read(open-input-file "test1.sxml")))
(define myfunc
(lambda (S)
(if (eq? "foo" (car S))
(display "found\n")
(display "not found\n")
)
...
How can you go from (5 . 2) to (5 2) ??
...
I have a conditional and I want to test to see if two things are true. How can I do an equivalent of && or || from java in scheme?
...
(define-struct binding
(
let ; a string
num ; a number
)
)
(define Bind-A (make-binding empty 1))
(define Bind-B (make-binding "A" 2))
(define Bind-C (make-binding "F" 1))
(define Bind-D (make-binding "A" 1))
(define Bind-E (make-binding "C" 1))
(define Bind-F (make-binding "E" 3))
(define Bind-All (list Bind-A Bind-B Bind-...
I've written a scheme file in DrRacket/Scheme and I have my .rkt file. I need to now compile what I've written with Bigloo. I have Bigloo installed, but I'm not sure how to use it.
Anyone know how?
...
im trying to write a function in Scheme where i accept a list and return all the different derangements (look below for definition) as a list of lists
derangement: A list where no item is in the same place as the original list
ex: '(a b c) -> '(cab)
any help is appreciated!
...
So I'm learning Scheme in a class and my professor doesn't answer questions after 8:00, so I'm hoping you all can help me out. Basically I have a family tree type thing and I'm trying to get all the ancestors of one person, and display them as one string, sorted alphabetically.
The problem is, because of the recursion, each generatio...