Giter Site home page Giter Site logo

burgled-batteries.syntax's People

Contributors

mmontone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

burgled-batteries.syntax's Issues

Doubles are parsed as object-attributes pairs

Hello,

I'm runnning sbcl, newest version, burgled-batteries.syntax from quciklisp.
If i try to pass a double to some function b-b.syntax thinks it's a call to objects attribute.

'[numpy.sin(1.5d0)](BURGLED-BATTERIES.SYNTAX::CALL* %28BURGLED-BATTERIES.SYNTAX::REF*) "sin"
(PYTHON.CFFI:OBJECT.GET-ATTR*
(PYTHON.CFFI:NUMBER.INT* 1) "5d0"))

maybe I mistake, but still it would be a cool feature if would just work like this.

Best regargs,
Aleksey

Unhandled memory fault when executing plot1 two times in a row

Hi,

continuing improving this great dist.

Like the title says:

startup python, etc

BURGLED-BATTERIES> (plot1)

works fine

BURGLED-BATTERIES> (plot1)
DEBUGGER:
Unhandled memory fault at #x1.
[Condition of type SB-SYS:MEMORY-FAULT-ERROR]

Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10053B0033}>)

Backtrace:
0: (SB-SYS:MEMORY-FAULT-ERROR)
1: ("foreign function: call_into_lisp")
2: ("foreign function: post_signal_tramp")
3: ("foreign function: #x2011718BAA")
4: ((SB-PCL::EMF RUN*) # # "import matplotlib.pyplot as plt")
5: (RUN "import matplotlib.pyplot as plt")
6: ((FLET #:CLEANUP-FUN-0 :IN PLOT1)) [cleanup]
7: (PLOT1)
8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PLOT1) #)
9: (EVAL (PLOT1))
--more--

That thing doesnt happen if I work without the syntax, i.e. only in burgled-batteries package.
I think that importing the library is the problem. Somehow it seems that the function plot1 doesnt clean the symbol in the namespace which holds the matplotlib library after finishing. That also happens with other libraries you try to import inside a function.
I couldn't locate that error more precisely unfortunately.

Best regards,
Aleksey

Arguments are reverted in calls to python function

Hello, me again.
I've found that arguments in calls to python functions are getting reverted somehow.
If I call the plot function of matplotlib.pyplot like this

(let* (($x (list 1.0d0 2.0d0 3.0d0 4.0d0)) ($y (map 'list #'(lambda (x) (* x x)) $x)))
(let (($plt [matplotlib.pyplot]))
(progn
[$plt.plot($x, $y, "-" , linewidth=5)]
[matplotlib.pyplot.show()])))

then plot is called as plot( '-', y, x, **kwargs) as you can see in the quoted output:

(LET* (($X (LIST 1.0d0 2.0d0 3.0d0 4.0d0))
($Y (MAP 'LIST #'(LAMBDA (X) (* X X)) $X)))
(LET (($PLT
(PYTHON.CFFI:OBJECT.GET-ATTR*
(BURGLED-BATTERIES.SYNTAX::REF* "matplotlib") "pyplot")))
(PROGN
(LET ((#:KWARGS1550 (MAKE-HASH-TABLE)))
(SETF (GETHASH "linewidth" #:KWARGS1550) (PYTHON.CFFI:NUMBER.INT* 5))
(BURGLED-BATTERIES::WITH-CPYTHON-POINTER (#:PYFUN1551
(PYTHON.CFFI:OBJECT.GET-ATTR-STRING*
$PLT "plot"))
(PYTHON.CFFI:OBJECT.CALL* #:PYFUN1551
(LIST (PYTHON.CFFI:STRING.FROM-STRING* "-")
$Y $X)
#:KWARGS1550)))
(BURGLED-BATTERIES.SYNTAX::CALL*
(PYTHON.CFFI:OBJECT.GET-ATTR*
(BURGLED-BATTERIES.SYNTAX::REF* "matplotlib") "pyplot")
"show"))))

On the other hand

(let* (($x (list 1.0d0 2.0d0 3.0d0 4.0d0)) ($y (map 'list #'(lambda (x) (* x x)) $x)))
(let (($plt [matplotlib.pyplot]))
(progn
[$plt.plot("-" , $x, $y, linewidth=5)]
[matplotlib.pyplot.show()])))

works perfectly fine.

Also I'd like to make a suggestion. It would be really nice to be able to define an *args list and a **kwarags hashtable and pass it to some python function, e.g. like this

(let* (($x (list 1.0d0 2.0d0 3.0d0 4.0d0)) ($y (map 'list #'(lambda (x) (* x x)) $x)))
(let (($plt [matplotlib.pyplot])
($args (list $x $y "-"))
($kwargs some-lisp-hashtable-with-arguments)
(progn
[$plt.plot(*$args, **$kwargs)]
[matplotlib.pyplot.show()])))

Many thanks for your software and in advance for yout help.

(N.B. I am trying solving numerical problems( FEM, finite volumes etc with lisp and C and do want to plot the solutions and other stuff. Unfortunately, the only plotting librarary suitable for pulbications ( ps-output, nice looking, many features) is matplotlib which is written in python. Therefore, very very nice to have your packages!!)

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.