Giter Club home page Giter Club logo

scheme's People

Contributors

adamwespiser avatar adetokunbo avatar ahstro avatar colourgrey avatar dipeshkaphle avatar erhathaway avatar etiktin avatar hellerve avatar josephsavona avatar jrp2014 avatar kritzcreek avatar kukimik avatar lambdageek avatar mattaudesse avatar mrkgnao avatar sdiehl avatar tmciver avatar tslawler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scheme's Issues

weirdness around begin fn

Repl> (begin (let (x 1 y 20 z 300)(+ x y z) ) )
Error Not a Function
Repl> (begin (define zzz 2)(let (x 1 y 20 z 300)(+ x y z) ) )
321

Is this project abandoned?

From what I see, 5 years have passed but the last 3 chapters (Standard Library, IO, Conclusions) still have not been addressed (of these, IO being the most important probably). Should the project be considered abandoned, then?

Repl doesn't persist definitions

The Repl doesn't remember definitions:

Repl> (define myid (lambda (x) x))
myid
Repl> (myid 1)
Error Unbound Variable: myid

This works:

Repl> (begin (define myid (lambda (x) x)) (myid 1))
1

Parsec w/ T.Text

@sdiehl, having problems getting the parser to work creating LispVal values of strings

gce-work:scheme$ stack build && stack exec scheme
Repl> '(a)
List [Atom "a"]
Repl> '("a")
Parser "<stdin>" (line 1, column 4):
unexpected "a"
expecting end of "\"" or literal string
Repl> '(\"a\")
Parser "<stdin>" (line 1, column 4):
unexpected '\\'
expecting end of "("

It looks like the Parsec standard lisp parser is taking a different approach: https://hackage.haskell.org/package/lispparser-0.3.1/docs/src/Text-ParserCombinators-Parsec-Lisp.html

any insight on parsing in double quoted strings from the repl into LispVal?

Function arguments are evaluated in the wrong scope

Once you fix #23, you will find that the following happens:

(begin
  (define y 42)
  (define foo (lambda (x) x))
  (let (y 12) (foo y)))

This evaluates to 42 instead of the expected 12.

There are two causes:

  1. applyLambda takes args and evaluates them in the environment that was in scope when the closure was created (instead of assuming that the arguments passed in are already in evaluated form).
  2. The function application case of eval incorrectly passes xs (ie, the unevaluated arguments) to the function definition instead of xVal (the evaluated arguments).

Parsing Issue w/ (+ 1 2)

from the project dir, run

./run

and enter (+ 1 2), there is a parser error.
The desired output is "List [Atom \"+\", Number 1, Number 2]"
./src/Parse.hs should be updated...

This should be a good chance to write the docs on Parsec and parsing...

parse3.hs

issue with new parser, parse3.hs

[1 of 1] Compiling Main             ( Parse3.hs, Parse3.o )

Parse3.hs:18:9:
    Couldn't match type β€˜[Char]’ with β€˜T.Text’
    Expected type: Lang.GenLanguageDef T.Text () Identity
      Actual type: Lang.LanguageDef ()
    In the expression: Lang.emptyDef
    In the expression:
      Lang.emptyDef
        {Tok.commentStart = "{-", Tok.commentEnd = "-}",
         Tok.identStart = letter <|> oneOf "+-/*",
         Tok.identLetter = alphaNum <|> oneOf "_'",
         Tok.reservedOpNames = ["'", "\""],
         Tok.reservedNames = ["true", "false", "let", ....]}

Rename repository

I think the repository name of scheme is not descriptive enough and would like to propose changing it to something like write-you-a-scheme-v2 (like the organization). I know I can change the directory to which the project is cloned, but it's more user-friendly if one does not have to do that. :)

Build failing on linux mint

Running

stack build --test

in the main directory yields the following output:


src/Parser.hs
  Atom
  Num Negative
  Num Positive
  String
  Bool True
  Bool False
  Nil
  S-Expr: homogenous list
  S-Expr: homogenous list quoted
  S-Expr: heterogenous list
  S-Expr: heterogenous list quoted
  S-Expr: prim call: neg nums
  S-Expr: prim call: atoms
  S-Expr: nested list

Finished in 0.0029 seconds
14 examples, 0 failures

src/Eval.hs
  test/add.scm
  test/if_alt.scm
  test/let.scm
  test/eval_boolean.scm
  test/eval_boolean_ops.scm
  test/eval_lambda.scm
  test/test_quote.scm
  test/test_car.scm
  test/test_cdr.scm
  test/test_cadadr.scm
  test/test_gt.scm
  test/test_scope1.scm
  test/test_args.scm
  test/define.scm
  test/define_order.scm

Finished in 0.2299 seconds
15 examples, 0 failures

eval extra -- sandboxing
  begin/define
  eval args
  test/define_lambda.scm
  eval args
  foldl evals to something 
  foldl call FAILED [1]
  fold FAILED [2]

Failures:

  test-hs/Spec.hs:134: 
  1) eval extra -- sandboxing foldl call
       uncaught exception: LispException (Error Type Mismatch: numeric op Nil)

  test-hs/Spec.hs:134: 
  2) eval extra -- sandboxing fold
       uncaught exception: LispException (Error Not a Function: (quote (quote (+))))

Randomized with seed 1448178989

Finished in 0.0720 seconds
7 examples, 2 failures

Further, scheme -s test/eval_lambda.scm yields:

scheme: Error Not a Function: 5

and the code fails to correctly evaluate recursive structures (!), e.g. a factorial program in scheme will not work.

A pdf version of wyas-v2?

Hi @adamwespiser , first of all thanks a lot for providing a nice upgrade for Write Yourself a Scheme! As a beginner, it helped me grok Haskell and create projects out of it πŸ‘

I'm just wondering if there would be any .pdf version of this. It may be helpful for someone like me who is not always connected to the internet / prefers reading on a paper print-out.

Thank you so much!

Add support for mutually recursive definitions

Once #23 is fixed, you'll find that the following will not work:

(begin
  (define (even x) (if (== x 0) #t (odd (- x 1)))
  (define (odd x) (if (== x 0) #f (even (- x 1)))
  (even 9))

Returns Unbound variable: odd rather than the expected #f

Update: Actually once #23 and #25 are fixed, you'll find that even singly-recursive functions (such as foldl from the stdlib) will not work. Just trying to get factorial working is worth thinking about.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.