Search Results

Search found 1580 results on 64 pages for 'scheme'.

Page 5/64 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Writing out to a file in scheme

    - by Ceelos
    The goal of this is to check if the character taken into account is a number or operand and then output it into a list which will be written out to a txt file. I'm wondering which process would be more efficient, whether to do it as I stated above (writing it to a list and then writing that list out into a file) or being writing out into a txt file right from the procedure. I'm new with scheme so I apologize if I am not using the correct terminology (define input '("3" "+" "4")) (define check (if (number? (car input)) (write this out to a list or directly to a file) (check the rest of file))) Another question I had in mind, how can I make it so that the check process is recursive? I know it's a lot of asking but I've getting a little frustrated with checking out the methods that I have found on other sites. I really appreciate the help!

    Read the article

  • Scheme Infix to Postfix

    - by Cody
    Let me establish that this is part of a class assignment, so I'm definitely not looking for a complete code answer. Essentially we need to write a converter in Scheme that takes a list representing a mathematical equation in infix format and then output a list with the equation in postfix format. We've been provided with the algorithm to do so, simple enough. The issue is that there is a restriction against using any of the available imperative language features. I can't figure out how to do this in a purely functional manner. This is our fist introduction to functional programming in my program. I know I'm going to be using recursion to iterate over the list of items in the infix expression like such. (define (itp ifExpr) ( ; do some processing using cond statement (itp (cdr ifExpr)) )) I have all of the processing implemented (at least as best I can without knowing how to do the rest) but the algorithm I'm using to implement this requires that operators be pushed onto a stack and used later. My question is how do I implement a stack in this function that is available to all of the recursive calls as well?

    Read the article

  • caching previous return values of procedures in scheme

    - by Brock
    In Chapter 16 of "The Seasoned Schemer", the authors define a recursive procedure "depth", which returns 'pizza nested in n lists, e.g (depth 3) is (((pizza))). They then improve it as "depthM", which caches its return values using set! in the lists Ns and Rs, which together form a lookup-table, so you don't have to recurse all the way down if you reach a return value you've seen before. E.g. If I've already computed (depthM 8), when I later compute (depthM 9), I just lookup the return value of (depthM 8) and cons it onto null, instead of recursing all the way down to (depthM 0). But then they move the Ns and Rs inside the procedure, and initialize them to null with "let". Why doesn't this completely defeat the point of caching the return values? From a bit of experimentation, it appears that the Ns and Rs are being reinitialized on every call to "depthM". Am I misunderstanding their point? I guess my question is really this: Is there a way in Scheme to have lexically-scoped variables preserve their values in between calls to a procedure, like you can do in Perl 5.10 with "state" variables?

    Read the article

  • Writing a printList method for a Scheme interpreter in C

    - by Rehan Rasool
    I am new to C and working on making an interpreter for Scheme. I am trying to get a suitable printList method to traverse through the structure. The program takes in an input like: (a (b c)) and internally represent it as: [""][ ][ ]--> [""][ ][/] | | ["A"][/][/] [""][ ][ ]--> [""][ ][/] | | ["B"][/][/] ["C"][/][/] Right now, I just want the program to take in the input, make the appropriate cell structure internally and print out the cell structure, thereby getting (a (b c)) at the end. Here is my struct: typedef struct conscell *List; struct conscell { char symbol; struct conscell *first; struct conscell *rest; }; void printList(char token[20]){ List current = S_Expression(token, 0); printf("("); printf("First Value? %c \n", current->first->symbol); printf("Second value? %c \n", current->rest->first->first->symbol); printf("Third value? %c \n", current->rest->first->rest->first->symbol); printf(")"); } In the main method, I get the first token and call: printList(token); I tested the values again for the sublists and I think it is working. However, I will need a method to traverse through the whole structure. Please look at my printList code again. The print calls are what I have to type, to manually get the (a (b c)) list values. So I get this output: First value? a First value? b First value? c It is what I want, but I want a method to do it using a loop, no matter how complex the structure is, also adding brackets where appropriate, so in the end, I should get: (a (b c)) which is the same as the input. Can anyone please help me with this?

    Read the article

  • How to Solve N-Queens Problem in Scheme?

    - by Philip
    Hi, I'm stuck on the extended exercise 28.2 of How to Design Programs. Here is the link to the question: http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-35.html#node_chap_28 I used a vector of true or false values to represent the board instead of using a list. This is what I've got which doesn't work: #lang Scheme (define-struct posn (i j)) ;takes in a position in i, j form and a board and returns a natural number that represents the position in index form ;example for board xxx ; xxx ; xxx ;(0, 1) - 1 ;(2, 1) - 7 (define (board-ref a-posn a-board) (+ (* (sqrt (vector-length a-board)) (posn-i a-posn)) (posn-j a-posn))) ;reverse of the above function ;1 - (0, 1) ;7 - (2, 1) (define (get-posn n a-board) (local ((define board-length (sqrt (vector-length a-board)))) (make-posn (floor (/ n board-length)) (remainder n board-length)))) ;determines if posn1 threatens posn2 ;true if they are on the same row/column/diagonal (define (threatened? posn1 posn2) (cond ((= (posn-i posn1) (posn-i posn2)) #t) ((= (posn-j posn1) (posn-j posn2)) #t) ((= (abs (- (posn-i posn1) (posn-i posn2))) (abs (- (posn-j posn1) (posn-j posn2)))) #t) (else #f))) ;returns a list of positions that are not threatened or occupied by queens ;basically any position with the value true (define (get-available-posn a-board) (local ((define (get-ava index) (cond ((= index (vector-length a-board)) '()) ((vector-ref a-board index) (cons index (get-ava (add1 index)))) (else (get-ava (add1 index)))))) (get-ava 0))) ;consume a position in the form of a natural number and a board ;returns a board after placing a queen on the position of the board (define (place n a-board) (local ((define (foo x) (cond ((not (board-ref (get-posn x a-board) a-board)) #f) ((threatened? (get-posn x a-board) (get-posn n a-board)) #f) (else #t)))) (build-vector (vector-length a-board) foo))) ;consume a list of positions in the form of natural number and consumes a board ;returns a list of boards after placing queens on each of the positions on the board (define (place/list alop a-board) (cond ((empty? alop) '()) (else (cons (place (first alop) a-board) (place/list (rest alop) a-board))))) ;returns a possible board after placing n queens on a-board ;returns false if impossible (define (placement n a-board) (cond ((zero? n) a-board) (else (local ((define available-posn (get-available-posn a-board))) (cond ((empty? available-posn) #f) (else (or (placement (sub1 n) (place (first available-posn) a-board)) (placement/list (sub1 n) (place/list (rest available-posn) a-board))))))))) ;returns a possible board after placing n queens on a list of boards ;returns false if all the boards are not valid (define (placement/list n boards) (cond ((empty? boards) #f) ((zero? n) (first boards)) ((not (boolean? (placement n (first boards)))) (first boards)) (else (placement/list n (rest boards)))))

    Read the article

  • the HTTP request is unauthorized with client authentication scheme 'Anonymous'

    - by user1246429
    I use firstdata webservice API.I use C# client call firstdata webservice API with WCF. But show error message: "But show error message "System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was ''. --- System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory factory) at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at com.firstdata.globalgatewaye4.api.ServiceSoap.SendAndCommit(SendAndCommitRequest request) at com.firstdata.globalgatewaye4.api.ServiceSoapClient.com.firstdata.globalgatewaye4.api.ServiceSoap.SendAndCommit (SendAndCommitRequest request) at com.firstdata.globalgatewaye4.api.ServiceSoapClient.SendAndCommit(Transaction SendAndCommitSource)" My web.config info below: <behaviors> <endpointBehaviors> <behavior name="FDGGBehavior"> <clientCredentials> <clientCertificate findValue="WS1909642825._.1" storeLocation="LocalMachine" x509FindType="FindBySubjectName" storeName="TrustedPeople" /> <serviceCertificate> <authentication certificateValidationMode="PeerTrust" /> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> <binding name="ServiceSoap" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="Certificate" proxyCredentialType="Ntlm" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> <endpoint address="https://api.globalgatewaye4.firstdata.com/transaction/v11" binding="basicHttpBinding" bindingConfiguration="ServiceSoap" contract="com.firstdata.globalgatewaye4.api.ServiceSoap" name="ServiceSoap" behaviorConfiguration="FDGGBehavior" /> How can resolve question?

    Read the article

  • I want to be able to save a customized color scheme in Vista

    - by Mel
    I know how to change my color scheme in Vista. What I despair about is that after I change it, if I switch to another scheme (such as back to Aero), my customized scheme is gone. If I want, I can take another 30 minutes to customize it so it doesn't burn out my eyes. Is there any way to save this scheme? I tried doing the color scheme change, then trying to save the whole thing as a theme, all to no avail.

    Read the article

  • Recursive breadth first tree traversal

    - by dugogota
    I'm pulling my hair out trying to figure out how to implement breadth first tree traversal in scheme. I've done it in Java and C++. If I had code, I'd post it but I'm not sure how exactly to begin. Given the tree definition below, how to implement breadth first search using recursion? (define tree1 '( A ( B (C () ()) (D () ()) ) (E (F () ()) (G () ())) )) Any help, any, is greatly appreciated.

    Read the article

  • Why do all procedures have to be defined before the compiler sees them?

    - by incrediman
    For example, take a look at this code (from tspl4): (define proc1 (lambda (x y) (proc2 y x))) If I run this as my program in scheme... #!r6rs (import (rnrs)) (define proc1 (lambda (x y) (proc2 y x))) I get this error: expand: unbound identifier in module in: proc2 ...This code works fine though: #!r6rs (import (rnrs)) (define proc2 +) (define proc1 (lambda (x y) (proc2 y x))) (display (proc1 2 3)) ;output: 5

    Read the article

  • Scheme homework Black jack help....

    - by octavio
    So I need to do a game of blackjack simulator, butt can't seem to figure out whats wrong with the shuffle it's suppose to take a card randomly from the pack the put it on top of the pack. The delete it from the rest. so : (ace)(2)(3)(4)(5)...(k) if random card is let say 5 (5)(ace)(2)(3)(4)(5)...(k) then it deletes the 2nd 5 (5)(ace)(2)(3)(4)(6)...(k) here is the code: (define deck '((A . C) (2 . C) (3 . C) (4 . C) (5 . C) (6 . C) (7 . C) (8 . C) (9 . C) (10 . C) (V . C) (Q . C) (K . C))) ;auxilliary function for shuffle let you randomly select a card. (define shuffAux (lambda (t) (define cardR (lambda (t) (list-ref t (random 13)))) (cardR t))) ;auxilliary function used to remove the card after the car to prevent you from removing the randomly selected from the car(begining of the deck). (define (removeDupC card deck) (delete card (cdr deck)) ) (define shuffle2ndtry (lambda (deck seed) (define do-shuffle (lambda (deck seed) (if (> seed 0)( (cons (shuffAux deck) deck) (removeDupC (car deck) deck) (- 1 seed)) (write deck) ) ) ) (do-shuffle deck seed))) (define (shuffle deck seed) (define cards (cons (shuffAux deck) deck)) (write cards) (case (> seed 0) [(#t) (removeDupC (car cards) (cdr cards)) (shuffle cards (- seed 1))] [(#f) (write cards)])) (define random (let ((seed 0) (a 3141592653) (c 2718281829) (m (expt 2 35))) (lambda (limit) (cond ((and (integer? limit)) (set! seed (modulo (+ (* seed a) c) m)) (quotient (* seed limit) m)) (else (/ (* limit (random 34359738368)) 34359738368)))))) ;function in which you can delete an element from the list. (define delete (lambda (item list) (cond ((equal? item (car list)) (cdr list)) (else (cons (car list) (delete item (cdr list))))))) (

    Read the article

  • racket scheme get-argb-pixels

    - by Giles Roberts
    I have a 32 by 32 pixel png file. I'm trying to read the values within it using get-argb-pixels. My code is as follows: #lang racket/gui (require racket/gui/base) (define floor (make-object bitmap% "C:\\floortile.png")) (define pixels (make-bytes (* 32 32 4))) (send floor get-argb-pixels 0 0 32 32 pixels) After executing the code I was expecting a series of 8 bit values to be contained within pixels. Examining pixels gives me the following output: > pixels #"\377\2148\30\377\214<\30\377\234E\30\377\245I\30\377\245I\30\377\234E\30\377\234A\30\377\224A\30\377\224A\30\377\234A\30\377\245E\30\377\255M\30\377\224A\30\377\234E\30\377\245I\30\377\224A\30\377\234E\30\377\234E\30\377\255I\30\377\245I\30\377\245E\30\377\234A\30\377\234E\30\377\234A\30\377\245I\30\377\265Q\30\377\306]\30\377\306Y\30\377\275U\30\377\265Q\30\377\306a!\377\306]!\377\214<\30\377\224A\30\377\224A\30\377\245I\30\377\255M\30\377\255M\30\377\245I\30\377\234E\30\377\234E\30\377\245I\30\377\245I\30\377\255M\30\377\234A\30\377\245E\30\377\265M\30\377\234A\30\377\245I\30\377\245E\30\377\245E\30\377\255M\30\377\245I\30\377\245E\30\377\234A\30\377\234E\30\377\255I\30\377\275U\30\377\306]\30\377\326e!\377\336e!\377\265Q\30\377\326e!\377\326a!\377{8\30\377\224E\30\377\224A\30\377\245I\30\377\245I\30\377\255M\30\377\255M\30\377\255I\30\377\245I\30\377\245I\30\377\245I\30\377\265Q\30\377\214<\30\377\245I\30\377\255M\30\377\265M\30\377\255M\30\377\265M\30\377\265M\30\377\245I\30\377\234E\30\377\234E\30\377\234E\30\377\245E\30\377\275Q\30\377\306]!\377\316a!\377\336i!\377\357q!\377\275Y\30\377\316e!\377\347i!\377k0\20\377\2048\30\377\224A\30\377\265U!\377\234E\30\377\234E\30\377\245M\30\377\255M\30\377\255M\30\377\255I\30\377\255M\30\377\265M\30\377\2048\20\377\245I\30\377\245I\30\377\306Y!\377\265Q\30\377\255M\30\377\265Q\30\377\265M\30\377\265M\30\377\255I\30\377\265Q\30\377\265M\30\377\275U\30\377\316a!\377\326i!\377\347m!\377\367\216)\377\347y)\377\336m)\377\326]!\377s0\20\377{8\30\377{4\20\377\2048\30\377s4\20\377\2048\30\377{4\20\377\214<\30\377\224A\30\377\234A\30\377\224A\30\377\224A\30\377\214<\30\377\2148\30\377\224<\30\377\234A\30\377\214<\30\377\234E\30\377\245I\30\377\265Q\30\377\255M\30\377\265U\30\377\306Y\30\377\265Q\30\377\275U\30\377\326a!\377\336i!\377\347u!\377\357\206)\377\326q)\377\326i)\377\347i!\377s0\20\377{4\20\377{4\30\377\214<\30\377s4\20\377\2048\30\377s4\20\377\224A\30\377\224A\30\377\224<\30\377\234A\30\377\245E\30\377\234E\30\377\234I\30\377\234E\30\377\245I\30\377\245I\30\377\245I\30\377\265Q\30\377\306]\30\377\255M\30\377\255M\30\377\255M\30\377\255M\30\377\275U\30\377\255M\30\377\275U\30\377\316a!\377\306]!\377\326i!\377\367\206)\377\377})\377s4\30\377k,\20\377k,\20\377s4\30\377{4\20\377\2048\30\377c(\20\377\2048\20\377\234A\30\377\245E\30\377\245E\30\377\255I\30\377\245I\30\377\245I\30\377\245I\30\377\265Q\30\377\275U!\377\255M\30\377\255M\30\377\255M\30\377\255M\30\377\275U\30\377\306]!\377\275U\30\377\255M\30\377\306Y!\377\306]!\377\316e!\377\316a!\377\326i!\377\347y)\377\367y)\377c(\20\377c,\20\377k,\20\377s0\20\377s4\20\377\2048\30\377\214<\30\377{4\20\377\214<\30\377\234E\30\377\234A\30\377\245I\30\377\255M\30\377\255M\30\377\255M\30\377\265Q\30\377\265M\30\377\265Q\30\377\265Q\30\377\255M\30\377\265U\30\377\255M\30\377\265Q\30\377\265U\30\377\265U\30\377\265Q\30\377\306Y\30\377\316a!\377\306a!\377\326i!\377\347y)\377\367\202)\377c,\20\377k,\20\377s0\20\377s0\20\377{8\30\377\214<\30\377s,\20\377s0\20\377\214<\30\377\234A\30\377\245E\30\377\255M\30\377\255M\30\377\245I\30\377\255M\30\377\275U\30\377\265U\30\377\265Q\30\377\265Q\30\377\275Y\30\377\255M\30\377\255I\30\377\275U\30\377\275Y!\377\275Y\30\377\265U\30\377\306Y!\377\326e!\377\336m!\377\336q!\377\347})\377\357\202)\377s0\20\377s4\30\377s4\30\377\2048\30\377\234E\30\377\2048\20\377\2148\30\377c(\20\377\2048\30\377\214<\30\377\234E\30\377\265Q\30\377\265Q\30\377\255M\30\377\265M\30\377\316a!\377\275U\30\377\275Y\30\377\265Q\30\377\265Q\30\377\265Q\30\377\265Q\30\377\255M\30\377\275Y\30\377\275Y!\377\275Y\30\377\275U\30\377\316a!\377\347q)\377\367\202)\377\357})\377\347y)\377k0\20\377\2048\30\377{4\30\377\2048\30\377\214A\30\377\2048\30\377\2044\30\377s4\20\377k,\20\377\2048\30\377\224A\30\377\245I\30\377\234A\30\377\234E\30\377\255Q\30\377\275U\30\377\306Y!\377\265Q\30\377\255Q\30\377\265U\30\377\265U\30\377\265Q\30\377\265Q\30\377\316e!\377\316a!\377\306]!\377\275Y!\377\306]!\377\336i!\377\357})\377\367\202)\377\336u)\377k0\20\377s0\30\377\2048\30\377\204<\30\377\204<\30\377\2048\30\377\2048\30\377\214<\30\377s4\20\377\2048\30\377\214A\30\377\224A\30\377\224E\30\377\234E\30\377\265Q\30\377\275U\30\377\306Y\30\377\255M\30\377\265Q\30\377\265Q\30\377\316]!\377\326e!\377\316]!\377\336m)\377\336i)\377\316e!\377\306a!\377\326e!\377\367y)\377\367})\377\367\2061\377\367\2061\377s4\30\377{8\30\377{8\30\377\214<\30\377\214<\30\377\204<\30\377{4\20\377\214<\30\377\214<\30\377\214<\30\377\234E\30\377\234E\30\377\224E\30\377\234E\30\377\245M\30\377\275U\30\377\275U!\377\275U\30\377\306]!\377\306]!\377\316a!\377\326i)\377\347u)\377\326e!\377\347q)\377\336q)\377\326i)\377\326i)\377\347q)\377\367\202)\377\367})\377\367\2061\377{8\30\377s4\30\377{8\30\377\214<\30\377\224A\30\377\234E\30\377\214<\30\377\214<\30\377\224A\30\377\224<\30\377\234E\30\377\255M\30\377\245I\30\377\245I\30\377\255M\30\377\265U\30\377\306]!\377\306]!\377\316a!\377\316e!\377\326e!\377\347m)\377\316e!\377\306]!\377\347u)\377\347u)\377\336m)\377\316e)\377\336q)\377\357y)\377\367\202)\377\367\2021\377{4\30\377s4\30\377\2048\30\377\214A\30\377\224A\30\377\224A\30\377\224E\30\377\214<\30\377\214<\30\377\245I\30\377\234A\30\377\255M\30\377\255M\30\377\245I\30\377\255M\30\377\255Q\30\377\306]!\377\306]!\377\316a!\377\316a!\377\316a!\377\347u)\377\326e!\377\275Y!\377\265Y!\377\336m)\377\306a)\377\336m)\377\336m)\377\326e)\377\347q)\377\336q)\377s0\30\377s0\30\377\204<\30\377\224A\30\377\224E\30\377\234I\30\377\234E\30\377\234E\30\377\255M\30\377\234E\30\377{4\30\377\224<\30\377\245M\30\377\255I\30\377\234A\30\377\255M\30\377\245E\30\377\255M\30\377\265Q\30\377\245I\30\377\275U\30\377\255I\30\377\234A\30\377\224E\30\377\265U\30\377\234I\30\377\224E\30\377\245M\30\377\234M!\377\224A\30\377\234I\30\377\224E\30\377k0\20\377s0\20\377{4\30\377\214<\30\377\224E\30\377\234E\30\377\245I\30\377\234I\30\377\245I\30\377\214<\30\377\214<\30\377\255M\30\377\265Q!\377\265Q!\377\255M\30\377\306]!\377\316a)\377\326e)\377\326a!\377\316]!\377\265Q\30\377\326a!\377\255M\30\377\204<\20\377\245M\30\377\234I\30\377\245M\30\377\275]!\377\234I\30\377\255U!\377\265Y!\377\245M!\377c(\20\377k,\20\377k0\20\377\2048\30\377\224A\30\377\224E\30\377\234I\30\377\245I\30\377\275Y!\377\234E\30\377\245I\30\377\245I\30\377\265U!\377\265Q!\377\265Q!\377\306]!\377\306]!\377\316a!\377\316a!\377\336e)\377\326a!\377\316]!\377\265Q\30\377\224A\30\377\234I\30\377\275]!\377\265Y!\377\275Y!\377\275Y!\377\265U!\377\265])\377\275])\377s4\30\377c(\20\377k,\20\377s0\20\377\214A\30\377\224E\30\377\234E\30\377\306]!\377\234I\30\377\224A\30\377\265U!\377\245I\30\377\265Q!\377\265Q!\377\265M!\377\255M\30\377\306]!\377\306Y!\377\306]!\377\306]!\377\326a)\377\336i)\377\275U!\377\224A\30\377\224A\30\377\306a!\377\275]!\377\275Y!\377\275]!\377\275])\377\275Y!\377\275Y!\377s0\20\377k,\20\377s0\20\377\2048\30\377\214<\30\377\224E\30\377\234E\30\377\245M\30\377\224A\30\377\214A\30\377\245M\30\377\265Q!\377\275U!\377\255I\30\377\245I\30\377\245I\30\377\275U!\377\306Y!\377\275Y!\377\306]!\377\306]!\377\265Q\30\377\255M\30\377\224A\30\377\204<\30\377\255Q\30\377\245M\30\377\255Q!\377\265Y!\377\275]!\377\265Y!\377\275Y!\377s0\20\377k0\20\377{0\20\377\2048\30\377\204<\30\377\204<\30\377\214<\30\377\224A\30\377\316a!\377\245I\30\377\234E\30\377\245I\30\377\265U!\377\265Q!\377\265Q!\377\255M!\377\275U!\377\275U!\377\275U!\377\275Q!\377\255I\30\377\255M\30\377\255Q\30\377\234E\30\377{4\30\377\224A\30\377\214<\30\377\275Y!\377\275Y!\377\275]!\377\255Q!\377\255Q!\377k,\20\377k,\20\377s0\20\377\2044\30\377{4\20\377{4\30\377\2048\30\377\245M\30\377\265U!\377\245I\30\377\214A\30\377\275Y!\377\234A\30\377\255M\30\377\265Q!\377\245M!\377\265U!\377\275Q!\377\245I\30\377\245I\30\377\245M\30\377\265Q!\377\255Q!\377\255M\30\377\214<\30\377\245I\30\377\255Q!\377\306]!\377\306]!\377\275U!\377\265U!\377\255Q!\377c(\20\377Z(\20\377c(\20\377k,\20\377{8\30\377{4\30\377\214<\30\377\214A\30\377\234E\30\377\245I\30\377\245M\30\377\214<\30\377s0\30\377\255M!\377\255I!\377\255M!\377\255M!\377\265Q!\377\265Q!\377\255M!\377\265Q\30\377\245I\30\377\255I\30\377\306Y!\377\275Y!\377\214A\30\377\255Q\30\377\275]!\377\306])\377\306]!\377\255U!\377\255Q!\377k0\30\377k0\20\377k,\20\377s0\20\377s0\20\377s4\30\377{4\30\377\214<\30\377\245I\30\377\224A\30\377\306Y!\377\234A\30\377s0\20\377\245I\30\377\255M!\377\255M!\377\255M!\377\255M!\377\255Q!\377\265M!\377\316]!\377\245E\30\377\316]!\377\306Y!\377\275U!\377{8\30\377\255Q!\377\265Y!\377\275]!\377\275Y!\377\275Y!\377\255Q!\377k0\20\377c,\20\377k,\20\377s0\20\377{4\30\377s0\20\377{4\30\377{4\30\377\2048\30\377\245I\30\377\234E\30\377\234E\30\377k,\20\377\214<\30\377\224A\30\377\245M\30\377\214<\30\377\224E\30\377\214<\30\377\214<\30\377\214<\30\377\245I\30\377\234E\30\377\224A\30\377\224A\30\377k,\20\377\224A\30\377\265Q!\377\265Y!\377\265U!\377\265Y!\377\275Y!\377c(\20\377c,\20\377k,\20\377s0\20\377k,\20\377k0\20\377\2048\30\377\234A\30\377\214<\30\377\224A\30\377\245I\30\377\245I\30\377k0\20\377{4\20\377\214<\30\377\214A\30\377\214<\30\377\204<\30\377\2048\30\377\234I\30\377\224A\30\377\214<\30\377\234E\30\377\234E\30\377\255M\30\377\224A\30\377{8\30\377\255Q!\377\265U!\377\255U!\377\255U!\377\265U!\377c(\20\377k,\20\377s0\20\377s0\20\377{4\20\377\2048\30\377\2048\30\377\2048\30\377\224A\30\377\245M\30\377\245E\30\377\234E\30\377{4\20\377Z(\20\377k0\30\377{8\30\377\2048\30\377\214A\30\377\224A\30\377\234I\30\377\214<\30\377\224A\30\377\224A\30\377\234E\30\377\245I\30\377\255M\30\377{8\30\377\214A\30\377\255U!\377\255U!\377\245Q!\377\265U!\377c,\20\377c(\20\377k,\20\377Z$\20\377Z$\20\377Z(\20\377c(\20\377k,\20\377k,\20\377c(\20\377c(\20\377c,\20\377k0\20\377R \20\377c,\20\377s4\30\377{4\30\377\204<\30\377\2048\30\377\214A\30\377\224A\30\377\224A\30\377\234I\30\377\234I\30\377\224A\30\377\245I\30\377\224E\30\377\2048\30\377\255U!\377\255Q!\377\265U!\377\265Y)\377J \20\377J\34\20\377Z(\20\377k,\20\377k(\20\377c(\20\377R \20\377c(\20\377k,\20\377s0\20\377k0\20\377k0\20\377c,\20\377Z(\20\377c,\20\377s4\20\377s4\20\377\2048\30\377\2048\20\377\2048\30\377\224A\30\377\214A\30\377\234I\30\377\245I\30\377\234I\30\377\245M!\377\245M\30\377\204<\30\377\234M!\377\245Q!\377\265U!\377\255U!\377c,\20\377c,\20\377c(\20\377c(\20\377c(\20\377c(\20\377c(\20\377k,\20\377k,\20\377k,\20\377k0\20\377s4\20\377s0\30\377\204<\30\377c(\20\377s4\20\377s4\30\377{4\20\377{4\30\377\204<\30\377\224A\30\377\234E\30\377\234E\30\377\234E\30\377\234E\30\377\245I\30\377\245I\30\377\224E\30\377\204<\30\377\245Q!\377\255Q!\377\347\327\326\377R$\20\377k,\20\377c(\20\377c(\20\377c(\20\377c(\20\377Z$\20\377c(\20\377c(\20\377k,\20\377k,\20\377k,\20\377s0\20\377{4\30\377\204<\30\377k,\20\377s4\20\377s4\20\377{8\30\377\2048\20\377\214<\30\377\214<\30\377\214A\30\377\234E\30\377\234E\30\377\224A\30\377\224E\30\377\224E\30\377s4\30\377\214A\30\377\265\206s\377\377\377\377\377c,\20\377k,\30\377k0\20\377k,\20\377c(\20\377Z$\20\377Z(\20\377Z$\20\377c(\20\377c(\20\377c(\20\377k,\20\377k0\20\377{4\30\377{8\30\377k,\20\377c,\20\377k0\20\377s0\20\377{8\30\377\2048\30\377\2048\30\377\214<\30\377\224A\30\377\224E\30\377\214<\30\377\214A\30\377\234I\30\377{8!\377\214M1\377\377\373\377\377\377\377\377" This doesn't look like a series of 8 bit values to me. Have I done something wrong or am I misinterpreting the results?

    Read the article

  • Scheme redefine a list...

    - by octavio
    I have a list called hand and another one called deck, the main goal here is to take the first card (or element ) in the list deck and put it in the list hand when i call the fnction draw... (draw hand deck) (2 C) (draw hand deck) (2 C) (3 H) (draw hand deck) (2 C) (3 H) (K D) but everytime i call it the hand never changes value... I'm clueless is there a way like in O-Object to change the content of hand permenantly? and i initialy define hand empty because the player has no card to start. (define hand '())

    Read the article

  • Scheme homework problem, need help.

    - by poorStudent
    Okay one of my homework problems is to take a list of lists and return the car of each sublist as a list. I have it to where I can print out the values, but it's not a list. To be honest, I have no clue how to output lists. Here's what I got: (define (car-print alist) (if (null? alist) (newline) (begin (write (car (car alist))) (display " ") (car-print(cdr alist))))) This is a cheap way to do it, perhaps some help on actually solving this problem would be much appreciated. Not necessarily the full answer but steps to get there. Thanks.

    Read the article

  • scheme struct question

    - by qzar
    ;; definition of the structure "book" ;; author: string - the author of the book ;; title: string - the title of the book ;; genre: symbol - the genre (define-struct book (author title genre)) (define lotr1 (make-book "John R. R. Tolkien" "The Fellowship of the Ring" 'Fantasy)) (define glory (make-book "David Brin" "Glory Season" 'ScienceFiction)) (define firstFamily (make-book "David Baldacci" "First Family" 'Thriller)) (define some-books (list lotr1 glory firstFamily)) ;; count-books-for-genre: symbol (list of books) -> number ;; the procedure takes a symbol and a list of books and produces the number ;; of books from the given symbol and genre ;; example: (count-books-for-genre 'Fantasy some-books) should produce 1 (define (count-books-for-genre genre lob) (if (empty? lob) 0 (if (symbol=? (book-genre (first lob)) genre) (+ 1 (count-books-for-genre (rest lob) genre)) (count-books-for-genre (rest lob) genre) ) ) ) (count-books-for-genre 'Fantasy some-books) It produce following exception first: expected argument of type non-empty list; given 'Fantasy, I don't understand whats the problem. Can somebody give me some explanation ? Thank you very much !

    Read the article

  • Getting the median of 3 values using scheme's

    - by kristian Roger
    The problem this time is to get the median of three values (easy) I did this: (define (med x y z) (car(cdr(x y z))) and it was accepted but when testing it: (med 3 4 5) I get this error: Error: attempt to call a non-procedure (2 3 4) And when entering letters instead of number i get: (md x y z) Error: undefined varia y (package user) Using something besides x y z I get: (md d l m) Error: undefined variable d (package user) the question was deleted dont know how anyway write a function that return the median of 3 values Sorry for editing the question I got that I should put the values in order first not just a sill car and cdr thing so I did so 33> (define (med x y z) (if(and( (<x y) (<y z) y if(and( (<y x) (<x z) x z))))) Warning: invalid expression (if (and< (<x y) (<y z) y if (and ((<y x) (<x z) x z)))) but as u see Im getting a warning so what is wronge ?

    Read the article

  • Scheme sorting a list

    - by John
    Okay so I am trying to take in a list and sort it from greatest to smallest. Example: > (maxheap (list 5 6 2 1 18 7)) ;output: > (18 7 6 5 2 1) So here's what I got so far: (define (mkmaxheap heaplist) (let ((max (mymax(heaplist)))) ;mymax is a func that returns max number, it works (let (( head (car heaplist)) (tail (cdr heaplist))) (if (null? tail) newlist)))) Thats all I could get to compile, all the other code I wrote failed. Any help on solving this would be much appreciated.

    Read the article

  • Currying a function n times in Scheme

    - by user1724421
    I'm having trouble figuring out a way to curry a function a specified number of times. That is, I give the function a natural number n and a function fun, and it curries the function n times. For example: (curry n fun) Is the function and a possible application would be: (((((curry 4 +) 1) 2) 3) 4) Which would produce 10. I'm really not sure how to implement it properly. Could someone please give me a hand? Thanks :)

    Read the article

  • custom URL scheme doesn't work! Navigon AppInteract

    - by rdesign
    Hey guys, It is really frustrating me. I used the doc provided by Navigon itself. Unfortunately it doesn't work as expected. Navigon launches, but stops at the main menu. All I do is this: NSString *myTestStr = [NSString stringWithFormat:@"navigon://App|Another place|FRA|75008|PARIS|rue de Turin|17|2.324621|48.881273"]; NSString *navigonStrEsc = [myTestStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSLog(@"navigonStr: %@", navigonStrEsc); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:navigonStrEsc]]; Any ideas what is wrong with my way? thanks a lot!

    Read the article

  • How to display data uri scheme into a C# WebBrowser Controler

    - by Emanuel
    How can I show an image base64 encoded using WebBrowser control in C#? I used the following code: <img src="data:image/gif;base64,/9j/4AAQSkZJRgABAgAAZABkAA7AAR R894ADkFkb2JlAGTAAAAAAfbAIQABAMDAwMDBAMDBAYEAwQGBwUEBAUHCAYGBw ... uhWkvoJfQO2z/rf4VpL6CX0Dts/63+FaS+gl9A7bP+tthWkvoJfQODCde4qfcg RiNWK3UyUeX9CXpHU43diOK915X5fG/reux5hUAUBftZ" /> but no image is displayed. One solution would be to save images locally and using absolute path, but this is not desirable. Any idea? Thanks.

    Read the article

  • Extracting fields from a define-type object in Scheme

    - by Mike
    Hi, I am trying to extract the field 'name' or 'named-expr' from the following object: (bind 'x (num 5)) ;; note that this is not a list, but a type Binding With the Binding definition: (define-type Binding (bind (name symbol?) (named-expr WAE?))) I have tried, but received the error "reference to an identifier before its definition: Binding-name." Here is what I tried typing: (begin (Binding-name (bind 'x (num 5)))) (begin (define x (bind 'x (num 5))) (Binding-name x)) Thank you!

    Read the article

  • Find all paths from root to leaves of tree in Scheme

    - by grifaton
    Given a tree, I want to find the paths from the root to each leaf. So, for this tree: D / B / \ A E \ C-F-G has the following paths from root (A) to leaves (D, E, G): (A B D), (A B E), (A C F G) If I represent the tree above as (A (B D E) (C (F G))) then the function g does the trick: (define (g tree) (cond ((empty? tree) '()) ((pair? tree) (map (lambda (path) (if (pair? path) (cons (car tree) path) (cons (car tree) (list path)))) (map2 g (cdr tree)))) (else (list tree)))) (define (map2 fn lst) (if (empty? lst) '() (append (fn (car lst)) (map2 fn (cdr lst))))) But this looks all wrong. I've not had to do this kind of thinking for a while, but I feel there should be a neater way of doing it. Any ideas for a better solution (in any language) would be appreciated.

    Read the article

  • Getting the median of 3 values using scheme's car & cdr

    - by kristian Roger
    The problem this time is to get the median of three values (easy) I did this: (define (med x y z) (car(cdr(x y z))) and it was accepted but when testing it: (med 3 4 5) I get this error: Error: attempt to call a non-procedure (2 3 4) And when entering letters instead of number i get: (md x y z) Error: undefined varia y (package user) Using something besides x y z I get: (md d l m) Error: undefined variable d (package user) the question was deleted dont know how anyway write a function that return the median of 3 values

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >